Commit Graph

11 Commits

Author SHA1 Message Date
57c1aa4702 Fix bug in parser where - symbol was being parsed as a + symbol in binary expressions
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-10-13 16:34:18 -07:00
16063d50f8 Add a couple of builtin functions, and the Vm::call() method
* Builtin functions print and println have been added
* If a global lookup fails, the VM will attempt to look up a builtin
* Vm::call(fun, args) allows interrupting the current execution state
  and starting a new function instead. It will return the value left on
  top of the stack.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-10-07 17:21:01 -07:00
76d0e6723f Add "return" statement
Functions may now be exited by returning a value or no value.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-10-07 16:34:23 -07:00
4848a342f0 Add function compilation
Functions are compiled in the most naiive way right now. I want to fix
up how scope lookups are done before it becomes too much to update.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-26 18:31:23 -07:00
f0032afe12 Add function expr parsing
* Introduce new `fn` keyword
* Function example is added to examples/expr.not

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-18 16:39:06 -07:00
1be0fb8a04 Add implementations for parsing assign statements, forgot to do this
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-17 13:17:53 -07:00
e2c43dc911 Add LhsExpr parsing
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-03 18:58:22 -07:00
4d8a815ffc Remove old TODO from parser grammar
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-03 18:49:53 -07:00
f8819279f8 Fix parser for index and call exprs, remove old test that didn't work, add visitor pattern
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-03 18:32:22 -07:00
2fd340a688 Add lexer, parser, ast, and basic command line interaction
* Add lexer and parser using lrpar crate
* AST is added and constructed via lexer and parser
* Command line program `not` will read a file and parse it

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-02 14:40:43 -07:00
178ed4a952 Initial commit
Includes: runtime base from a previous project, syn(tax) module with
parser and lexer

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-09-01 17:32:48 -07:00