https://github.com/sco1/monkey
A Go interpreter and compiler for the Monkey esolang
https://github.com/sco1/monkey
go golang monkey-language
Last synced: 9 months ago
JSON representation
A Go interpreter and compiler for the Monkey esolang
- Host: GitHub
- URL: https://github.com/sco1/monkey
- Owner: sco1
- License: mit
- Created: 2023-04-27T13:32:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-16T23:27:05.000Z (about 3 years ago)
- Last Synced: 2025-02-13T09:38:02.974Z (over 1 year ago)
- Topics: go, golang, monkey-language
- Language: Go
- Homepage: https://thorstenball.com/books/
- Size: 128 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# monkey
A Go interpreter and compiler for the Monkey esolang.
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. The language was created for Thorsten Ball's [*Writing An Interpreter In Go*](https://interpreterbook.com) and [*Writing A Compiler In Go*](https://compilerbook.com/) texts.
## Implementation Notes
### Source Files vs. REPL
Support is provided for executing source files as well as launching the REPL:
* `go run main.go` will open the REPL
* `go run main.go ./hello_world.mnk` will execute the specified source file
By default, execution is done using the VM created from the compiler book. The `--no-vm` flag can be used to instead execute using the interpreter created from the interpreter book.
### *Writing an Interpreter In Go*
* Macro support from [*The Lost Chapter: A Macro System For Monkey*](https://interpreterbook.com/lost) is implemented