Description
I want to suggest to include this extension into the core to provide an API for miscellaneous userland extensions. Main idea is to give a userland code control over the produced source-code.
Chain is following: Source Code => Tokenizer => AST => Engine hooks+PHP userland hooks => Compiler => Opcodes => Execution
Why it can be a great thing: native source-code AST (static analyzers, code beautifiers), language extensions (AOP, DbC, SQL-like native syntax).
This requires to create an userland-function, probably, register_parser_extension(ParserExtensionInterface $extension)
that will add an extension as parser hook.
Next additional thing is ParserExtensionInterface
interface with process(Node $node)
method that will receive ast\Node
class and should return a modified node or tree.
Each registered extension will be called consequently, allowing to transform the source code. Last result will be used by compiler to generate final version of opcodes.