-- File generated by the BNF Converter. -- Templates for pattern matching on abstract syntax {-# 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 transId :: AbsCpp.Id -> Result transId x = case x of AbsCpp.Id string -> failure x transProgram :: Show a => AbsCpp.Program' a -> Result transProgram x = case x of AbsCpp.PDefs _ defs -> failure x transDef :: Show a => AbsCpp.Def' a -> Result transDef x = case x of AbsCpp.DFun _ type_ id args stms -> failure x transArg :: Show a => AbsCpp.Arg' a -> Result transArg x = case x of AbsCpp.ADecl _ type_ id -> failure x transStm :: Show a => AbsCpp.Stm' a -> 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 :: Show a => AbsCpp.Exp' a -> 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 :: Show a => AbsCpp.Type' a -> 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