about summary refs log tree commit diff
path: root/grammar.ebnf
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-02-16 23:24:31 +0100
committerBaitinq <[email protected]>2025-02-16 23:24:31 +0100
commiteb985bc9399d0bc7761273ce933d2f3cf219d320 (patch)
tree6df81a66a7ac61e4c5b4216b33594fe40c4c91c6 /grammar.ebnf
parentCodegen: support bool type (diff)
downloadpry-lang-eb985bc9399d0bc7761273ce933d2f3cf219d320.tar.gz
pry-lang-eb985bc9399d0bc7761273ce933d2f3cf219d320.tar.bz2
pry-lang-eb985bc9399d0bc7761273ce933d2f3cf219d320.zip
Parser: Add proper support for type parsing
Diffstat (limited to 'grammar.ebnf')
-rw-r--r--grammar.ebnf8
1 files changed, 7 insertions, 1 deletions
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)*