/[svn]/parser/ast.ml
ViewVC logotype

Contents of /parser/ast.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 553 - (show annotations)
Tue Jul 10 17:44:06 2007 UTC (5 years, 10 months ago) by abate
File size: 2580 byte(s)
[r2003-07-02 09:24:27 by cvscast] reinit_ns directive

Original author: cvscast
Date: 2003-07-02 09:24:28+00:00
1 (* Abstract syntax as produced by the parsed *)
2
3 open Location
4 open Ident
5
6 type schema_item_kind = [ `Type | `Element | `Attribute | `Any ]
7
8 type pprog = pmodule_item list
9
10 and pmodule_item = pmodule_item' located
11 and pmodule_item' =
12 | TypeDecl of U.t * ppat
13 | SchemaDecl of string * Schema_types.schema (* name, schema *)
14 | LetDecl of ppat * pexpr
15 | FunDecl of pexpr
16 | Namespace of U.t * Ns.t
17 | EvalStatement of pexpr
18 | Debug of debug_directive
19 | Directive of toplevel_directive
20 and debug_directive =
21 [ `Filter of ppat * ppat
22 | `Sample of ppat
23 | `Accept of ppat
24 | `Compile of ppat * ppat list
25 | `Subtype of ppat * ppat
26 ]
27 and toplevel_directive =
28 [ `Quit
29 | `Env
30 | `Reinit_ns
31 ]
32
33
34 and pconst =
35 | Const_internal of Types.const
36 | Const_atom of U.t
37
38 and pexpr =
39 | LocatedExpr of loc * pexpr
40
41 | Forget of pexpr * ppat
42 | Op of string * pexpr list
43
44 (* CDuce is a Lambda-calculus ... *)
45 | Var of id
46 | Apply of pexpr * pexpr
47 | Abstraction of abstr
48
49 (* Data constructors *)
50 | Cst of pconst
51 | Pair of pexpr * pexpr
52 | Xml of pexpr * pexpr
53 | RecordLitt of (label * pexpr) list
54 | String of U.uindex * U.uindex * U.t * pexpr
55
56 (* Data destructors *)
57 | Match of pexpr * branches
58 | Map of pexpr * branches
59 | Transform of pexpr * branches
60 | Xtrans of pexpr * branches
61 | Validate of pexpr * string * string (* exp, schema name, element name *)
62 | Dot of pexpr * label
63 | RemoveField of pexpr * label
64
65 (* Exceptions *)
66 | Try of pexpr * branches
67
68 (* Other *)
69 | NamespaceIn of U.t * Ns.t * pexpr
70
71 and label = U.t
72
73 and abstr = {
74 fun_name : id option;
75 fun_iface : (ppat * ppat) list;
76 fun_body : branches
77 }
78
79 and branches = (ppat * pexpr) list
80
81 (* A common syntactic class for patterns and types *)
82
83 and ppat = ppat' located
84 and ppat' =
85 | PatVar of U.t
86 | SchemaVar of (* type/pattern schema variable *)
87 schema_item_kind * string * string
88 | AtomT of U.t
89 | NsT of U.t
90 | Recurs of ppat * (U.t * ppat) list
91 | Internal of Types.descr
92 | Or of ppat * ppat
93 | And of ppat * ppat
94 | Diff of ppat * ppat
95 | Prod of ppat * ppat
96 | XmlT of ppat * ppat
97 | Arrow of ppat * ppat
98 | Optional of ppat
99 | Record of bool * (label * ppat) list
100 | Capture of id
101 | Constant of id * pconst
102 | Regexp of regexp * ppat
103 (* regular expression, continuation: [ re ; cont ], e.g: [ re ; nil ] *)
104
105 and regexp =
106 | Epsilon
107 | Elem of ppat
108 | Seq of regexp * regexp
109 | Alt of regexp * regexp
110 | Star of regexp
111 | WeakStar of regexp
112 | SeqCapture of id * regexp
113
114 open Printf

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5