From a213c7f70a97347e78d931082942076e575a0ed0 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 11 Apr 2024 19:59:00 -0500 Subject: [PATCH] grammar: Minor cleanup, fix compat with Grammatical parser --- grammar.ebnf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/grammar.ebnf b/grammar.ebnf index 9cbaf97..9bafe59 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -51,7 +51,8 @@ Ty = Never | Empty | Path | TyTuple | TyRef | TyFn ; Never = '!' ; Empty = '(' ')' ; TyTuple = '(' (Ty ',')* Ty? ')' ; -TyRef = ('&' | '&&')* Path ; +TyRef = Amps* Path ; +Amps = '&' | '&&' ; TyFn = "fn" TyTuple ('->' Ty)? ; @@ -73,13 +74,13 @@ Let = "let" Mutability Identifier (':' Ty)? ('=' Expr)? ; Bool = "true" | "false" ; -/* expr */ +(* expr *) Expr = Assign ; Assign = Path (AssignKind Assign ) | Compare ; -Binary = Compare | Range | Logic | Bitwise | Shift | Factor | Term ; +(* Binary = Compare | Range | Logic | Bitwise | Shift | Factor | Term ; *) Compare = Range (CompareOp Range )* ; Range = Logic (RangeOp Logic )* ; Logic = Bitwise (LogicOp Bitwise)* ; @@ -106,13 +107,12 @@ Literal = STRING | CHARACTER | FLOAT | INTEGER | Bool ; Array = '[' (Expr ',')* Expr? ']' ; ArrayRep = '[' Expr ';' Expr ']' ; -AddrOf = ('&' | '&&')* Mutability Expr ; +AddrOf = Amps Amps* Mutability Expr ; Block = '{' Stmt* '}'; -Group = '(' (Empty | Expr | Tuple) ')' ; +Group = Empty | '(' (Expr | Tuple) ')' ; Tuple = (Expr ',')* Expr? ; -Empty = ; While = "while" Expr Block Else ; If = "if" Expr Block Else ;