conlang: Add unconditional loop expression, for desugaring

This commit is contained in:
2024-04-17 00:29:09 -05:00
parent ec1a1255ad
commit 00d72b823a
8 changed files with 62 additions and 10 deletions

View File

@@ -99,7 +99,7 @@ Index = Primary ('[' Indices ']')* ;
Indices = (Expr ',')* Expr? ;
Primary = Literal | Path | Array | ArrayRep | AddrOf
| Block | Group
| Block | Group | Loop
| If | While | For | Break | Return | Continue;
Literal = STRING | CHARACTER | FLOAT | INTEGER | Bool ;
@@ -114,6 +114,7 @@ Block = '{' Stmt* '}';
Group = Empty | '(' (Expr | Tuple) ')' ;
Tuple = (Expr ',')* Expr? ;
Loop = "loop" Block ;
While = "while" Expr Block Else ;
If = "if" Expr Block Else ;
For = "for" Identifier "in" Expr Block Else ;