loenard97 / monkey-py

A Python interpreter for the monkey language from the book Writing An Interpreter In Go by Thorsten Ball

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

monkey-py

A Python interpreter for the monkey language from the book Writing An Interpreter In Go by Thorsten Ball

The Monkey Language

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

About

A Python interpreter for the monkey language from the book Writing An Interpreter In Go by Thorsten Ball

License:MIT License


Languages

Language:Python 98.8%Language:Makefile 0.7%Language:Monkey 0.5%