/monkey

Writing An Interpreter In Go

Primary LanguageGoOtherNOASSERTION

Monkey

            __,__
   .--.  .-"     "-.  .--.
  / .. \/  .-. .-.  \/ .. \
 | |  '|  /   Y   \  |'  | |
 | \   \  \ 0 | 0 /  /   / |
  \ '- ,\.-"""""""-./, -' /
   ''-' /_   ^ ^   _\ '-''
       |  \._   _./  |
       \   \ '~' /   /
        '._ '-=-' _.'
           '-----'
  • mathematical expressions
  • variable bindings
  • functions
  • application of those functions
  • conditionals
  • return statements
  • higher-order functions
  • closures
  • data types
    • integers
    • booleans
    • strings
    • arrays
    • hashes
  • bytecode compiler
  • virtual machine

Eval

go run main.go

VM

go build -o monkey . && ./monkey

Benchmark

go build -o fibonacci ./benchmark
./fibonacci -engine=eval
./fibonacci -engine=vm

Writing An Interpreter In Go

Go there and buy this now: https://interpreterbook.com/