The language was created following completion of Part III of the book Crafting Interpreters, porting the C bytecode interpreter into Rust (the implementation of Lox, with classes, closures etc. can be found on the lox branch)
In creating a grammar for a recipe-oriented language, I gained deeper insights into Pratt-parsing and stack-based compilation than the first pass through the book. I have written about the interesting challenges and alterations here (TODO)
Recipe for the nth fibonacci number
- Function support and basic control flow including if-statements and while-loops (grammar here) (TODO incomplete)
- Syntax highlighting is provided by the VSCode extension
chef-colouring
(source here) (TODO finish and publish)
To build local, clone this repository and build with
git clone git@github.com:D-J-Harris/chef.git
cargo build --release
Run either with zero arguments as a REPL, or compile source code at the .chef
or .recipe
extensions
chef
chef <.chef | .recipe file>
--debug_code
- print out each disassembled chunk at the end of compile time--debug_trace
- print out each disassembled operation during runtime
cargo test
Codebases and references all MIT licensed, including this repository
- Test and benchmark files adapted from the book
- Test suite runner code inspired from loxido