Skip to content

ericqweinstein/monkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tutorial: Writing an Interpreter in Go

About

Following a tutorial that implements an interpreter for the Monkey programming language (Thorsten Ball's Writing an Interpreter in Go).

Requirements

  • Go 1.13+

Running Locally

$ make repl

Testing

$ make test

Examples

>> puts("Hello, world!")
Hello, world!
null
>> 1 + 1
2
>> let items = {"foo": "bar", "baz": "quux"}
>> items
{foo: bar, baz: quux}
>> items["foo"]
bar
>> items["oh no"]
null
>> let numbers = [1, 2, 3, 4, 5]
>> numbers
[1, 2, 3, 4, 5]
>> numbers[0]
1
>> numbers[9]
null
>> let square = fn(x) { x * x; }
>> square(2)
4
>> "o" + "m" + "g"
omg

About

Code for Writing an Interpreter in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages