Skip to content
/ monkers Public

Bytecode compiler and VM for the Monkeylang language, written in Rust

License

Notifications You must be signed in to change notification settings

poteto/monkers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monkers πŸ’ + πŸ¦€

Rust

Short for monkey-rs. An implementation of monkeylang. Previously, I implemented the interpreter in TypeScript. I am re-implementing the interpreter and later compiler in Rust as a learning exercise.

REPL

Start the REPL by running cargo run, then entering some Monkey:

πŸ’ >> let a = 5;
5
πŸ’ >> let b = a > 3;
true
πŸ’ >> let c = a * 99;
495
πŸ’ >> if (b) { 10 } else { 1 };
10
πŸ’ >> let d = if (c > a) { 99 } else { 100 };
99
πŸ’ >> d;
99
πŸ’ >> d * c * a;
245025

Command history is saved in history.txt.

Developing

Helpful crates

cargo-watch watches over your Cargo project's source. I use it to run my tests and cargo check whenever a file changes. It's aliased to cargo dev, which expands to:

cargo watch -x check -x test

Optionally you can append the RUST_BACKTRACE=1 flag to get backtraces.

Contributing

PRs are welcome! I am not a Rust expert, so I welcome any recommendations on more idiomatic Rust code.

About

Bytecode compiler and VM for the Monkeylang language, written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages