This is an interpreter for the Monkey language. Try REPL.
$ go get -u github.com/raahii/monkey-interpreter
❯ monkey
Hello, ${username}! This is the Monkey programming language!
Feel free to type in commands
>> 5
5
>> -5
-5
>> 2 * (3 + 2) / 3
3
>> let x = 3
>> if ( x > 5 ) { true } else { false }
false
>> let add = fn(x, y) { return x + y; };
>> add(x, 5)
8
>> let newAdder = fn(x) { fn(y) { return x + y } };
>> let addTwo = newAdder(2);
>> addTwo(x);
5
- integer, boolean, string, array, hash
+
,-
.*
,/
,(
,)
puts(<string>)
,len(<array>)
,first(<array>)
,last(array)
,rest(<array>)
-
Add support for new literals and builtin functions.
- String (litral,
+
) - Array (literal, indexing,
len()
,push()
,first()
,rest()
,last()
) - Hash (literal, indexing)
puts()
- String (litral,