Skip to content
bschmalhofer edited this page Sep 13, 2010 · 9 revisions

There is no formal specification of PHP. So the C-implementation serves as the reference.
This implementation is published under the “PHP License”<http://en.wikipedia.org/wiki/PHP_License>.
Parts of PHP 5, inluding the grammar zend_language_parser.y and zend_language_scanner.l, are licensed under the Zend license 2.0.
Both licenses are BSD-like.

The latest release. PHP 5.3, uses re2c for lexing and parsing.

PHP source code is parsed with lex and yacc. The grammars are derived from the Zend grammars,
but are much more accessible. PHP is translated to an abstract syntax tree.

A grammar in tea format is used to generate C++ classes, that can be used
to process the syntax tree.
“maketea”<http://www.maketea.org/> is the tool used for generating the C++ code.
Interestingly maketea uses or is based on Haskell. Output of the AST as XML is possible.
Licensed under BSD license.

A PHP runtime in IBM Websphere Smash is making a good show.

PHP for Mono. Lexer is C#Flex, Parser is C#Cup.
Supposedly the grammar has been written from scratch. Published under the GPL.

PHP for .Net. Published under the Microsoft Shared Source Permissive License.

Java parser compiling PHP down to Java code. Licensed under GPL.

Compile down to native code. Implemented in Bigloo Scheme and C.
Bigloo Scheme is used as an intermediate language.
Published under the GPL. Independent from Zend.

A new implementation “rphp”<http://code.roadsend.com/pcc/browser/trunk/rphp> is under development.

Implement the PHP builtin functions in JavaScript, for using them on webpages.

Parser with JFLex and ANTLR 2. The README says: Copyright Jörn Horstmann.

An earlier attempt on PHP on Parrot. ‘Pharrot’ was the initial name of ‘Pint’.

Implementation on top of .Net. Incomplete.

Implementation on top on .Net. Stalled.

Another interesting project that tries to create a PHP backend for ANTLR.

Parsing PHP with ANTLR.