diff --git a/src/main/antlr4/de/hsrm/compiler/Klang/Klang.g4 b/src/main/antlr4/de/hsrm/compiler/Klang/Klang.g4 index e8021af..f349b26 100644 --- a/src/main/antlr4/de/hsrm/compiler/Klang/Klang.g4 +++ b/src/main/antlr4/de/hsrm/compiler/Klang/Klang.g4 @@ -5,7 +5,15 @@ parse ; program - : functionDef* expression SCOL + : (functionDef | structDef)* expression SCOL + ; + +structDef + : STRUCT structName=IDENT OBRK structField+ CBRK + ; + +structField + : IDENT type_annotation SCOL ; functionDef @@ -99,6 +107,7 @@ type : INTEGER | BOOLEAN | FLOAT + | IDENT ; functionCall @@ -127,6 +136,7 @@ PRINT: 'print'; IF: 'if'; ELSE: 'else'; FUNC: 'function'; +STRUCT: 'struct'; RETURN: 'return'; LET: 'let'; WHILE: 'while';