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

Contents of /types/patterns.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 107 - (show annotations)
Tue Jul 10 17:06:47 2007 UTC (5 years, 10 months ago) by abate
File size: 1747 byte(s)
[r2002-11-10 16:13:31 by cvscast] Empty log message

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

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