/[svn]/typing/typed.ml
ViewVC logotype

Contents of /typing/typed.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (show annotations)
Tue Jul 10 16:57:19 2007 UTC (5 years, 10 months ago) by abate
File size: 1301 byte(s)
[r2002-10-14 22:05:40 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-14 22:05:40+00:00
1 (* Typed abstract syntax *)
2
3 (* Some sub-expression may have to be type-checked several times.
4 We first build the ``skeleton'' of the typed ast
5 (basically the parsed ast with types and patterns replaced with there
6 internal representation), then type check it.
7
8 The exp_typ and br_typ fields are updated to capture all the possible
9 values than can result from the expression or flow to the branch
10 *)
11
12 open Location
13
14 type tpat = Patterns.node
15 type ttyp = Types.node
16
17 type texpr = { exp_loc : loc;
18 mutable exp_typ : Types.descr;
19 exp_descr : texpr';
20 }
21 and texpr' =
22 (* CDuce is a Lambda-calculus ... *)
23 | Var of string
24 | Apply of texpr * texpr
25 | Abstraction of abstr
26
27 (* Data constructors *)
28 | Cst of Types.const
29 | Pair of texpr * texpr
30 | RecordLitt of (Types.label * texpr) list
31
32 (* Data destructors *)
33 | Op of op * texpr
34 | Match of texpr * branches
35 | Map of texpr * branches
36
37 and abstr = {
38 fun_name : string option;
39 fun_iface : (Types.descr * Types.descr) list;
40 fun_body : branches;
41 fun_typ : Types.descr;
42 fun_fv : string list;
43 }
44
45 and branches = {
46 mutable br_typ : Types.descr;
47 br_branches: branch list
48 }
49 and branch = {
50 mutable br_used : bool;
51 br_pat : tpat;
52 br_body : texpr
53 }
54
55 and op = string
56

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