about summary refs log tree commit diff
path: root/grammar.ebnf
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-06-06 00:21:08 +0200
committerBaitinq <[email protected]>2025-06-06 00:21:08 +0200
commit5409e79d4e2917e8daa4d7d218b0cf25686ffe98 (patch)
tree192945d3ebc8d75a586c381851012a3ca9f5bf46 /grammar.ebnf
parentBootstrap: Codegen: Continue implementation (diff)
downloadinterpreter-5409e79d4e2917e8daa4d7d218b0cf25686ffe98.tar.gz
interpreter-5409e79d4e2917e8daa4d7d218b0cf25686ffe98.tar.bz2
interpreter-5409e79d4e2917e8daa4d7d218b0cf25686ffe98.zip
Feature: Support declaring type aliases
Diffstat (limited to 'grammar.ebnf')
-rw-r--r--grammar.ebnf4
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