X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fgrammar.mli;h=5d5e8abe676e4f1a1279a67bb11c6a79cf4157b4;hb=0578813dc7114276daf382d47661f027c973eb35;hp=29fc43c84d71df777f0e545d1b8a6d0d3d5cdcf6;hpb=6df6ad6cf27e57872bd5891b49354acb0a5ce6a4;p=SXSI%2Fxpathcomp.git diff --git a/src/grammar.mli b/src/grammar.mli index 29fc43c..5d5e8ab 100644 --- a/src/grammar.mli +++ b/src/grammar.mli @@ -1,4 +1,43 @@ type t + type node = [ `Grammar ] Node.t +type p_type = [ `Parameter ] +type n_type = [ `NonTerminal ] +type t_type = [ `Terminal ] +type any_type = [ p_type | n_type | t_type ] +type symbol = [ any_type ] Node.t + +type p_symbol = p_type Node.t +type n_symbol = n_type Node.t +type t_symbol = t_type Node.t +type tn_symbol = [ n_type | t_type ] Node.t + +type partial = Node of tn_symbol * partial array | Leaf of node + + + + +val is_terminal : [< any_type ] Node.t -> bool +val is_non_terminal : [< any_type ] Node.t -> bool +val is_parameter : [< any_type ] Node.t -> bool + +external get_symbol_at : t -> symbol -> node -> symbol = "caml_grammar_get_symbol_at" +external first_child : t -> symbol -> node -> node = "caml_grammar_first_child" +external next_sibling : t -> symbol -> node -> node = "caml_grammar_next_sibling" +external parameter : [< any_type ] Node.t -> p_symbol = "%identity" +external terminal : [< any_type ] Node.t -> t_symbol = "%identity" +external non_terminal : [< any_type ] Node.t -> n_symbol = "%identity" +external get_id1 : t -> n_symbol -> tn_symbol = "caml_grammar_get_id1" +external get_id2 : t -> n_symbol -> tn_symbol = "caml_grammar_get_id2" +external get_param_pos : t -> n_symbol -> int = "caml_grammar_get_param_pos" +val num_params : n_symbol -> int +val num_children : [< t_type | n_type ] Node.t -> int +external is_nil : t -> t_symbol -> bool = "caml_grammar_is_nil" + +val tag : t_symbol -> Tag.t +val tag_operations : t -> Tag.operations + + + val load : string -> bool -> t