type
[cc1516.git] / src / parse.dcl
index baef545..281c804 100644 (file)
@@ -2,15 +2,16 @@ definition module parse
 
 from Data.Either import :: Either
 from Data.Maybe import :: Maybe
+from StdString import class toString
 
 import lex
 
-:: ParserOutput :== Either String AST
+:: ParserOutput :== Either Error AST
 
 :: AST = AST [VarDecl] [FunDecl]
-:: VarDecl = VarDecl String Type Expr
+:: VarDecl = VarDecl Type String Expr
 :: Type 
-       = TupleType Type Type
+       = TupleType (Type, Type)
        | ListType Type
        | IdType String
        | IntType 
@@ -26,13 +27,13 @@ import lex
        | BoolExpr Bool
        | FunExpr FunCall
        | EmptyListExpr
-       | TupleExpr Expr Expr
+       | TupleExpr (Expr, Expr)
 :: VarDef = VarDef String [FieldSelector]
 :: FieldSelector = FieldHd | FieldTl | FieldFst | FieldSnd
 :: Op1 = UnNegation | UnMinus
 :: Op2 = BiPlus | BiMinus | BiTimes | BiDivide | BiMod | BiEquals | BiLesser |
        BiGreater | BiLesserEq | BiGreaterEq | BiUnEqual | BiAnd | BiOr | BiCons
-:: FunDecl = FunDecl String [String] FunType [VarDecl] [Stmt]
+:: FunDecl = FunDecl String [String] (Maybe FunType) [VarDecl] [Stmt]
 :: FunType = FunType [Type] (Maybe Type)
 :: FunCall = FunCall String [Expr]
 :: Stmt