A Python interpreter for the monkey language from the book Writing An Interpreter In Go
by Thorsten Ball
Monkey is a toy language from the books Writing An Interpreter In Go
and Writing A Compiler In Go
by Thorsten Ball
.
Check out the website here.
It includes some basic datatypes, conditionals and functions:
let x = 1;
let string = "Hello World!";
let array = [1, 2, 3];
let func = fn(x, y) {
return x + y;
};
if (x == 0) {
true
} else {
false
}
This Implementation contains an Interpreter and a REPL:
python main.py <file_name>
interprets a .monkey file.
Running main without arguments starts a sandbox REPL, that evaluates each statement:
python main.py
>> x = 3
3