| 1 |
abate |
107 |
exception Error of string
|
| 2 |
abate |
225 |
open Ident
|
| 3 |
abate |
1 |
|
| 4 |
|
|
(* Pattern algebra *)
|
| 5 |
|
|
|
| 6 |
|
|
type descr
|
| 7 |
|
|
type node
|
| 8 |
abate |
694 |
module Node: Custom.T with type t = node
|
| 9 |
abate |
1 |
|
| 10 |
|
|
val make: fv -> node
|
| 11 |
|
|
val define: node -> descr -> unit
|
| 12 |
|
|
|
| 13 |
abate |
653 |
val constr : Types.t -> descr
|
| 14 |
abate |
1 |
val cup : descr -> descr -> descr
|
| 15 |
abate |
121 |
val cap : descr -> descr -> descr
|
| 16 |
abate |
1 |
|
| 17 |
|
|
val times : node -> node -> descr
|
| 18 |
abate |
110 |
val xml : node -> node -> descr
|
| 19 |
abate |
233 |
val record : label -> node -> descr
|
| 20 |
abate |
1 |
|
| 21 |
abate |
225 |
val capture : id -> descr
|
| 22 |
|
|
val constant: id -> Types.const -> descr
|
| 23 |
abate |
1 |
|
| 24 |
|
|
val id: node -> int
|
| 25 |
|
|
val descr: node -> descr
|
| 26 |
|
|
val fv : node -> fv
|
| 27 |
|
|
|
| 28 |
abate |
1350 |
(* Pretty-printing *)
|
| 29 |
|
|
|
| 30 |
|
|
module Print : sig
|
| 31 |
|
|
val print: Format.formatter -> descr -> unit
|
| 32 |
|
|
end
|
| 33 |
|
|
|
| 34 |
abate |
1 |
(* Pattern matching: static semantics *)
|
| 35 |
|
|
|
| 36 |
abate |
653 |
val accept : node -> Types.Node.t
|
| 37 |
|
|
val filter : Types.t -> node -> (id * Types.Node.t) list
|
| 38 |
abate |
1 |
|
| 39 |
abate |
145 |
|
| 40 |
abate |
1 |
(* Pattern matching: compilation *)
|
| 41 |
|
|
|
| 42 |
abate |
43 |
module Compile: sig
|
| 43 |
|
|
type dispatcher
|
| 44 |
abate |
45 |
|
| 45 |
abate |
56 |
type actions =
|
| 46 |
abate |
172 |
| AIgnore of result
|
| 47 |
|
|
| AKind of actions_kind
|
| 48 |
abate |
56 |
and actions_kind = {
|
| 49 |
abate |
653 |
basic: (Types.t * result) list;
|
| 50 |
abate |
243 |
atoms: result Atoms.map;
|
| 51 |
|
|
chars: result Chars.map;
|
| 52 |
abate |
45 |
prod: result dispatch dispatch;
|
| 53 |
abate |
110 |
xml: result dispatch dispatch;
|
| 54 |
abate |
45 |
record: record option;
|
| 55 |
|
|
}
|
| 56 |
abate |
229 |
and record =
|
| 57 |
abate |
233 |
| RecLabel of label * result dispatch dispatch
|
| 58 |
abate |
230 |
| RecNolabel of result option * result option
|
| 59 |
abate |
45 |
and 'a dispatch =
|
| 60 |
abate |
172 |
| Dispatch of dispatcher * 'a array
|
| 61 |
|
|
| TailCall of dispatcher
|
| 62 |
|
|
| Ignore of 'a
|
| 63 |
|
|
| Impossible
|
| 64 |
abate |
45 |
|
| 65 |
|
|
and result = int * source array
|
| 66 |
|
|
and source =
|
| 67 |
abate |
172 |
| Catch | Const of Types.const
|
| 68 |
|
|
| Left of int | Right of int | Recompose of int * int
|
| 69 |
abate |
45 |
|
| 70 |
|
|
val actions: dispatcher -> actions
|
| 71 |
|
|
|
| 72 |
abate |
698 |
type 'a rhs = Match of (id * int) list * 'a | Fail
|
| 73 |
|
|
(* ids are listed in the same order as returned by fv_list,
|
| 74 |
|
|
not fv ! *)
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
abate |
694 |
val make_branches : Types.t -> (node * 'a) list -> dispatcher * 'a rhs array
|
| 78 |
abate |
149 |
|
| 79 |
abate |
229 |
val print_dispatcher: Format.formatter -> dispatcher -> unit
|
| 80 |
|
|
|
| 81 |
abate |
653 |
val debug_compile : Format.formatter -> Types.Node.t -> node list -> unit
|
| 82 |
abate |
1 |
end
|
| 83 |
abate |
1352 |
|
| 84 |
|
|
|
| 85 |
|
|
val approx :
|
| 86 |
|
|
descr ->
|
| 87 |
|
|
Types.descr ->
|
| 88 |
abate |
1354 |
id list * (id * Types.Const.t) list
|
| 89 |
abate |
1355 |
|
| 90 |
|
|
val demo: Format.formatter -> descr -> Types.descr -> unit
|
| 91 |
abate |
1358 |
val demo_compile: Format.formatter -> Types.descr -> descr list -> unit
|