]> ruin.nu Git - proglang.git/blob - Skelsyntax.hs
streamlined the binary operators
[proglang.git] / Skelsyntax.hs
1 module Skelsyntax where
2
3 -- Haskell module generated by the BNF converter
4
5 import Abssyntax
6 import ErrM
7 type Result = Err String
8
9 failure :: Show a => a -> Result
10 failure x = Bad $ "Undefined case: " ++ show x
11
12 transIdent :: Ident -> Result
13 transIdent x = case x of
14   Ident str  -> failure x
15
16
17 transBool :: Bool -> Result
18 transBool x = case x of
19   True  -> failure x
20   False  -> failure x
21
22
23 transStm :: Stm -> Result
24 transStm x = case x of
25   SDecl type' id exp  -> failure x
26   SExp exp  -> failure x
27   SBlock stms  -> failure x
28   SIf exp stm0 stm  -> failure x
29   SWhile exp stm  -> failure x
30   SPrint exp  -> failure x
31   SNoop  -> failure x
32
33
34 transExp :: Exp -> Result
35 transExp x = case x of
36   EAss id exp  -> failure x
37   EVar id  -> failure x
38   EInt n  -> failure x
39   ENeg exp  -> failure x
40   EBool bool  -> failure x
41   EReadI  -> failure x
42   EReadB  -> failure x
43   ExpT type' exp  -> failure x
44   EDefault  -> failure x
45   BiOpExp exp0 op exp  -> failure x
46   EPost id op  -> failure x
47
48
49 transStms :: Stms -> Result
50 transStms x = case x of
51   Program stms  -> failure x
52
53
54 transOp :: Op -> Result
55 transOp x = case x of
56   Lt  -> failure x
57   ELt  -> failure x
58   Gt  -> failure x
59   EGt  -> failure x
60   Eq  -> failure x
61   NEq  -> failure x
62   Plus  -> failure x
63   Minus  -> failure x
64   Times  -> failure x
65   Div  -> failure x
66
67
68 transType :: Type -> Result
69 transType x = case x of
70   TInt  -> failure x
71   TBool  -> failure x
72   NoType  -> failure x
73
74
75