-- File generated by the BNF Converter. -- Templates for pattern matching on abstract syntax {-# LANGUAGE GADTs #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} module SkelCpp where import Prelude (($), Either(..), String, (++), Show, show) import qualified AbsCpp type Err = Either String type Result = Err String failure :: Show a => a -> Result failure x = Left $ "Undefined case: " ++ show x transTree :: AbsCpp.Tree c -> Result transTree t = case t of AbsCpp.PDefs defs -> failure t AbsCpp.DFun type_ id args stms -> failure t AbsCpp.ADecl type_ id -> failure t AbsCpp.SBlock stms -> failure t AbsCpp.SDecls type_ ids -> failure t AbsCpp.SExp exp -> failure t AbsCpp.SIfElse exp stm1 stm2 -> failure t AbsCpp.SInit type_ id exp -> failure t AbsCpp.SReturn exp -> failure t AbsCpp.SReturnVoid -> failure t AbsCpp.SWhile exp stm -> failure t AbsCpp.EAnd exp1 exp2 -> failure t AbsCpp.EApp id exps -> failure t AbsCpp.EAss exp1 exp2 -> failure t AbsCpp.EDecr exp -> failure t AbsCpp.EDiv exp1 exp2 -> failure t AbsCpp.EDouble d -> failure t AbsCpp.EEq exp1 exp2 -> failure t AbsCpp.EFalse -> failure t AbsCpp.EGt exp1 exp2 -> failure t AbsCpp.EGtEq exp1 exp2 -> failure t AbsCpp.EId id -> failure t AbsCpp.EIncr exp -> failure t AbsCpp.EInt n -> failure t AbsCpp.ELt exp1 exp2 -> failure t AbsCpp.ELtEq exp1 exp2 -> failure t AbsCpp.EMinus exp1 exp2 -> failure t AbsCpp.ENEq exp1 exp2 -> failure t AbsCpp.EOr exp1 exp2 -> failure t AbsCpp.EPDecr exp -> failure t AbsCpp.EPIncr exp -> failure t AbsCpp.EPlus exp1 exp2 -> failure t AbsCpp.EString str -> failure t AbsCpp.ETimes exp1 exp2 -> failure t AbsCpp.ETrue -> failure t AbsCpp.ETyped exp type_ -> failure t AbsCpp.Type_bool -> failure t AbsCpp.Type_double -> failure t AbsCpp.Type_int -> failure t AbsCpp.Type_string -> failure t AbsCpp.Type_void -> failure t transId :: AbsCpp.Id -> Result transId x = case x of AbsCpp.Id string -> failure x transProgram :: AbsCpp.Program -> Result transProgram x = case x of AbsCpp.PDefs defs -> failure x transDef :: AbsCpp.Def -> Result transDef x = case x of AbsCpp.DFun type_ id args stms -> failure x transArg :: AbsCpp.Arg -> Result transArg x = case x of AbsCpp.ADecl type_ id -> failure x transStm :: AbsCpp.Stm -> Result transStm x = case x of AbsCpp.SBlock stms -> failure x AbsCpp.SDecls type_ ids -> failure x AbsCpp.SExp exp -> failure x AbsCpp.SIfElse exp stm1 stm2 -> failure x AbsCpp.SInit type_ id exp -> failure x AbsCpp.SReturn exp -> failure x AbsCpp.SReturnVoid -> failure x AbsCpp.SWhile exp stm -> failure x transExp :: AbsCpp.Exp -> Result transExp x = case x of AbsCpp.EAnd exp1 exp2 -> failure x AbsCpp.EApp id exps -> failure x AbsCpp.EAss exp1 exp2 -> failure x AbsCpp.EDecr exp -> failure x AbsCpp.EDiv exp1 exp2 -> failure x AbsCpp.EDouble d -> failure x AbsCpp.EEq exp1 exp2 -> failure x AbsCpp.EFalse -> failure x AbsCpp.EGt exp1 exp2 -> failure x AbsCpp.EGtEq exp1 exp2 -> failure x AbsCpp.EId id -> failure x AbsCpp.EIncr exp -> failure x AbsCpp.EInt n -> failure x AbsCpp.ELt exp1 exp2 -> failure x AbsCpp.ELtEq exp1 exp2 -> failure x AbsCpp.EMinus exp1 exp2 -> failure x AbsCpp.ENEq exp1 exp2 -> failure x AbsCpp.EOr exp1 exp2 -> failure x AbsCpp.EPDecr exp -> failure x AbsCpp.EPIncr exp -> failure x AbsCpp.EPlus exp1 exp2 -> failure x AbsCpp.EString str -> failure x AbsCpp.ETimes exp1 exp2 -> failure x AbsCpp.ETrue -> failure x AbsCpp.ETyped exp type_ -> failure x transType :: AbsCpp.Type -> Result transType x = case x of AbsCpp.Type_bool -> failure x AbsCpp.Type_double -> failure x AbsCpp.Type_int -> failure x AbsCpp.Type_string -> failure x AbsCpp.Type_void -> failure x