From eb985bc9399d0bc7761273ce933d2f3cf219d320 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sun, 16 Feb 2025 23:24:31 +0100 Subject: Parser: Add proper support for type parsing --- grammar.ebnf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'grammar.ebnf') diff --git a/grammar.ebnf b/grammar.ebnf index a169199..ed87d7f 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -28,4 +28,10 @@ PrimaryExpression ::= NUMBER | BOOLEAN | IDENTIFIER | FunctionCallStatement | Fu FunctionDefinition ::= LPAREN FunctionParameters? RPAREN ARROW IDENTIFIER LBRACE Statement* ReturnStatement SEMICOLON RBRACE -FunctionParameters ::= IDENTIFIER ":" IDENTIFIER ("," IDENTIFIER ":" IDENTIFIER)* +FunctionParameters ::= IDENTIFIER ":" Type ("," IDENTIFIER ":" Type)* + +Type ::= IDENTIFIER | FunctionType + +FunctionType ::= LPAREN (Type ("," Type)*)? RPAREN ARROW Type + +ParameterTypes ::= Type ("," Type)* -- cgit 1.4.1