Skip to content

D-J-Harris/chef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chef

Chef is a stack-based language designed to read like a recipe


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

Fibonacci Recipe Recipe for the nth fibonacci number

Features

  • Function support and basic control flow including if-statements and while-loops
  • Syntax highlighting is provided by the VSCode extension chef-colouring (here)

Usage

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>

Features Flags

  • --debug_code - print out each disassembled chunk at the end of compile time
  • --debug_trace - print out each disassembled operation during runtime

Test

cargo test

License

Codebases and references all MIT licensed, including this repository

Icon by tulpahn, on Freepik

About

clox programming language written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages