Writing an interpreter for Monkey in Rust.
this project is a Rust implementation of Writing An Interpreter In Go.
see the Monkey language here.
there is currently a very simple CLI in main.rs
that can run with
cargo run
Note
press
<c-c>
to quit the REPL
then, typing Monkey code should output the resulting AST, e.g.
let f = fn(x, y) { return x + y; }; f(1, 2);
will generate the following AST
Program {
statements: [
Let(
"f",
Function(
[ "x", "y" ],
[ Return(Infix(Identifier("x"), Plus, Identifier("y"))) ],
),
),
Expression(
Call(
Identifier("f"),
[ IntegerLitteral(1), IntegerLitteral(2) ],
),
),
],
}
- lexer
- parser
- let statements
- return statements
- expressions
- extensions
- boolean literals
- grouped expressions
- if expressions
- function literals
- call expressions
- evaluation
- extensions
- strings
- built-in functions
- arrays
- hash maps
- CLI