Skip to content
An idiomatic C# port of the Monkey programming language from the Writing An Interpreter In Go book.
Branch: master
Clone or download
Latest commit ff5572c Jul 5, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Monkey.Cli Clean-up Jul 5, 2019
Monkey.Tests Clean-up Jul 5, 2019
LICENSE Clean-up Jul 5, 2019
Monkey.sln Initial checkin. May 8, 2018 Update Jul 3, 2019


This repository contains a C# port of the Monkey programming language from the Writing an interpreter in Go book. Its code closely resembles that presented in the book, but written in idiomatic C# for the .NET Core runtime. Using the instructions below, the interpreter runs on both Windows, Mac, and Linux.

The Monkey parser is an hand-written LL(1) hybrid of a traditional recursive descent parser for statements and a Pratt, also known as Top Down Operator Precedence, parser for expressions. The hybrid parser ensures efficient parsing while supporting operator precedence and associativity. Its outputs is an abstract syntax tree which the tree walking evaluator traverses as part of executing a Monkey program.

The complete implementation of the lexer, parser, and evaluator consists of 2,200 lines of code with an additional 1,150 lines of tests. Not a lot of code for such a capable interpreter, implemented entirely without third party libraries.


The Monkey language supports mathematical expressions, variable bindings, functions and the application of those functions, conditionals, return statements, and advanced concepts such as higher-order functions and closures. The data types supported are integers, booleans, strings, arrays, and hashes.


See the official homepage. Navigate to "The Monkey Programming Language" section for examples and browse through the tests in this repository.

Getting started

$ git clone
$ cd Monkey-CSharp
$ dotnet build
$ dotnet test Monkey.Tests
$ dotnet run -p Monkey.Cli


You can’t perform that action at this time.