Re: [RFC][Discussion] Parser extension API
| From: | Alexander Lisachenko | Date: | Tue, 17 Feb 2015 12:16:17 +0000 |
| Subject: | Re: [RFC][Discussion] Parser extension API | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82949@lists.php.net to get a copy of this message | ||
2015-02-17 15:06 GMT+03:00 Leigh <leight@gmail.com>:
> Does the AST provided by the internal parser provide all of the
> information required to be able to turn it back into source code?
>
> Yes, this should be possible, via zend_emit_op*() and zend_compile*()
2015-02-17 15:06 GMT+03:00 Leigh <leight@gmail.com>:
> Re: Extending the parser from PHP userland.
>
> This I don't like so much.
>
> To be honest I hoped this would be an API to extend the parser from
> PHP extensions :) I think letting userland fiddle directly with the
> compilation process is just asking for trouble.
>
Expected reaction ) However, it would be nice to have such API on userland
too (on engine level this can be a hook too). This will give an instrument
for building custom things on user side, but will keep PHP engine clear
from a lot of stuff, which can be implemented by users. Nice example is
Design-By-Contract validation, it can be easily done via parser hooks.