New run function based on rank2 grammars:
[SXSI/xpathcomp.git] / src / grammar2.mli
index 8d84e4e..e2efc85 100644 (file)
@@ -1,4 +1,45 @@
 type t
+
+type node = [ `Start ] Node.t
+
+type n_type = [ `NonTerminal ]
+type t_type = [ `Terminal ]
+type r_type = [ `Rule ]
+type any_type = [ n_type | t_type ]
+type rhs = [ r_type ] Node.t
+
+type n_symbol = n_type Node.t
+type t_symbol = t_type Node.t
+type tn_symbol = [ any_type ] Node.t
+
+
+type partial =
+    Leaf of node
+  | Node0 of tn_symbol
+  | Node1 of tn_symbol * partial
+  | Node2 of tn_symbol * partial * partial
+
+type conf = C0 | C1 | C2 | C3 | C4 | C5 | C6
+
 val parse : string -> t
 val save : t -> string -> unit
 val load : string -> t
+val tag_operations : t -> Tag.operations
+
+val start_tag : t -> node -> tn_symbol
+val is_terminal : t -> [< any_type ] Node.t -> bool
+val is_non_terminal : t -> [< any_type ] Node.t -> bool
+external terminal : [< any_type ] Node.t -> t_symbol = "%identity"
+external non_terminal : [< any_type ] Node.t -> n_symbol = "%identity"
+val nil_symbol : t_symbol
+val tag : t_symbol -> Tag.t
+val start_first_child : t -> node -> node
+val start_next_sibling : t -> node -> node
+val get_rule : t -> n_symbol -> rhs
+val get_conf : rhs ->  conf
+val get_rank : rhs -> int
+val get_id1_rank : rhs -> int
+val get_id2_rank : rhs -> int
+val get_id2_pos : rhs -> int
+val get_id1 : rhs -> tn_symbol
+val get_id2 : rhs -> tn_symbol