Skip to content
A PHP parser generator, based on the lemon parser generator tool. lemon-php requires a C compiler to build, and this will generate pure-PHP parsers.
C PHP
Pull request Compare This branch is 8 commits ahead, 1 commit behind wez:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
COPYING
README
c.y
lemon.c
lempar.c
lempar.php
objc.y

README

(for licensing and copyright information, see COPYING)

This is an adaptation of lemon that optionally emits PHP code to implement a
parser for the grammar described in a .y file.

Usage:

 cc -o lemon lemon.c
 lemon -LPHP my.y

This will output my.php, which contains a PHP class that implements your parser.
Usage is along the lines of:

$P = new ParseParser();
$S = new Yylex(); // you can get one of these using the JLexPHP package

while ($t = $S->yylex()) {
	$P->Parse($t->type, $t);
}
$P->Parse(0);


You can find out more about the lemon syntax from:
http://www.hwaci.com/sw/lemon/lemon.html


Enjoy!

--Wez.

Something went wrong with that request. Please try again.