ushalow
[clean-tests.git] / old / expr / exist / while.dcl
1 definition module while
2
3 :: Then = Then
4 :: Else = Else
5 :: Do = Do
6 :: WhileExpr
7 = (=.) infix 1 String WhileInt
8 | If WhileBool Then WhileExpr Else WhileExpr
9 | (:.) infixr 0 WhileExpr WhileExpr
10 | While WhileBool Do WhileExpr
11 | Skip
12 | E.e: WExpr e & eval e & print e
13
14 :: WhileBool
15 = Bool Bool
16 | (==.) infix 4 WhileInt WhileInt
17 | (&.) infix 3 WhileBool WhileBool
18 | Not WhileBool
19 | E.e: WBool e & evalb e & print e
20
21 :: WhileInt
22 = Int Int
23 | Var String
24 | (+.) infixl 6 WhileInt WhileInt
25 | E.e: WInt e & evali e & print e
26
27 class gamma g
28 where
29 put :: g String Int -> g
30 get :: g String -> Int
31 instance gamma Gamma
32
33 :: Gamma
34 emptyGamma :: Gamma
35
36 class eval m :: m -> (g -> g) | gamma g
37 class evali m :: m -> (g -> Int) | gamma g
38 class evalb m :: m -> (g -> Bool) | gamma g
39
40 instance eval WhileExpr
41 instance evali WhileInt
42 instance evalb WhileBool
43
44 class print m :: m -> String
45
46 instance print WhileExpr
47 instance print WhileInt
48 instance print WhileBool