From fe47528e65e4690a5600154978515cc29133e5da Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sun, 23 Mar 2025 01:21:49 +0100 Subject: Parser: Fix ambiguity with symbol declaration --- grammar.ebnf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'grammar.ebnf') diff --git a/grammar.ebnf b/grammar.ebnf index 562f2f8..cbc3f0a 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -1,8 +1,10 @@ Program ::= Statement+ -Statement ::= (AssignmentStatement | FunctionCallStatement | IfStatement | WhileStatement | ReturnStatement) SEMICOLON +Statement ::= (AssignmentStatement | ExternDeclaration | FunctionCallStatement | IfStatement | WhileStatement | ReturnStatement) SEMICOLON -AssignmentStatement ::= "let" IDENTIFIER EQUALS (Type | Expression) +AssignmentStatement ::= "let"? IDENTIFIER EQUALS Expression + +ExternDeclaration ::= "extern" IDENTIFIER EQUALS Type FunctionCallStatement ::= (IDENTIFIER | FunctionDefinition) LPAREN FunctionArguments? RPAREN -- cgit 1.4.1