diff options
| author | Baitinq <[email protected]> | 2025-06-06 00:21:08 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-06-06 00:21:08 +0200 |
| commit | 5409e79d4e2917e8daa4d7d218b0cf25686ffe98 (patch) | |
| tree | 192945d3ebc8d75a586c381851012a3ca9f5bf46 /grammar.ebnf | |
| parent | Bootstrap: Codegen: Continue implementation (diff) | |
| download | pry-lang-5409e79d4e2917e8daa4d7d218b0cf25686ffe98.tar.gz pry-lang-5409e79d4e2917e8daa4d7d218b0cf25686ffe98.tar.bz2 pry-lang-5409e79d4e2917e8daa4d7d218b0cf25686ffe98.zip | |
Feature: Support declaring type aliases
Diffstat (limited to 'grammar.ebnf')
| -rw-r--r-- | grammar.ebnf | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/grammar.ebnf b/grammar.ebnf index cecc65e..48667b2 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -34,7 +34,7 @@ UnaryExpression ::= ("!" | "-" | "*") UnaryExpression | PostfixExpression PostfixExpression ::= PrimaryExpression (FieldAccess | FunctionCallStatement | CastStatement | SizeOfStatement)* -PrimaryExpression ::= NULL | NUMBER | BOOLEAN | CHAR | STRING | IDENTIFIER | FunctionDefinition | StructDefinition | StructInstantiation | FieldAccess | LPAREN Expression RPAREN +PrimaryExpression ::= NULL | NUMBER | BOOLEAN | CHAR | STRING | IDENTIFIER | FunctionDefinition | TypeDefinition | StructDefinition | StructInstantiation | FieldAccess | LPAREN Expression RPAREN FunctionDefinition ::= LPAREN FunctionParameters? RPAREN ARROW IDENTIFIER LBRACE Statement* ReturnStatement SEMICOLON RBRACE @@ -46,6 +46,8 @@ FunctionType ::= LPAREN (Type ("," Type)*)? RPAREN ARROW Type ParameterTypes ::= Type ("," Type)* +TypeDefinition ::= "newtype" Type + StructDefinition ::= "struct" LBRACE (StructField ("," StructField)*)? RBRACE StructField ::= IDENTIFIER ":" Type |