<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 22:23:50 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Wez Furlong's Blog: parser and lexer generators for PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/6771</guid>
      <link>http://www.phpdeveloper.org/news/6771</link>
      <description><![CDATA[<p>
When finding he was in need of a parser and lexer, <i>Wez Furlong</i> decided to work up one that was PHP-based and a take off of the popular <a href="http://www.hwaci.com/sw/lemon/lemon.html">lemon</a> parser and <a href="http://www.cs.princeton.edu/~appel/modern/java/JLex/">JLex</a> lexer.
</p>
<blockquote>
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.
</blockquote>
<p>
<a href="http://netevil.org/node.php?nid=941">His result</a> is two new packages - <a href="http://netevil.org/downloads/lemon-php-151.tgz">lemon-php</a> and <a href="http://netevil.org/downloads/JLexPHP-151.tgz">JLexPHP</a> (under a BSDish license) you can download and compile on your own system.
</p>
<p>
Also, if you'll remember a while back, <i>Greg Beaver</i> had wanted something similar (as <a href="http://netevil.org/node.php?nid=941&SC=1#comments">mentioned in the comments</a>) and <a href="http://www.phpdeveloper.org/news/6181">created his own</a> lexer/generator as well.
</p>]]></description>
      <pubDate>Mon, 27 Nov 2006 09:34:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Greg Beaver's Blog: PHP_ParserGenerator and PHP_LexerGenerator]]></title>
      <guid>http://www.phpdeveloper.org/news/5678</guid>
      <link>http://www.phpdeveloper.org/news/5678</link>
      <description><![CDATA[<p>
<i>Greg Beaver</i> has blogged today with <a href="http://greg.chiaraquartet.net/archives/138-PHP_ParserGenerator-and-PHP_LexerGenerator.html">more about</a> the port he's been wokring on of the Lemon parser generator to PHP5, this time discussion the creation of two packages - PHP_ParserGenerator and PHP_LexerGenerator.
</p>
<blockquote>
<p>
Last week, I blogged about completing a port of the Lemon parser generator to PHP 5, which I thought was pretty cool. However, in an email, Alex Merz pointed out that without a lexer generator to accompany lemon, it's pretty difficult to write a decent parser.
</p>
<p>
After Alex's email, I started thinking about what it would take to write a lexer generator. Basically, a lexer generator requires parsing and compiling regular expressions, then scanning the source one character at a time to find matches. So, it occurred to me that perhaps simply combining regular expressions with sub-patterns could accomplish this task quite easily.
</p>
</blockquote>
<p>
He <a href="http://greg.chiaraquartet.net/archives/138-PHP_ParserGenerator-and-PHP_LexerGenerator.html">goes on</a> to explain this process, showing how a simple regular expresion call (and a look at its return arguments) could create a simple, easy solution. Since the <a href="http://re2c.org">re2c</a> format is still unsupported in PHP (without a goto to go to), he opts to stick with the regular expressions and creates a "lex2php" format instead.
</p>
<p>
He's packaged up both halves of <a href="http://greg.chiaraquartet.net/archives/138-PHP_ParserGenerator-and-PHP_LexerGenerator.html">this setup</a> and has already posted proposals for them to the PEAR site:
<ul>
<li><a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=415">PHP_LexerGenerator</a>
<li><a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=416">PHP_ParserGenerator</a>
</ul>
</p>]]></description>
      <pubDate>Sun, 25 Jun 2006 17:00:41 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Greg Beaver's Blog: A parser generator for PHP - *finally*]]></title>
      <guid>http://www.phpdeveloper.org/news/5610</guid>
      <link>http://www.phpdeveloper.org/news/5610</link>
      <description><![CDATA[<p>
<i>Greg Beaver</i> has a <a href="http://greg.chiaraquartet.net/archives/137-a-parser-generator-for-PHP-finally.html">new post</a> today with mentions of a few things, but mainly the work that he's done to create a parser generator in PHP.
</p>
<blockquote>
<p>
About three weeks ago, I looked at the state of the parser generator world out there for PHP, and it is pretty dismal. Antlr3 will theoretically support PHP 5 generation, but it's impossible to find any source in spite of several fruitless hours of googling.
</p>
<p>
I finally decided that if this is ever going to happen, I'll have to get off my butt and do it. So, two weeks ago, I grabbed the source of the Lemon parser generator from its website
</p>
</blockquote>
<p>
He <a href="http://greg.chiaraquartet.net/archives/137-a-parser-generator-for-PHP-finally.html">follows the path</a> he took, using the code from the Lemon parser, translating it into a PHP version, and correcting a few bugs along the way. 
</p>
<blockquote>
In the process, I have a fully working PGN file parser that will make its way into a PEAR proposal as soon as I get around to integrating it with Games_Chess to do full validation of the contents of the PGN file. However, the parser works 100% even with some of the weirdest PGN things I could throw at it.
</blockquote>
<p>
He <a href="http://greg.chiaraquartet.net/archives/137-a-parser-generator-for-PHP-finally.html">finishes off</a> the post with some example code, including a method for using it on the command line. You can grab the code for the project and related files <a href="http://pear.chiaraquartet.net/lemon">here</a>
</p>
<p>
<i>Sebastian Bergmann</i> also <a href="http://www.sebastian-bergmann.de/blog/archives/607-Greg-Beaver-is-my-Hero.html">comments in his blog</a> about the work <i>Greg</i>'s done.
</p>]]></description>
      <pubDate>Sat, 17 Jun 2006 07:19:38 -0500</pubDate>
    </item>
  </channel>
</rss>
