An implementation of the Monkey programming language written in Go, based on the book Writing an Interpreter in Go by Thorsten Ball.
This project builds a tree-walking interpreter from scratch. The interpreter parses source code, builds an Abstract Syntax Tree (AST), and evaluates it by walking the tree.
Monkey is a small programming language designed specifically for educational purposes. It has no other implementation besides the one built in this project.
Although compact, Monkey includes many powerful language features:
- C-like syntax
- Variable bindings
- Integers and booleans
- Arithmetic expressions
- Built-in functions
- First-class and higher-order functions
- Closures
- Strings
- Arrays
- Hash maps
make runYou can run the interpreter and pass a Monkey source file to tokenize and display its tokens:
make run/file file=<f>Replace f with any Monkey source file you want to process.
To check code quality and style, run:
make linterThis uses golangci-lint with a 5-minute timeout.
To run all tests with coverage:
make testTo run only the scanner package tests:
make test/scanner