A dynamically typed, object oriented interpreted language implementation in Java.
Inspired by Crafting Interpreters by Robert Nystrom
This version of the interpreter is implemented with a recursive descent parser and a tree walk style interpreter.
In simpler terms - it is orders of magnitude than python.
Calculating the 20th fibonacci number in python takes about 250ms
, it took Reigai about 1500ms
. Check test/speed
for code.
- Clone the repository
- Use command
make [file]
- Running command without file argument will run interpreter in REPL mode
- If the file argument is provided, the file will be interpreted.
You need to have Java and Make installed.
Tested on Windows and Linux.
Check this for documentation of the language.
There are a few features added in Reigai that are missing in Lox, with more coming.
reiPL :> print 5 % 5;
0
reiPL :> print 10 % 8;
2
Returns the remainder after performing division.
reiPL :> print len("Hello");
5
Returns the length of string provided.
reiPL :> print round(3.1415);
3
reiPL :> print floor(3.1415);
3
reiPL :> print ceil(3.1415);
4
Work as expected.
reiPL :> print abs(-6.28);
6.28
Works as expected.
reiPL :> print pow(2, 10);
1024
Raises first argument to second argument.