Wez Furlong

Browse archives
Conference Presentations
Subscribe. (circulation 767)
Comments. (circulation 4)

Search powered by Google

I am Wez Furlong, Director of Engineering at Message Systems. My team is responsible for the fastest MTA on Earth.

I'm also a PHP Core developer and OpenSource contributor, residing in Maryland with Juliette, Xander and Lily. (read more)

25th November 2006 @ 04:09 EDT

From time to time, I find that I need to put a parser together. Most of the time I find that I need to do this in C for performance, but other times I just want something convenient, like PHP, and have been out of luck.

This thanksgiving I set out to remedy this and adapted lemon to optionally emit PHP code, and likewise with JLex.

You need a C compiler to build lemon and a java compiler and runtime to build and run JLexPHP, but after having translated your .y and .lex files with these tools, you're left with a pure PHP parser and lexer implementation.

The parser and lexer generators are available under a BSDish license:

lemon-php.tgz JLexPHP-151.tgz

See enclosed README files for more information.

by Wez Furlong in .
Post a comment
25th November 2006 @ 16:38 EDT

Hi Wez,

http://pear.php.net/PHP_ParserGenerator http://pear.php.net/PHP_LexerGenerator

Both have been available since June. PHP_ParserGenerator is a pure PHP port of lemon, and PHP_LexerGenerator is a from-scratch lexer generator which is similar to Marcus's re2c

Would have saved you a lot of trouble if you had googled "php parser generator" first :)

I hope these are useful for you

25th November 2006 @ 17:44 EDT

I had my port of lemon for a couple of years already (since before I moved to the USA), so the only part I was missing was the lexer generator, and that only took me a couple of hours.

I did google and did find your bits; no disrespect to your efforts, but the lexer code in JLex has been around for years. I'm wouldn't be surprised if there are still a few edge cases in your code that were shaken out of JLex a while ago. Again, I'm not calling your code bad, it just seems better to me to invest a couple of hours in porting known good code rather than a couple of days to hit an edge case.

That's just me; I'm not seeking to discourage others, just publishing something that might be useful.

Post a comment