Module Pcoq

include Gramlib.Grammar.S with type te = Tok.t and type 'a pattern = 'a Tok.p
type te = Tok.t
type 'a pattern = 'a Tok.p
module Parsable : sig ... end
val tokens : string -> (string option * int) list
module Entry : sig ... end
module rec Symbol : sig ... end
and Rule : sig ... end
and Rules : sig ... end
module Production : sig ... end
type 'a single_extend_statement = string option * Gramlib.Gramext.g_assoc option * 'a Production.t list
type 'a extend_statement = {
pos : Gramlib.Gramext.position option;
data : 'a single_extend_statement list;
}
val generalize_symbol : ('a'tr'c) Symbol.t -> ('aGramlib.Grammar.norec'c) Symbol.t option
val mk_rule : 'a pattern list -> string Rules.t
val level_of_nonterm : ('aGramlib.Grammar.norec'c) Symbol.t -> string option
module Lookahead : sig ... end
val parse_string : 'a Entry.t -> ?⁠loc:Loc.t -> string -> 'a
val eoi_entry : 'a Entry.t -> 'a Entry.t
val map_entry : ('a -> 'b) -> 'a Entry.t -> 'b Entry.t
type gram_universe
val get_univ : string -> gram_universe
val create_universe : string -> gram_universe
val new_entry : gram_universe -> string -> 'a Entry.t
val uprim : gram_universe
val uconstr : gram_universe
val utactic : gram_universe
val create_generic_entry : gram_universe -> string -> ('aGenarg.rlevel) Genarg.abstract_argument_type -> 'a Entry.t
val create_generic_entry2 : string -> ('aGenarg.rlevel) Genarg.abstract_argument_type -> 'a Entry.t
val register_grammar : ('raw'glb'top) Genarg.genarg_type -> 'raw Entry.t -> unit
val genarg_grammar : ('raw'glb'top) Genarg.genarg_type -> 'raw Entry.t
module Prim : sig ... end
module Constr : sig ... end
module Module : sig ... end
Type-safe grammar extension
val epsilon_value : ('a -> 'self) -> ('self_'a) Symbol.t -> 'self option
Extending the parser without synchronization
val grammar_extend : 'a Entry.t -> 'a extend_statement -> unit

Extend the grammar of Coq, without synchronizing it with the backtracking mechanism. This means that grammar extensions defined this way will survive an undo.

Extending the parser with summary-synchronized commands
module GramState : Store.S

Auxiliary state of the grammar. Any added data must be marshallable.

Extension with parsing rules
type 'a grammar_command

Type of synchronized parsing extensions. The 'a type should be marshallable.

type gram_reinit = Gramlib.Gramext.g_assoc * Gramlib.Gramext.position

Type of reinitialization data

type extend_rule =
| ExtendRule : 'a Entry.t * 'a extend_statement -> extend_rule
| ExtendRuleReinit : 'a Entry.t * gram_reinit * 'a extend_statement -> extend_rule
type 'a grammar_extension = 'a -> GramState.t -> extend_rule list * GramState.t

Grammar extension entry point. Given some 'a and a current grammar state, such a function must produce the list of grammar extensions that will be applied in the same order and kept synchronized w.r.t. the summary, together with a new state. It should be pure.

val create_grammar_command : string -> 'a grammar_extension -> 'a grammar_command

Create a new grammar-modifying command with the given name. The extension function is called to generate the rules for a given data.

val extend_grammar_command : 'a grammar_command -> 'a -> unit

Extend the grammar of Coq with the given data.

Extension with parsing entries
type ('a, 'b) entry_command

Type of synchronized entry creation. The 'a type should be marshallable.

type ('a, 'b) entry_extension = 'a -> GramState.t -> string list * GramState.t

Entry extension entry point. Given some 'a and a current grammar state, such a function must produce the list of entry extensions that will be created and kept synchronized w.r.t. the summary, together with a new state. It should be pure.

val create_entry_command : string -> ('a'b) entry_extension -> ('a'b) entry_command

Create a new entry-creating command with the given name. The extension function is called to generate the new entries for a given data.

val extend_entry_command : ('a'b) entry_command -> 'a -> 'b Entry.t list

Create new synchronized entries using the provided data.

val find_custom_entry : ('a'b) entry_command -> string -> 'b Entry.t

Find an entry generated by the synchronized system in the current state.

raises Not_found

if non-existent.

Protection w.r.t. backtrack
val with_grammar_rule_protection : ('a -> 'b) -> 'a -> 'b
type frozen_t
val parser_summary_tag : frozen_t Summary.Dyn.tag
type any_entry =
| AnyEntry : 'a Entry.t -> any_entry
val register_grammars_by_name : string -> any_entry list -> unit
val find_grammars_by_name : string -> any_entry list
val freeze : marshallable:bool -> frozen_t

Parsing state handling

val unfreeze : frozen_t -> unit