[antlr-interest] PHP Grammar
Martin Bravenboer
martin.bravenboer at gmail.com
Wed Dec 13 14:56:07 PST 2006
Hi,
> >> is any possibility to get PHP Grammar? (Version 4 or 5, it doesn't
> >> depends on). I have to make php phraser to my subject at university
> >> I'm studying. I need only very small part of the grammar, i have to
> >> create small example project.
> You might find something useful here:
> http://www.phpcompiler.org/index.html
If you just need a grammar, then I would not suggest to use the one
from phpcompiler.org. They use a YACC grammar that is directly based
on the YACC grammar of the PHP distribution, so you can just as well
use the PHP grammar then. One advantage of the PHP compiler front-end
is that they also support XML output, which might be convenient for
connecting the parser to your tools.
There is also a JavaCC grammar for PHP, which might be easier to start
with if you want to develop a grammar for ANTLR (considering that
JavaCC is LL and YACC is LALR). The JavaCC grammar is however not
complete.
See: http://cobase-www.cs.ucla.edu/pub/javacc/
The reason why I am interested in PHP grammars is that we are
developing a PHP grammar for SDF, which is implemented using a
Generalized-LR parser. The grammar is reasonably feature complete (and
has very cool features for parsing string literals), but is not
completely compatible concerning the precedence of operators (it's a
bit more restrictive than standard PHP). The tools based on this can
output XML as well, but I don't want to push it too much on this ANTLR
list ;)
http://www.program-transformation.org/PHP/PhpFront
Cheers,
--
Martin Bravenboer
---------------------------------------------------------------------
Software Engineering Research Group,
Department of Software Technology,
Delft University of Technology.
More information about the antlr-interest
mailing list