conlang: Variable binding and cleanup

ast: Separate concerns, and remove Walk
interpreter: implement variable binding
This commit is contained in:
2023-10-29 01:13:48 -05:00
parent 35d214c9f6
commit 8fe89e6297
5 changed files with 558 additions and 417 deletions

View File

@@ -16,13 +16,13 @@ Fn = "fn" Identifier Block ; (* TODO: params, return value*)
(* # Expressions *)
(* expression *)
Expr = Assign ;
Block = '{' Expr '}' ;
Block = '{' Stmt* Expr? '}' ;
Group = '(' Expr? ')' ;
Primary = Item | Identifier | Literal
Primary = Identifier | Literal
| Block | Group | Branch ;
(* expression::math *)
Assign = Compare (AssignOp Compare)* ;
Assign = Identifier (AssignOp Assign) | Compare ;
Compare = Range (CompareOp Range )* ;
Range = Logic (RangeOp Logic )* ;
Logic = Bitwise (LogicOp Bitwise)* ;