This is a project to write an interpreter and a compiler for a made up language Monkey. The repository follows the book "Writing an Interpreter in Go" until Tag Book1End, and its sequel "Writing a Compiler in Go" until Tag Book2End. All further commits are my own contribution.
- Clone the repository
- Run the command
cd MyCode/to change directories. - To run the REPL, run the command
./build/monkey. - Alternatively, create a file with extension
.mkyand run the command./build/monkey [file]to compile and run the file
- Clone the repository
- Run the command
cd .\MyCode\to change directories. - To run the REPL, run the command
.\build\monkey. - Alternatively, create a file with extension
.mkyand run the command.\build\monkey [file]to compile and run the file
A pre-written file test.mky is also present in the repository
- Clone the repository
- Run the command
cd MyCode/to change directories. - Run command
.\build\benchmark -engine=vm|eval|[blank] [file-path]- To run using compiler and vm,
-engine = vm - To run using interpreter,
-engine = eval - To perform comparison between the two, ignore the
-engineflag - To perform benchmark testing on a custom file, include the file-path of the file. (Extension =
.mky) - Do not specify the file path before the
-engineflag
- To run using compiler and vm,
- Clone the repository
- Run the command
cd .\MyCode\to change directories. - Run command
.\build\benchmark -engine=vm|eval|[blank] [file-path]- To run using compiler and vm,
-engine = vm - To run using interpreter,
-engine = eval - To perform comparison between the two, ignore the
-engineflag - To perform benchmark testing on a custom file, include the file-path of the file. (Extension =
.mky) - Do not specify the file path before the
-engineflag
- To run using compiler and vm,
- The default benchmark is based on a pre-written fibonacci recursion program.
- The fibonacci number can be changed by going into
./benchmark/main.go Ln 30, and editing the number in the function call.