Run go run .
in /src/donkey
to execute the REPL.
runnings test coverage
go test -coverpkg=./... ./...
[x] added line and column numbers [ ] show code where error occured
[x] string concatenation: "he" + "yo" = "heyo"
[x] string substraction: "hey ho there" - "ho" = "hey there"
[x] string equal: "hey" == "hey" = true
[ ] fix edge case arithmetic : 1 / 0
[x] add blocking http GET request [x] make http fetch non-blocking with go routines [ ] add import files support
We interpret Donkey source code in a series of steps.
First comes the lexer which turns source code it into tokens.
Then comes the parser and turns the tokens into an AST.
Afterwards, macros are processed and expand the AST.
Finally, Eval
takes this AST and evaluates its nodes recursively, statement by statement, expression by expression.
Lexing, parsing (macro expansion) and evaluation -- strings to tokens, tokens to AST, macro expansion, AST to output.