News Feed
Sections




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

Jani Hartikainen:
Parsing and evaluating PHP in Haskell Part 2
January 23, 2013 @ 11:24:34

Jani Hartikainen has posted the second article in his series looking at parsing PHP with Haskell (part one is here). In this new article he builds on the parser he built last time and gets to the actual evaluation of the PHP code.

Last week I wrote a post about a PHP parser / evaluator I wrote in Haskell. I explained some of the parts on how the parser itself was designed to process PHP code into an abstract source tree. Continuing from where we left off in the previous part, in this post I'll discuss the actual evaluation part.

He starts by introducing the structure of the evaluator script, how it's broken up into functionality based on the type of object/data type being handled. He uses a "custom monad transformer stack" to handle the environment for the evaluation as is progresses. He talks about handling statements and expressions, declaring custom functions and the actual execution of the function call. There's also a mention of handling conditionals/looping as well as dealing with PHP's type juggling.

if you're interested in seeing the final result (and maybe trying it out for yourself) you can find the full source on Github.

0 comments voice your opinion now!
haskell parse evaluate monad transformer functions expressions looping typejuggling


blog comments powered by Disqus

Similar Posts

DevShed: Tracking Parsing Errors with the Tidy Library in PHP 5

Spindrop.us Blog: Easy Yahoo! Maps and GeoRSS with symfony

SitePoint PHP Blog: Living Dangerously with PHP and UTF-8

PHP-Tools Blog: Analyzing aide (advanced intrusion detection environment) output with PHP

Fabien Potencier's Blog: Parsing XML documents with CSS selectors


Community Events





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


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

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