module Ast where type CompilationUnit = [Class] type DataType = String type Identifier = String data ParameterDeclaration = ParameterDeclaration DataType Identifier deriving (Show) data VariableDeclaration = VariableDeclaration DataType Identifier (Maybe Expression) deriving (Show) data Class = Class DataType [MethodDeclaration] [VariableDeclaration] deriving (Show) data MethodDeclaration = MethodDeclaration DataType Identifier [ParameterDeclaration] Statement deriving (Show) data Statement = If Expression Statement (Maybe Statement) | LocalVariableDeclaration VariableDeclaration | While Expression Statement | Block [Statement] | Return (Maybe Expression) | StatementExpressionStatement StatementExpression | TypedStatement DataType Statement deriving (Show) data StatementExpression = Assignment Identifier Expression | ConstructorCall DataType [Expression] | MethodCall Identifier [Expression] | TypedStatementExpression DataType StatementExpression deriving (Show) data BinaryOperator = Addition | Subtraction | Multiplication | Division | BitwiseAnd | BitwiseOr | BitwiseXor | CompareLessThan | CompareLessOrEqual | CompareGreaterThan | CompareGreaterOrEqual | CompareEqual | CompareNotEqual | And | Or | NameResolution deriving (Show) data UnaryOperator = Not | Minus deriving (Show) data Expression = IntegerLiteral Int | CharacterLiteral Char | BooleanLiteral Bool | NullLiteral | Reference Identifier | BinaryOperation BinaryOperator Expression Expression | UnaryOperation UnaryOperator Expression | StatementExpressionExpression StatementExpression | TypedExpression DataType Expression deriving (Show)