(* Abstract syntax as produced by the parser *) open Location open Ident type pprog = pmodule_item list and pmodule_item = pmodule_item' located and pmodule_item' = | TypeDecl of id * ppat | SchemaDecl of U.t * string (* name, uri *) | LetDecl of ppat * pexpr | FunDecl of pexpr | Namespace of U.t * Ns.t | Using of U.t * U.t | EvalStatement of pexpr | Directive of toplevel_directive and debug_directive = [ `Filter of ppat * ppat | `Sample of ppat | `Accept of ppat | `Compile of ppat * ppat list | `Subtype of ppat * ppat | `Explain of ppat * ppat * pexpr | `Single of ppat | `Approx of ppat * ppat ] and toplevel_directive = [ `Quit | `Env | `Reinit_ns | `Help | `Dump of pexpr | `Print_schema of U.t | `Print_schema_type of Schema_types.component_kind * U.t * U.t | `Print_type of U.t | `Debug of debug_directive | `Verbose | `Silent ] and pexpr = | LocatedExpr of loc * pexpr (* CDuce is a Lambda-calculus ... *) | Var of U.t | Apply of pexpr * pexpr | Abstraction of abstr (* Data constructors *) | Const of Types.Const.t | Integer of Intervals.V.t | Char of Chars.V.t | Pair of pexpr * pexpr | Atom of U.t | Xml of pexpr * pexpr | RecordLitt of (label * pexpr) list | String of U.uindex * U.uindex * U.t * pexpr (* Data destructors *) | Match of pexpr * branches | Map of pexpr * branches | Transform of pexpr * branches | Xtrans of pexpr * branches | Validate of pexpr * Schema_types.component_kind * U.t * U.t (* exp, schema component kind, schema name, element name *) | Dot of pexpr * label | RemoveField of pexpr * label (* Exceptions *) | Try of pexpr * branches (* Other *) | NamespaceIn of U.t * Ns.t * pexpr | Forget of pexpr * ppat | Check of pexpr * ppat (* | Op of string * pexpr list *) | Ref of pexpr * ppat | External of string * ppat list and label = U.t and abstr = { fun_name : id option; fun_iface : (ppat * ppat) list; fun_body : branches } and branches = (ppat * pexpr) list (* A common syntactic class for patterns and types *) and ppat = ppat' located and ppat' = | PatVar of U.t | SchemaVar of (* type/pattern schema variable *) Schema_types.component_kind * U.t * U.t (* kind, schema, name *) | Cst of pexpr | NsT of U.t | Recurs of ppat * (id * ppat) list | Internal of Types.descr | Or of ppat * ppat | And of ppat * ppat | Diff of ppat * ppat | Prod of ppat * ppat | XmlT of ppat * ppat | Arrow of ppat * ppat | Optional of ppat | Record of bool * (label * (ppat * ppat option)) list | Constant of id * pexpr | Regexp of regexp and regexp = | Epsilon | Elem of ppat | Guard of ppat | Seq of regexp * regexp | Alt of regexp * regexp | Star of regexp | WeakStar of regexp | SeqCapture of id * regexp let pat_true = mknoloc (Internal Builtin_defs.true_type) let pat_false = mknoloc (Internal Builtin_defs.false_type) let cst_true = Const (Types.Atom Builtin_defs.true_atom) let cst_false = Const (Types.Atom Builtin_defs.false_atom) let cst_nil = Const Sequence.nil_cst let pat_nil = mknoloc (Internal (Sequence.nil_type))