The purpose of the Monkey Programming Language is to learn different aspects of implementing a language. It was invented by Thorsten Ball, who offers an implementation in his book Writing An Interpreter In Go. The main purpose of this repo is to extend the possibilities to explore this language by the help of various visualizations of the chosen abstract syntax tree (ast) and the steps of evaluation. These visualizations can be requested by an extended interactive environment that offers a set of multidimensional options and tools for convenience. Since Monkey is a language intended for learning purposes, the implementations are designed in such a way that they are open for changes and additions to the parser and evaluator. There is also a set of tests that may give rise to changes in the implementation, because they document certain problems within the interpreter in the state described in the book.
Currently, this repo is still very much work in progress.
- decide on "final" instruction set
- what is a setting? what is a command?
- when should pdfs be created?
- change session.go accordingly
- decide package structure
- implement all commands
- write user manual
- add workflow
- mainly to check installation requirements
- write discussion doc
- add tests for ast: String-methods
- command-line tool for creating pdfs
- with option
setup
for environment setup
- with option
- implemented in monkey/session
- replaces monkey/repl
- still called in main.go
In addition to go, the command pdflatex
needs to be installed for creating pdfs.
You can check whether pdflatex
is installed by which pdflatex
.
For Ubuntu, the installation can be done by:
sudo apt-get install texlive-base texlive-latex-extra
Cou can use the interactive environment locally by cloning this repo, moving into it and then execute
go run main.go
The interpreter code (i.e. the modules monkey/{token,lexer,ast,parser,object,evaluator}) is the original code from the interpreter book (Version 1.7) with only very few alterations described here (TODO).
You can alter the code or add to it and visualize the differences in the interactive environment.
A starting points for altering might be the additional tests
- see (yet non-existent) User Manual
- maybe small demo
- see (yet non-existent)doc-discussion
- see tests + their doc (add links)
- original interpreter code: Writing An Interpreter In Go
- inspiration for command sets in interactive environments: swipl and ghci
- inspiration for implementing an interactive environment in go: gore