News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate's Blog:
Building a simple Parser and Lexer in PHP
November 17, 2011 @ 11:57:59

In a new post to his blog Sameer Borate shows how to create a lexer and parser in PHP to work directly with the tokens of a PHP script.

After looking around for a while [for a good resource on compilers] I settled for Terence Parr's Language Implementation Patterns. This is exactly what I needed - bit sized patterns on compiler and parser design with working code. The book provides a recipe style approach, gradually moving from simple to complex compiler/parser design issues. As I primarily work with PHP, I thought of porting some code to PHP to see how it works.

He shows examples using his custom tool to show a basic lexer output for a list and a complete listing of the code involved. Ultimately, though, he finds that PHP isn't overly suited to the task - anything more than his simple example could be more trouble than it's worth.

0 comments voice your opinion now!
lexer parser tutorial language implement token


blog comments powered by Disqus

Similar Posts

Developer Drive: PHP User Survey: Setting Variable Values and Reading from Tables

System Architect: Integrate PHP application with Solr search engine

PHPMac.com: Building and Installing Apache 2.2.2 and PHP 5.1.3 (or 5.1.4) on Mac OS X 10.4.6

CatsWhoCode.com: How to make a translatable WordPress theme

HowTo Forge: Installing And Working With Xoops Under Ubuntu 6.10


Community Events





Don't see your event here?
Let us know!


laravel framework series release introduction threedevsandamaybe symfony2 community list unittest developer code opinion testing refactor interview language install api podcast

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework