conlang: Add constructor expression for structs!
grammar: - Add new rules `PathLike`, `Structor`, `Fielder` - Replace Path with PathLike in Primary expressions cl-ast: - Add nodes for Structor and Fielder cl-parser: - Add branch to path-expression parsing - Parse Structor bodies interpret: - Add TODO
This commit is contained in:
@@ -103,12 +103,15 @@ Call = Index ('(' Tuple? ')')* ;
|
||||
Index = Primary ('[' Indices ']')* ;
|
||||
Indices = (Expr ',')* Expr? ;
|
||||
|
||||
Primary = Literal | Path | Array | ArrayRep | AddrOf
|
||||
| Block | Group | Loop
|
||||
| If | While | For | Break | Return | Continue;
|
||||
Primary = Literal | PathLike | Array | ArrayRep | AddrOf | Block | Group
|
||||
| Loop | If | While | For | Break | Return | Continue;
|
||||
|
||||
Literal = STRING | CHARACTER | FLOAT | INTEGER | Bool ;
|
||||
|
||||
PathLike = Path | Structor ;
|
||||
Structor = Path ':' '{' (Fielder ',')* Fielder? '}' ;
|
||||
Fielder = Identifier ('=' Expr)? ;
|
||||
|
||||
Array = '[' (Expr ',')* Expr? ']' ;
|
||||
ArrayRep = '[' Expr ';' Expr ']' ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user