1 definition module parse
3 from Data.Either import :: Either
4 from Data.Maybe import :: Maybe
5 from StdString import class toString
9 :: ParserOutput :== Either Error AST
11 :: AST = AST [VarDecl] [FunDecl]
12 :: VarDecl = VarDecl Type String Expr
14 = TupleType (Type, Type)
23 | Op2Expr Expr Op2 Expr
30 | TupleExpr (Expr, Expr)
31 :: VarDef = VarDef String [FieldSelector]
32 :: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
33 :: Op1 = UnNegation | UnMinus
34 :: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
35 BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
36 :: FunDecl = FunDecl String [String] (Maybe FunType) [VarDecl] [Stmt]
37 :: FunType = FunType [Type] (Maybe Type)
38 :: FunCall = FunCall String [Expr]
40 = IfStmt Expr [Stmt] [Stmt]
41 | WhileStmt Expr [Stmt]
44 | ReturnStmt (Maybe Expr)
48 parser :: LexerOutput -> ParserOutput