Typed AST elements

This commit is contained in:
mrab 2024-05-02 13:56:40 +02:00
parent 8d8bc06034
commit 88604bf544
2 changed files with 4 additions and 1 deletions

View File

@ -12,7 +12,7 @@ executable compiler
default-language: Haskell2010
hs-source-dirs: src
build-tool-depends: alex:alex, happy:happy
other-modules: Parser.Lexer
other-modules: Parser.Lexer, Ast
test-suite tests
type: exitcode-stdio-1.0

View File

@ -15,10 +15,12 @@ data Statement = If Expression Statement (Maybe Statement)
| Block [Statement]
| Return (Maybe Expression)
| StatementExpressionStatement StatementExpression
| TypedStatement DataType Statement
data StatementExpression = Assignment Identifier Expression
| ConstructorCall DataType [Expression]
| MethodCall Identifier [Expression]
| TypedStatementExpression DataType StatementExpression
data BinaryOperator = Addition
| Subtraction
@ -48,4 +50,5 @@ data Expression = IntegerLiteral Int
| BinaryOperation BinaryOperator Expression Expression
| UnaryOperation UnaryOperator Expression
| StatementExpressionExpression StatementExpression
| TypedExpression DataType Expression