https://github.com/amtoine/monkey-interpreter-rs
Writing an interpreter for Monkey in Rust.
https://github.com/amtoine/monkey-interpreter-rs
educational interpreter language monkey rust
Last synced: 3 months ago
JSON representation
Writing an interpreter for Monkey in Rust.
- Host: GitHub
- URL: https://github.com/amtoine/monkey-interpreter-rs
- Owner: amtoine
- License: gpl-3.0
- Created: 2023-07-15T15:40:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-22T14:17:32.000Z (8 months ago)
- Last Synced: 2025-01-22T17:46:46.607Z (4 months ago)
- Topics: educational, interpreter, language, monkey, rust
- Language: Rust
- Homepage: https://interpreterbook.com/
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# monkey-interpreter-rs
Writing an interpreter for Monkey in Rust.## Introduction
this project is a Rust implementation of [_Writing An Interpreter In Go_](https://interpreterbook.com/).
see the Monkey language [here](https://monkeylang.org/#what-is-monkey).
## Example
there is currently a very simple CLI in [`main.rs`](src/main.rs) that can run with
```shell
cargo run
```> **Note**
>
> press `` to quit the REPLthen, typing Monkey code should output the resulting AST, e.g.
```c
let f = fn(x, y) { return x + y; }; f(1, 2);
```
will generate the following AST
```js
Program {
statements: [
Let(
"f",
Function(
[ "x", "y" ],
[ Return(Infix(Identifier("x"), Plus, Identifier("y"))) ],
),
),
Expression(
Call(
Identifier("f"),
[ IntegerLitteral(1), IntegerLitteral(2) ],
),
),
],
}
```## Roadmap
- [x] lexer
- [x] parser
- [x] _let_ statements
- [x] _return_ statements
- [x] expressions
- [x] extensions
- [x] boolean literals
- [x] grouped expressions
- [x] _if_ expressions
- [x] function literals
- [x] call expressions
- [ ] evaluation
- [ ] extensions
- [ ] strings
- [ ] built-in functions
- [ ] arrays
- [ ] hash maps
- [ ] CLI