[Soc 2006] phpAspect

php.internals

William Candillon

20 years ago
Hello everyone, My name is William Candillon. I'm developing the phpAspect project (http://phpaspect.org) for the Google Summer of Code 2006. My mentor is Sebastian Bergmann. Phpaspect is a PHP language extension which implements aspect-oriented programming. The phpaspect compiler weaves aspects implementing crosscutting concerns into PHP source code. The weaving process is static (before source code execution) and based on Lex & Yacc analysis. The woven PHP source code can be executed with any PHP 5 version. This new version that I'm writing for the google soc is written in C and serialize automatically a PHP source code into an XML AST. The aspects files are also serialized from PHP to XML AST. Then I'll apply XSLT style sheet to the representation XML of the aspects in order to generate a final XSLT style sheet which will perform source code transformations on the business logic: http://phpaspect.org/wiki/lib/exe/fetch.php?w=700&h=274&cache=cache&media=weaver2.png Adopting this new approach will result in the following benefits. The lexical and syntax analysis will be independent of any PHP version. Existing XML tools like XSTL or XPath engine could be heavily reused to make the implementation significantly shorter and improve weaving performances. Finally, it will introduce more flexibility in terms of the aspect language. For example, I could use the power of Xpath expression to introduce more logical operators in the aspect syntax. With this architecture, the compatibility with PHP 6 and features like namespaces will be very easy to implement. I am open to any suggestions or comments about this project and the implementing idea. Best regards, William
-- William Candillon Telecom Lille Student E-mail: wcandillon@elv.enic.fr Tel: +33(0) 6 67 99 13 16 CV: http://wcandillon.netcv.org Resume: http://wcandillon.en.netcv.org

Sebastian Bergmann

20 years ago
William Candillon wrote:
> I am open to any suggestions or comments about this project and the > implementing idea.
One idea that I have is to make the PHP->AST and AST->PHP parts usable outside the scope of PHPAspect. This would, for instance, give tool developers and IDE vendors a common base to build on, for instance refactoring tools.
-- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69