All Projects → tonyg → racket-bitsyntax

tonyg / racket-bitsyntax

Licence: other
Erlang-style binaries/bitstrings for Racket

Programming Languages

racket
414 projects
Makefile
30231 projects

Projects that are alternatives of or similar to racket-bitsyntax

octet
A library that makes working with bytebuffers painless.
Stars: ✭ 79 (+172.41%)
Mutual labels:  parsing, binary-data
metal
A Java library for parsing binary data formats, using declarative descriptions.
Stars: ✭ 13 (-55.17%)
Mutual labels:  parsing, binary-data
Compiler-written-in-Haskell
A Turing complete language 😉
Stars: ✭ 31 (+6.9%)
Mutual labels:  parsing
libwifi
An 802.11 Frame Generation and Parsing Library in C
Stars: ✭ 27 (-6.9%)
Mutual labels:  parsing
Sketch-A-XNORNet
An implementation of a variation of Sketch-A-Net using XNOR ConvNets using TensorFlow
Stars: ✭ 52 (+79.31%)
Mutual labels:  binary-data
librxvm
non-backtracking NFA-based regular expression library, for C and Python
Stars: ✭ 57 (+96.55%)
Mutual labels:  parsing
attach-juxtapose-parser
Code for the paper "Strongly Incremental Constituency Parsing with Graph Neural Networks"
Stars: ✭ 25 (-13.79%)
Mutual labels:  parsing
http-accept
Parse Accept and Accept-Language HTTP headers in Ruby.
Stars: ✭ 69 (+137.93%)
Mutual labels:  parsing
JuCC
JuCC - Jadavpur University Compiler Compiler
Stars: ✭ 34 (+17.24%)
Mutual labels:  parsing
memology
Memes - why so popular?
Stars: ✭ 32 (+10.34%)
Mutual labels:  parsing
wrangler
Wrangler Transform: A DMD system for transforming Big Data
Stars: ✭ 63 (+117.24%)
Mutual labels:  parsing
Concrete-Syntax-Tree
Concrete Syntax Trees represent s-expressions with source information
Stars: ✭ 48 (+65.52%)
Mutual labels:  parsing
bracer
Java library for parsing and evaluating math expressions
Stars: ✭ 18 (-37.93%)
Mutual labels:  parsing
Singulink.IO.FileSystem
Reliable cross-platform strongly-typed file/directory path manipulation and file system access in .NET.
Stars: ✭ 16 (-44.83%)
Mutual labels:  parsing
siemstress
Very basic CLI SIEM (Security Information and Event Management system).
Stars: ✭ 24 (-17.24%)
Mutual labels:  parsing
kataw
An 100% spec compliant ES2022 JavaScript toolchain
Stars: ✭ 303 (+944.83%)
Mutual labels:  parsing
cvscan
Your not so typical resume parser
Stars: ✭ 46 (+58.62%)
Mutual labels:  parsing
lua-luaepnf
Extended PEG Notation Format (easy grammars for LPeg)
Stars: ✭ 21 (-27.59%)
Mutual labels:  parsing
Ohm-S
A Squeak/Smalltalk implementation of the metaprogramming framework Ohm.
Stars: ✭ 18 (-37.93%)
Mutual labels:  parsing
tangle-rs
a collection of tools to do tangle in rust
Stars: ✭ 23 (-20.69%)
Mutual labels:  parsing

racket-bitsyntax

Adds library support for slices and splices of byte-vectors to Racket, and adds syntax for pattern-matching such bit-strings, inspired by Erlang's binary pattern-matching:

Documentation

A rendered version of the documentation for this library is available via Github Pages:

Example

Here's a Racket equivalent of the example given in the Erlang documentation:

(define IP-VERSION 4)
(define IP-MINIMUM-HEADER-LENGTH 5)
(bit-string-case datagram
  ([ (= IP-VERSION :: bits 4)
     (header-length :: bits 4)
     service-type
     (total-length :: bits 16)
     (id :: bits 16)
     (flags :: bits 3)
     (fragment-offset :: bits 13)
     ttl
     protocol
     (header-checksum :: bits 16)
     (source-ip :: bits 32)
     (destination-ip :: bits 32)
     (rest :: binary) ]
   (when (and (>= header-length 5)
              (>= (bit-string-length datagram) (* header-length 4))))
   (let ((options-length (* 4 (- header-length IP-MINIMUM-HEADER-LENGTH))))
     (bit-string-case rest
       ([ (opts :: binary bytes options-length)
          (data :: binary) ]
        'datagram-valid))))
  [else
   'datagram-not-valid])

Licence

Copyright © 2011–2017 Tony Garnock-Jones

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].