| 1 |
(* Abstract syntax as produced by the parsed *)
|
| 2 |
|
| 3 |
open Location
|
| 4 |
|
| 5 |
type pprog = pmodule_item list
|
| 6 |
|
| 7 |
and pmodule_item = pmodule_item' located
|
| 8 |
and pmodule_item' =
|
| 9 |
| TypeDecl of string * ppat
|
| 10 |
| PatDecl of string * ppat
|
| 11 |
| FunDecl of abstr
|
| 12 |
| LetDecl of ppat * pexpr
|
| 13 |
| EvalStatement of pexpr
|
| 14 |
| Debug of debug_directive
|
| 15 |
and debug_directive =
|
| 16 |
[ `Filter of ppat * ppat
|
| 17 |
| `Accept of ppat
|
| 18 |
| `Compile of ppat * ppat list
|
| 19 |
| `Normal_record of ppat
|
| 20 |
| `Compile2 of ppat * ppat list
|
| 21 |
]
|
| 22 |
|
| 23 |
|
| 24 |
and pexpr = pexpr' located
|
| 25 |
and pexpr' =
|
| 26 |
| Forget of pexpr * ppat
|
| 27 |
(* CDuce is a Lambda-calculus ... *)
|
| 28 |
| Var of string
|
| 29 |
| Apply of pexpr * pexpr
|
| 30 |
| Abstraction of abstr
|
| 31 |
|
| 32 |
(* Data constructors *)
|
| 33 |
| Cst of Types.const
|
| 34 |
| Pair of pexpr * pexpr
|
| 35 |
| Xml of pexpr * pexpr
|
| 36 |
| RecordLitt of (Types.label * pexpr) list
|
| 37 |
|
| 38 |
(* Data destructors *)
|
| 39 |
| Op of string * pexpr list
|
| 40 |
| Match of pexpr * branches
|
| 41 |
| Map of pexpr * branches
|
| 42 |
| Dot of (pexpr* Types.label)
|
| 43 |
|
| 44 |
(* Exceptions *)
|
| 45 |
| Try of pexpr * branches
|
| 46 |
|
| 47 |
and abstr = {
|
| 48 |
fun_name : string option;
|
| 49 |
fun_iface : (ppat * ppat) list;
|
| 50 |
fun_body : branches
|
| 51 |
}
|
| 52 |
|
| 53 |
and branches = (ppat * pexpr) list
|
| 54 |
|
| 55 |
(* A common syntactic class for patterns and types *)
|
| 56 |
|
| 57 |
and ppat = ppat' located
|
| 58 |
and ppat' =
|
| 59 |
| PatVar of string
|
| 60 |
| Recurs of ppat * (string * ppat) list
|
| 61 |
| Internal of Types.descr
|
| 62 |
| Or of ppat * ppat
|
| 63 |
| And of ppat * ppat
|
| 64 |
| Diff of ppat * ppat
|
| 65 |
| Prod of ppat * ppat
|
| 66 |
| XmlT of ppat * ppat
|
| 67 |
| Arrow of ppat * ppat
|
| 68 |
| Record of Types.label * bool * ppat
|
| 69 |
| Capture of Patterns.capture
|
| 70 |
| Constant of Patterns.capture * Types.const
|
| 71 |
| Regexp of regexp * ppat
|
| 72 |
|
| 73 |
and regexp =
|
| 74 |
| Epsilon
|
| 75 |
| Elem of ppat
|
| 76 |
| Seq of regexp * regexp
|
| 77 |
| Alt of regexp * regexp
|
| 78 |
| Star of regexp
|
| 79 |
| WeakStar of regexp
|
| 80 |
| SeqCapture of Patterns.capture * regexp
|
| 81 |
|