Hi,

On 04/09/12 21:57, Nikita Popov wrote:
Hey folks!

Some people asked me what the advantages of using an AST-based
parsing/compilation process are, so I put together a few quick notes
in an RFC:

https://wiki.php.net/rfc/ast_based_parsing_compilation_process

It would be nice to get a few comments from other core devs on this.
From my personal point of view, I see more advantages than inconvenients of using an AST.

It is a more consistent and clever way to manipulate a language. We can have more optimizations processes, algorithms and heuristics. We have already spoken about consistency in the PHP syntax, but it will also be easier for contributors to suggest new patches in regards to the syntax and syntactic-sugar. An AST will also facilitate opcode caching (even a trivial approach at first would be promising I think), and again, it will egg on contributors to propose new patches for that. Moreover, there are a lot of well-known algorithms and heuristics in the literature to compensate for memory overhead. I think about lazy-compilation to avoid the build of the whole AST. Even if the first feeling is that AST appears to bring some issues at first, it could be very quickly a benefit for PHP, in terms of consistency in the code, performance and memory usage.

Conversely, it requires a lot of work. I can help if needed.

Cheers.

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to