package rocq-runtime
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=a45280ab4fbaac7540b136a6b073b4a6db15739ec1e149bded43fa6f4fc25f20
doc/rocq-runtime.interp/PrimNotations/index.html
Module PrimNotationsSource
The unique id string below will be used to refer to a particular registered interpreter/uninterpreter of number or string notation. Using the same uid for different (un)interpreters will fail. If at most one interpretation of prim token is used per scope, then the scope name could be used as unique id.
val register_rawnumeral_interpretation :
?allow_overwrite:bool ->
string ->
rawnum prim_token_interpretation ->
prim_token_uidval register_bignumeral_interpretation :
?allow_overwrite:bool ->
string ->
Z.t prim_token_interpretation ->
prim_token_uidval register_string_interpretation :
?allow_overwrite:bool ->
string ->
string prim_token_interpretation ->
prim_token_uid* Number notation
exception PrimTokenNotationError of string
* Environ.env
* Evd.evar_map
* prim_token_notation_errortype int_ty = {dec_uint : Names.inductive;dec_int : Names.inductive;hex_uint : Names.inductive;hex_int : Names.inductive;uint : Names.inductive;int : Names.inductive;
}type number_ty = {int : int_ty;decimal : Names.inductive;hexadecimal : Names.inductive;number : Names.inductive;
}type to_post_arg = | ToPostCopy| ToPostAs of int| ToPostHole of Names.Id.t| ToPostCheck of Constr.t
A postprocessing translation to_post can be done after execution of the to_ty interpreter. The reverse translation is performed before the of_ty uninterpreter.
to_post is an array of n lists l_i of tuples (f, t, args). When the head symbol of the translated term matches one of the f in the list l_0 it is replaced by t and its arguments are translated acording to args where ToPostCopy means that the argument is kept unchanged and ToPostAs k means that the argument is recursively translated according to l_k. ToPostHole introduces an additional implicit argument hole (in the reverse translation, the corresponding argument is removed). ToPostCheck r behaves as ToPostCopy except in the reverse translation which fails if the copied term is not r. When n is null, no translation is performed.
type ('target, 'warning) prim_token_notation_obj = {to_kind : 'target conversion_kind;to_ty : Names.GlobRef.t;to_post : (Names.GlobRef.t * Names.GlobRef.t * to_post_arg list) list array;of_kind : 'target conversion_kind;of_ty : Names.GlobRef.t;ty_name : Libnames.qualid;warning : 'warning;
}type prim_token_interp_info = | Uid of prim_token_uid| NumberNotation of number_notation_obj| StringNotation of string_notation_obj
val do_interp :
?loc:Loc.t ->
prim_token_interp_info ->
Constrexpr.prim_token ->
Glob_term.glob_constrval do_uninterp :
print_float:bool ->
prim_token_interp_info ->
_ Glob_term.glob_constr_g ->
Constrexpr.prim_token option