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

Contents of /typing/typed.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations)
Tue Jul 10 16:57:55 2007 UTC (5 years, 11 months ago) by abate
File size: 1333 byte(s)
[r2002-10-17 12:30:01 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-17 12:30:46+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 | UnaryOp of Op.unary * texpr
34 | BinaryOp of Op.binary * texpr * texpr
35 | Match of texpr * branches
36 | Map of texpr * branches
37
38 and abstr = {
39 fun_name : string option;
40 fun_iface : (Types.descr * Types.descr) list;
41 fun_body : branches;
42 fun_typ : Types.descr;
43 fun_fv : string list;
44 }
45
46 and branches = {
47 mutable br_typ : Types.descr;
48 br_branches: branch list
49 }
50 and branch = {
51 mutable br_used : bool;
52 br_pat : tpat;
53 br_body : texpr
54 }
55

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