src/bincontains binary tools:- encode JS source to Binary AST;
- decode Binary AST back to JS source;
- dump information on a file;
src/sourcecontains tools for manipulating JS source:- parsing;
- pretty-printing;
speccontains the specifications for the JS language, as webidl;examplescontains few additional tools/examples- compare compression between several algorithms;
- generate random ASTs for testing;
- test roundtrip encoding/decoding of a file.
Most of this project is contained in subcrates.
crates/binjs_sharedcontains shared utilities, used both at build-time and run-time. Features:- tools for dealing with JSON;
- tools for dealing with ASTs
crates/binjs_metais used mostly at build-time, to generate eg. the ES6 grammar or, in Firefox, to generate the SpiderMonkey parser. It may also be used at runtime. Features:- read a grammar specification from a webidl;
- reflection of the grammar;
- sanity tests on the grammar;
- deanonymization of anonymous grammar nodes;
- ...
crates/binjs_generate_libraryusescrates/binjs_metato generate a strongly-typed AST and tools for a specific grammar, e.g. the ES6 grammar ofspec/es6.webidl;crates/binjs_iocontains tools for manipulating the container format. It is entirely independent of the language being manipulated.- encoding/decoding specific low-level data structures from/to bytes;
- token readers, token writers for these formats;
crates/binjs_genericoffers generic tools to manipulate actual ASTs. These tools are not specialized to any grammar (hence the name generic), but rely upon the reflection of the grammar ofcrates/binjs_meta. These tools are slower and less safe than those ofcrates/binjs_es6but offer a second implementation for testing purposes. Features:- generating random JSON ASTs for a grammar;
- comparing two JSON ASTs in a grammar;
- encoding/decoding entire JSON ASTs from/to bytes using a format defined in
crates/binjs_io.
crates/binjs_es6offers specialized tools to manipulate ES6 ASTs. Some of these tools are generated bycrates/binjs_generate_library. Features:- a strongly-typed AST guaranteed to match the specs of
spec/es6.webidl; - annotating scopes,
eval, ... - serialization and deserialization of strongly-typed ES6 ASTs from/to bytes using a format defined in
crates/binjs_io.
- a strongly-typed AST guaranteed to match the specs of