update, parser kan expressies op binaire operatoren na, beginnetje gemaakt voor prese...
[cc1516.git] / src / parse.dcl
1 definition module parse
2
3 from Data.Either import :: Either
4 from Data.Maybe import :: Maybe
5
6 import lex
7
8 :: ParserOutput :== Either String AST
9
10 :: AST = AST [VarDecl] [FunDecl]
11 :: VarDecl = VarDecl String Type Expr
12 :: Type
13 = TupleType Type Type
14 | ListType Type
15 | IdType String
16 | IntType
17 | BoolType
18 | CharType
19 | VarType
20
21 :: Expr
22 = VarExpr String (Maybe FieldSelector)
23 | Op2Expr Expr Op2 Expr //TODO, iets met associativiteit wat niet weet hoe
24 | Op1Expr Op1 Expr
25 | IntExpr Int
26 | CharExpr Char
27 | BoolExpr Bool
28 | EmptyListExpr
29 | TupleExpr Expr Expr
30
31 :: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
32 :: Op1 = UnNegation | UnMinus
33 :: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
34 BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
35
36 //TODO
37
38 :: FunDecl = Stub
39
40 parse :: LexerOutput -> ParserOutput