Hey Kornel,

First of all I want to tell you that the idea is really great!

But I'm wondering if it wasn't better to adopt something like
https://github.com/nikic/PHP-Parser for this.

I don't think it's PHPTal's job to optimize the AST, and since there's
already an AST lib out there that has gained a lot of interest (I think
it's used also by the latest wonders of https://github.com/ircmaxell/PHPPHP).

Optimizers will come for sure since I'm wondering if I can use PHP-Parser
also in doctrine/common :P

Marco Pivetta



On 8 January 2013 23:43, Kornel Lesiński <kor...@geekhood.net> wrote:

> A while ago I thought about creating PHP *optimizer*. The goal is to make
> PHPTAL-generated code as efficient as hand-written code, e.g. merge
> adjacent strings and echo statements (implemented) and avoid pushState()
> calls or maintenance of repeat/xx/key variables when those features are not
> used (not implemented yet).
> To achieve this I've refactored PHPTAL's code generator to create sort-of
> Abstract Syntax Tree/intermediate representation mix. Generated code uses
> classes such as PHPTAL_Expr_Echo and PHPTAL_Expr_If, and these can be
> inspected, modified, optimized, etc.
> I've released work-in-progress code:
> https://github.com/pornel/**PHPTAL/tree/AST<https://github.com/pornel/PHPTAL/tree/AST>
> Is anybody in the mood for writing an optimizing PHP compiler? :)
> --
> regards, Kornel
> ______________________________**_________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/**mailman/listinfo/phptal<http://lists.motion-twin.com/mailman/listinfo/phptal>
PHPTAL mailing list

Reply via email to