A simple interpreter for the Monkey programming language written in Python.
Note
You need to have uv installed as a prerequisite.
To enter the REPL environment, invoke Prymate without any arguments:
$ uv run prymate
Prymate 0.5.0 [running on Linux]
Type exit() to leave the REPL.
>>> puts("Hello, world!")
Hello, world!
nullOr, you can alternatively execute a file by specifying the file path through -f or --file argument:
$ uv run prymate -f [path to file]
...To run the test suite,
$ uv run pytest
...Prymate implements all vanilla Monkey constructs, and also implements following additional features:
- Additional Inbuilt Functions like
help,exit,type,gets,sumarr,zip,int,strand more - String
!=and==operations - Modulo
%for determining the remainder of a expressiona / b - Floating point literals (type
FLOATin the interpreter) - Variable mutability (identifiers declared using
letare mutable) - While loops
- Constants (
constkeyword replaceslets vanilla behaviour)
This interpreter wouldn't have been possible without the excellent Writing an Interpreter in Go by
Thorsten Ball.
I highly recommend you to read it, and build your own Monkey interpreter!
Prymate is licensed under the terms of the MIT license.