Interpreter and compiler for toy language
Written in Go
See http://datasieve.blogspot.com/2018/08/building-toy-language-interpreter-in-go.html and http://datasieve.blogspot.com/2018/08/building-toy-language-compiler-in-go.html for more details
Based on https://interpreterbook.com/
Supports:
- integers, booleans, strings, arrays, hashmaps
- prefix, infix operators
- index operators
- conditionals
- global and local bindings
- first class functions
- return statements
- closures
Build:
➜ go build -o toy
Run in interpreter mode:
➜ ./toy -engine=eval
`Welcome to the Monkey programming language, elizabethwei!`
`Feel free to type in commands. Engine = eval`
>>
Run in compiler mode:
➜ ./toy -engine=vm
Welcome to the Monkey programming language, elizabethwei!
Feel free to type in commands. Engine = vm
>>
Run with or without intermediate print statements: