Module Yacclib


module Yacclib: sig .. end
Parsing and printing ocamlyacc .mly files.


Version


val version : string
Version of the library.

Types


type token_name = string 
type nonterminal_name = string 
type code = string 

type token_declaration = {
   mutable td_type : string option;
   mutable td_names : token_name list;
}
type declaration =
| Dec_token of token_declaration
| Dec_start of nonterminal_name list
| Dec_type of token_declaration
| Dec_left of token_name list
| Dec_right of token_name list
| Dec_nonassoc of token_name list

type symbol =
| Token of token_name
| Nonterminal of nonterminal_name

type rule = {
   mutable r_symbols : symbol list;
   mutable r_prec : token_name option;
   mutable r_action : code;
}
type nonterminal = {
   mutable nt_name : nonterminal_name;
   mutable nt_rules : rule list;
}
type parser = {
   mutable p_header : string;
   mutable p_declarations : declaration list;
   mutable p_nonterms : nonterminal list;
   mutable p_trailer : string;
}

Parsing


exception Parse_error of int * int
val parse_file : string -> parser
val parse_string : string -> parser
val declaration_of_string : string -> declaration
val rule_symbols_of_string : string -> symbol list

Printing


val string_of_header : code -> string
val string_of_declaration : declaration -> string
val string_of_declarations : declaration list -> string
val string_of_symbol : symbol -> token_name
val string_of_rule : rule -> string
val string_of_rules : rule list -> string
val string_of_nonterm : nonterminal -> string
val string_of_nonterms : nonterminal list -> string
val string_of_trailer : 'a -> 'a
val string_of_parser : parser -> string
val print : Pervasives.out_channel -> parser -> unit
val print_file : string -> parser -> unit
val print_dot : Pervasives.out_channel ->
?from:nonterminal_name -> parser -> unit