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

Contents of /types/patterns.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 225 - (show annotations)
Tue Jul 10 17:16:34 2007 UTC (5 years, 10 months ago) by abate
File size: 1909 byte(s)
[r2003-03-08 15:10:01 by cvscast] Empty log message

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

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