fade981bdeb76b3d8d4d450123dd54490943d6ce
[ghc-base.git] / Text / ParserCombinators / Parsec / examples / while / WhileAS.hs
1 module WhileAS where
2
3 type  VarIdent = String
4 type  Label = Int
5 -- type  Selector = String
6   
7 type Prog = Stat
8 -- type Prog = Prog [Dec] [Stat]
9
10 -- Contains name, a list of input vars, output var, body respectively and of course
11 -- the two labels ln and lx
12 data Dec = Proc [VarIdent] VarIdent VarIdent Label Stat Label
13
14 data AExp 
15   = Var VarIdent 
16   | IntLit Integer
17   | AOp String AExp AExp
18 -- | Var  VarIdent (Maybe Selector)
19 -- | Nil
20   | Dummy
21   deriving (Eq, Show)
22   
23 data BExp 
24   = BUnOp String BExp
25   | BoolLit Bool
26   | BOp String BExp BExp
27   | RelOp String AExp AExp
28 -- | POp VarIdent (Maybe Selector)
29   deriving (Eq, Show)
30
31 data Stat
32   = Assign VarIdent AExp Label
33   | Skip Label
34   | Seq [Stat]
35   | If BExp Label Stat Stat
36   | While BExp Label Stat
37 -- | Call VarIdent [AExp] VarIdent Label Label
38 -- | Malloc VarIdent (Maybe Selector) Label
39   deriving (Show, Eq)