Parsing library based on Earley Algorithm


module S : Spec


val reserve : string -> unit

reserve s reserves the word s as if it was a keyword, although it will not be defined as one. The exception Invalid_argument is raised if the word s is already reserved.

val mem : string -> bool

mem s tests whether s is a reserved word or not.

val check : string -> unit

check s calls Earley.give_up () if s is a reserved word. It can be used to reject keywords while parsing identifiers for example.

val create : string -> unit Earley.grammar

create s reserves the keyword s and returns a parser accepting the string s, not followed by a character of S.id_charset. In the case where s is already reserved, Invalid_argument is raised.

val special : string -> unit Earley.grammar

special s accpets the same input as create s, but the word s is not reserved.