A monkey without a tree. A single pass compiler variation of the Monkey Language’s virtual machine. Implemented in C#.
monkey.exe [ scriptFile.monk ] [ -b ]
- Arguments are optional and REPL mode is activated when they are not provided
- The -b switch enables benchmarking when running script files. The virtual machine's run time will be reported.
- Comments: single line (
//
) and multi-line (/* */
) - Additional binary/infix operators
- “... than and equal” comparisons:
>=
,<=
- Bit shifts:
>>
,<<
- Power and modulo,
^
,%
- “... than and equal” comparisons:
- “
exit
” command for terminating the REPL or script - Numbers within identifier names
- Additional error handling
- Returns outside functions
- Ignoring empty code
- The parser is merged into the compiler
- The AST nodes are gone
- Where avoidable, hashmaps/dictionaries are not used for looking up:
- Keywords
- Pratt parse functions
- Opcode operand counts and bit widths
- Syntax tree based optimization techniques are no longer applicable, so an opcode for less than has been added.
- Go “
const
” enums that originally contained string members are replaced with numeric enums