See also the design of core compiler systems.
├─ cli/ Compiler CLI, tools and help texts
├─ docs/ Documentation files
├─ design/ Design of language syntax and compiler core systems
├─ dev/ Contribution flow and high-level code structure
└─ . User documentation
├─ lib/ Root for all standard library packages
├─ bait/ Core compiler implementation
└─ ...
├─ tests/ Tests for general language features
└─ ...
The compiler consists of the following core packages that are all in the bait
namespace:
ast
: Defines AST nodes and the type systembuilder
: Collect files, resolve imports and run all compilation stageschecker
:- Resolve all type information
- Perfrom error and type checks
context
: Defines the scope system- Code Generation
gen.c
: C backend (🚧)gen.js
: JavaScript backend
lexer
: Break source code into tokensparser
: Create the AST and perform basic type resolving for constants and globalspreference
: Define preferences and argument parsingtoken
: Defines tokens and their precedencetransformer
: Perform some optimizations on the AST
Other packages include:
errors
: Data structures for compiler messages and their printing- Utilities
util.escape
: Helpers to escape charaters in stringsutil.testing
: Common logic for in-out testsutil.timers
: Helpers to measure performance of compiler stagesutil.tools
: Logic to launch tools incli/tools/