initial
[prop.git] / app / setl-pe / setl-ast.ph
blobb6bbe8045dcf59e42b733b8304c51e8671005ff1
1 #ifndef SETL_abstract_syntax_h
2 #define SETL_abstract_syntax_h
4 #include "foundation.ph"
6 datatype Exp :: collectable 
7    =  IDexp     (Id) 
8    |  LITexp    (Literal)
9    |  APPexp    (Exp, Exp)
10    |  TUPLEexp  (Exps)
11    |  RECORDexp (LabeledExps)
12    |  SETexp    (Exps)
13    |  CASEexp   (Exp, Exps)
14    |  IFexp     (Exp, Exp, Exp)
15    |  WHILEexp  (Exp, Exp)
16    |  SEQexp    (Exps)
17    |  LETexp    (Decls, Exp)
18    |  PRIMexp   (Prim)
20 and Prim :: collectable
21    =  "+"    | "-"    | "*"   | "/"   | ":="
22    |  "="    | "<"    | ">"   | ">="  | "<="
23    |  "/="   | "#"    | "arb" | "div" | "mod"
24    |  "with" | "less"
26 and Decl :: collectable
27    =  TYPEdecl     (Id, Ids, Ty)
28    |  DATATYPEdecl (Id, Ids, Terms)
30 and Term :: collectable = TERM (Id, Ty)
32 and Ty :: collectable =
33       NOty
34    |  VARty   (Ty)
36 and LabeledExp :: collectable = LABELEDexp{ id : Id, exp : Exp }
38 and Literal :: collectable 
39    =  INTlit    (int)
40    |  REALlit   (double)
41    |  STRINGlit (const char *)
42    |  CHARlit   (char)
44 where type Ids         = List<Id>
45        and Literals    = List<Literal>
46        and Exps        = List<Exp>
47        and LabeledExps = List<LabeledExp>
48        and Decls       = List<Decl>
49        and Terms       = List<Term>
50        and Tys         = List<Ty>
53 #endif