WOOPWOOP expressies typen, behalve func
[cc1516.git] / AST.dcl
1 definition module AST
2
3 from Data.Maybe import :: Maybe
4 from StdOverloaded import class toString
5
6 :: Pos = {line :: Int, col :: Int}
7 :: AST = AST [VarDecl] [FunDecl]
8 :: VarDecl = VarDecl Pos Type String Expr
9 :: Type
10 = TupleType (Type, Type)
11 | ListType Type
12 | IdType String
13 | IntType
14 | BoolType
15 | CharType
16 | VarType
17 | VoidType
18 | (->>) infixl 7 Type Type
19 :: Expr
20 = VarExpr Pos VarDef
21 | Op2Expr Pos Expr Op2 Expr
22 | Op1Expr Pos Op1 Expr
23 | IntExpr Pos Int
24 | CharExpr Pos Char
25 | BoolExpr Pos Bool
26 | FunExpr Pos FunCall
27 | EmptyListExpr Pos
28 | TupleExpr Pos (Expr, Expr)
29 :: VarDef = VarDef String [FieldSelector]
30 :: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
31 :: Op1 = UnNegation | UnMinus
32 :: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
33 BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
34 :: FunDecl = FunDecl Pos String [String] (Maybe Type) [VarDecl] [Stmt]
35 :: FunCall = FunCall String [Expr]
36 :: Stmt
37 = IfStmt Expr [Stmt] [Stmt]
38 | WhileStmt Expr [Stmt]
39 | AssStmt VarDef Expr
40 | FunStmt FunCall
41 | ReturnStmt (Maybe Expr)
42
43 instance toString AST
44 instance toString Type
45 instance toString Pos
46 instance toString FieldSelector