Skip to content

LeslieZhu/monkey-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monkey: Writing An Interpreter/Compiler In C++

Reference the book Writing An Interpreter In Go and Writing A Compiler In Go.

But re-write the Monkey interpreter/compiler with C++.

  • src/01: token and lexer
  • src/02: parser
  • src/03: evaluation
  • src/04: builtin funcs, string, array, hashmap
  • src/05: bytecode and virutal machine, OpConstant and OpAdd only
  • src/06: expression and condition statement
  • src/07: symbol table, string, array, hashmap and index expression
  • src/08: function
  • src/09: butiltin functions
  • src/10: function closures and benchmark fibonacci

Also see the MinYiLife Blogs

Run

For example:

$ cd src/10/
$ mkdir build/
$ cd build/
$ cmake ..
$ make

$ ./test_monkey

$ ./monkey

Hello lesliezhu! This is the Monkey-CPP programming language!
Feel free to type in commands
>> let add = fn(x,y){ return x + y; }
>> add(3,4)
7
>>

Requires