Monkey language interpreter made in Rust
2017 · Rust · Nom · Source

Monkey has a C-like syntax, supports variable bindings, prefix and infix operators, has first-class and higher-order functions, can handle closures with ease and has integers, booleans, arrays and hashes built-in.
There is a book about learning how to make an interpreter: Writing An Interpreter In Go. This is where the Monkey programming language comes from.
Software model
The most important part of this project is that both the lexer and parser are made with the Nom library. Everything is then built into an AST for execution. It has several unit tests to ensure it doesn't break when I update the libraries or add new features.
Examples of code you can run
let = ;
let = ;
let = ;
let = ;
let = ;
;
let = ;
let = ;
;This is totally valid code and will run like so:
)
How to run
Build and test
Running the REPL
Running the Interpreter
Source code
You can find the project's source code on GitHub.
Back to Experiments · read the type-design lessons · see also A not so classic Chip8 emulator · Home.
