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.

License

Notifications You must be signed in to change notification settings

shinobu/lemon-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

--
This Fork is made for use on https://github.com/shinobu/PHP-SparqlParser
It is based on https://github.com/indeyets/lemon-php Fork from https://github.com/wez/lemon-php/
--
(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.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 82.9%
  • Yacc 12.6%
  • PHP 4.5%