| 1 |
abate |
4 |
(* Typed abstract syntax *)
|
| 2 |
|
|
|
| 3 |
|
|
open Location
|
| 4 |
|
|
|
| 5 |
|
|
type tpat = Patterns.node
|
| 6 |
|
|
type ttyp = Types.node
|
| 7 |
|
|
|
| 8 |
|
|
type texpr = { loc : Location.loc; mutable typ : Types.descr; descr : texpr' }
|
| 9 |
|
|
and texpr' =
|
| 10 |
|
|
|
| 11 |
|
|
(* CDuce is a Lambda-calculus ... *)
|
| 12 |
|
|
| Var of string
|
| 13 |
|
|
| Apply of texpr * texpr
|
| 14 |
|
|
| Abstraction of abstr
|
| 15 |
|
|
|
| 16 |
|
|
(* Data constructors *)
|
| 17 |
|
|
| Cst of Types.const
|
| 18 |
|
|
| Pair of texpr * texpr
|
| 19 |
|
|
| RecordLitt of (Types.label * texpr) list
|
| 20 |
|
|
|
| 21 |
|
|
(* Data destructors *)
|
| 22 |
|
|
| Op of op * texpr
|
| 23 |
|
|
| Match of texpr * branches
|
| 24 |
|
|
| Map of texpr * branches
|
| 25 |
|
|
|
| 26 |
|
|
and abstr = {
|
| 27 |
|
|
fun_name : string option;
|
| 28 |
|
|
fun_iface : (tpat * tpat) list;
|
| 29 |
|
|
fun_body : branches
|
| 30 |
|
|
}
|
| 31 |
|
|
|
| 32 |
|
|
and branches = branch list
|
| 33 |
|
|
and branch = { used : bool; mutable typ : Types.descr; body : texpr }
|
| 34 |
|
|
|
| 35 |
|
|
and op = string
|
| 36 |
|
|
|