Crafting Interpreters tree walking interpreter but in go, with a few add ons.
+=, -=, etc..
operators.printf
and other native functions.- lambda's or annoymous functions.
var a = fun(x) { print x; };
- repl can evaluate expressions, not only statements. (WIP)
2 + 3
in the repl prints 5.
- static class functions using the
static
keyword before a class method. - arrays and hashmaps
git clone --depth=1 https://github.com/Subarctic2796/gojlox.git
cd gojlox
make build
./gojlox
- make instances hashable
- maybe add id or uuid to instance that can then be used for the key
- add ability to define multiple variables on the same line
var a, b, c = 1, "hi", true;
- add support for expressions in the repl
- improve performance
- move some of the resolver checks to the parser
-
ErrAlreadyInScope
check -
ErrLocalInitializesSelf
check -
ErrLocalNotRead
check
-
- use arrays instead of hashmaps for
Env
struct - move away from visitor pattern, and just use straight type checks
- precompute some binary nodes
- make real negative numbers
- store scope info in ast nodes
- move some of the resolver checks to the parser
- add arrays and hashmaps
- add trailing comma support
- add hashmaps
- make instances hashable
- add arrays
- add fancy indexing
- add slicing
print arr[2:5];
- add negative indexing
print a[-2];
- add slicing
- add
in
keyword for arrays and hashmaps- add
for in
loops. - add indexed looping
for (var k, v in hashmap) printf(k, v);
- add
- make
;
optional - add ability to import other files
- add type hints (want to make it statically typed if possible)
- add errors so that scripts can recover
- add proper variadics
- add ability to define multiple variables on the same line
var a, b, c = 1, "hi", true;
- add test suite
- add
--tokens
and--ast
flags to output the tokens and ast respectively to stdout (maybe compile flag also)- add pretty printer for ast
- consolidate
Return
,Break
,Continue
Statements intoControlStmt
- add
continue
keyword
- add
- remove
genAst.go
script - add native classes (act as modules maybe?)
- back port clox variable handling ?
- add compile step (?)
- create Makefile
- add better error messages
- add
else if
branches andswitch
cases - add debugging support, dumping env, etc
- add a native dummy function
- setup github releases
- add string interpolation