X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=Skelsyntax.hs;h=bc9bc0cd636ac74859db584ea12a06693837fbec;hp=8a3605383704b6bf4c3a36e6e4936be53876cfec;hb=565fbd61dca527c23888e08783d0d91cee458524;hpb=93b042040034d199c925248a2dd1c321773ab6d0 diff --git a/Skelsyntax.hs b/Skelsyntax.hs index 8a36053..bc9bc0c 100644 --- a/Skelsyntax.hs +++ b/Skelsyntax.hs @@ -20,61 +20,54 @@ transBool x = case x of False -> failure x +transType :: Type -> Result +transType x = case x of + TInt -> failure x + TBool -> failure x + + +transStms :: Stms -> Result +transStms x = case x of + Program stms -> failure x + + transStm :: Stm -> Result transStm x = case x of - SDecl type' id exp -> failure x SExp exp -> failure x SBlock stms -> failure x - SIf exp stm0 stm -> failure x SWhile exp stm -> failure x + SIf exp stm0 stm -> failure x SPrint exp -> failure x SNoop -> failure x + SDecl type' id exp -> failure x transExp :: Exp -> Result transExp x = case x of EAss id exp -> failure x - BExp exp0 bop exp -> failure x EVar id -> failure x EInt n -> failure x - ENeg exp -> failure x EBool bool -> failure x + ENeg exp -> failure x + ENot exp -> failure x EReadI -> failure x EReadB -> failure x - ExpT type' exp -> failure x - EDefault -> failure x - OpExp exp0 op exp -> failure x + BiOpExp exp0 op exp -> failure x EPost id op -> failure x -transStms :: Stms -> Result -transStms x = case x of - Program stms -> failure x - - -transBOp :: BOp -> Result -transBOp x = case x of +transOp :: Op -> Result +transOp x = case x of Lt -> failure x ELt -> failure x Gt -> failure x EGt -> failure x Eq -> failure x NEq -> failure x - - -transOp :: Op -> Result -transOp x = case x of Plus -> failure x Minus -> failure x Times -> failure x Div -> failure x -transType :: Type -> Result -transType x = case x of - TInt -> failure x - TBool -> failure x - NoType -> failure x - -