1 definition module parse
3 from Data.Either import :: Either
4 from Data.Maybe import :: Maybe
8 :: ParserOutput :== Either String AST
10 :: AST = AST [VarDecl] [FunDecl]
11 :: VarDecl = VarDecl Type String Expr
22 | Op2Expr Expr Op2 Expr
30 :: VarDef = VarDef String [FieldSelector]
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 :: FunDecl = FunDecl String [String] FunType [VarDecl] [Stmt]
36 :: FunType = FunType [Type] (Maybe Type)
37 :: FunCall = FunCall String [Expr]
39 = IfStmt Expr [Stmt] [Stmt]
40 | WhileStmt Expr [Stmt]
43 | ReturnStmt (Maybe Expr)
47 parser :: LexerOutput -> ParserOutput