Zend Compiler

An example of how to add a syntactic feature to PHP (for updating lexing, adding to PHP’s context free grammar, and adding a new opcode) is https://phpinternals.net/articles/implementing_a_range_operator_into_php.

A good introduction to the internals of the Zend virtual machine is https://nikic.github.io/2017/04/14/PHP-7-Virtual-machine.html. This describes the output of the compiler, as well as the way the executor(virtual machine) works.