PHPAspect and parse_tree

Sebastian Bergmann » 03 October 2006 » in PHP » 0 Comments

Over the summer I had the honour of participating in the Google Summer of Code as a mentor, on behalf of the PHP Project, for William Candillon.

The project that William undertook was to "[write] a new version of PHPAspect [...] in C and using XSLT to perform source code transformation".

One of the results of William's work that I am particularly happy with is the fact that he developed the parse_tree extension as part of his work. This extension gives PHP developers access to the parse tree of PHP source code. This way this essential part of his PHPAspect project is reusable for other purposes.

To learn more about PHPAspect you can refer to William's slides from his recent presentation at L'École Polytechnique Fédérale de Lausanne.

For a first use case of the parse_tree extensions outside the context of PHPAspect look at William's work on visualizing PHP parse trees.
Defined tags for this entry: , , , , , , , ,

Greg Beaver is my Hero

Sebastian Bergmann » 17 June 2006 » in PHP » 2 Comments

Greg Beaver has ported the LEMON Parser Generator to PHP.

This finally gives the PHP Community an LALR(1) parser generator that takes a context free grammar and converts it into a PHP subroutine that will parse a file using that grammar.

Greg's work brings one of my dreams closer to reality: a framework that reads PHP sourcecode into an abstract syntax tree, allows transformations of that tree from within PHP code, and serializes the abstract syntax tree back to PHP sourcecode.

Update: Greg now did the same for a lexer generator (using a syntax similar to re2c).

Static Analysis of PHP Code

Sebastian Bergmann » 09 June 2006 » in PHP » 5 Comments

There seems to be a sudden interest in PHP in the academic world. At least with regard to using static code analysis to automatically detect security vulnerabilities in PHP applications.

I started to collect links to scientific papers that deal with PHP here.

Update: I tried to use Pixy today. Unfortunately, Pixy is not very usable at the moment as it can only work on a single PHP sourcefile. It does, however, generate nice visualizations of PHP parse trees.



The parse tree above was generated for the PHP sourcefile below:
<?php
class Foo {
    function bar() {
        print 23 + 24;
    }
}
?>
Defined tags for this entry: , , ,