/[svn]/types/patterns.mli
ViewVC logotype

Contents of /types/patterns.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 45 - (show annotations)
Tue Jul 10 17:00:40 2007 UTC (5 years, 10 months ago) by abate
File size: 1566 byte(s)
[r2002-10-26 16:18:24 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-26 16:18:25+00:00
1 type capture = string
2 type fv = capture SortedList.t
3
4 exception IllFormedCup of fv * fv
5 exception IllFormedCap of fv * fv
6
7
8 (* Pattern algebra *)
9
10 type descr
11 type node
12
13 val make: fv -> node
14 val define: node -> descr -> unit
15
16 val constr : Types.node -> descr
17 val cup : descr -> descr -> descr
18 val cap : descr -> descr -> descr
19
20 val times : node -> node -> descr
21 val record : Types.label -> node -> descr
22
23 val capture : capture -> descr
24 val constant: capture -> Types.const -> descr
25
26 val id: node -> int
27 val descr: node -> descr
28 val fv : node -> fv
29
30 (* Pattern matching: static semantics *)
31
32 val accept : node -> Types.node
33 val filter : Types.descr -> node -> (capture,Types.node) SortedMap.t
34
35 (* Pattern matching: compilation *)
36
37 module Compile: sig
38 type normal
39 val normal : descr -> normal
40
41 type dispatcher
42 val dispatcher: Types.descr -> normal array -> dispatcher
43
44 type actions = {
45 basic: (Types.descr * result) list;
46 prod: result dispatch dispatch;
47 record: record option;
48 }
49 and record =
50 [ `Label of Types.label * record dispatch * record option
51 | `Result of result ]
52
53 and 'a dispatch =
54 [ `Dispatch of dispatcher * 'a array
55 | `TailCall of dispatcher
56 | `Ignore of 'a
57 | `None ]
58
59 and result = int * source array
60 and source =
61 [ `Catch | `Const of Types.const
62 | `Left of int | `Right of int | `Recompose of int * int
63 | `Field of Types.label * int
64 ]
65
66 val actions: dispatcher -> actions
67
68 val show : Format.formatter -> Types.descr -> normal array -> unit
69 end

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