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