some small fixes
[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 :: Expr
18 = VarExpr Pos VarDef
19 | Op2Expr Pos Expr Op2 Expr
20 | Op1Expr Pos Op1 Expr
21 | IntExpr Pos Int
22 | CharExpr Pos Char
23 | BoolExpr Pos Bool
24 | FunExpr Pos FunCall
25 | EmptyListExpr Pos
26 | TupleExpr Pos (Expr, Expr)
27 :: VarDef = VarDef String [FieldSelector]
28 :: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
29 :: Op1 = UnNegation | UnMinus
30 :: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
31 BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
32 :: FunDecl = FunDecl Pos String [String] (Maybe FunType) [VarDecl] [Stmt]
33 :: FunType = FunType [Type] (Maybe Type)
34 :: FunCall = FunCall String [Expr]
35 :: Stmt
36 = IfStmt Expr [Stmt] [Stmt]
37 | WhileStmt Expr [Stmt]
38 | AssStmt VarDef Expr
39 | FunStmt FunCall
40 | ReturnStmt (Maybe Expr)
41
42 instance toString AST