IIUC, PPX rewriters must be registered at the very beginning of the compilation process.
Does this mean that such rewriters can not depend on an module that would be defined by the program itself, typically by a functor ?
For example, suppose i have a module
Expr parameterized by a signature
CONST, decriving the litteral constants that can occur in such expressions:
module type CONST = sig ... end module type EXPR = sig ... end module Make(C: CONST) : EXPR
and, instead of writing expression values as (for ex):
let e1 = EBinop ("+", EConst 1, EConst 2)
i would like to denote with in concrete syntax using a dedicated parser, called by a PPX rewriter:
let e1 = [%expr "1+2"]
It seems that i cannot write such a rewritter (in
expr_ppx.ml) because the actual definition of the parser is not known when registering this rewriter : it is sth like
MyConst, the actual type of constants, in only known by the program.
Am i right or is there a way to “defer” the registration of PPX rewritters such that can have some modules defined by the target program in scope ?
I suspect that the answer in no, but would appreciate any confirmation…