News Feed
Sections




News Archive
feed this:

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

Sherif Ramadan:
How to Write an Operator Precedence Parser in PHP
January 21, 2013 @ 11:21:22

Sherif Ramadan has a post looking at creating a better operator precedence parser in PHP. His example is a fully PHP implementation that takes equation strings and evaluates them to create the result.

Operator precedence parsers are very simple on the surface. So don't feel in the least bit intimidated, because by the time you've read through this I hope to have you walk away with a solid foundation on how to write your very own operator precedence parser. The goal is to understand how to solve the problem of operator precedence parsing, and not necessarily to write your own parser. Learning how the problem can be solved is the most important thing to take away from this article.

He starts with an introduction to the concepts behind "operator precedence" including processing order and grouping. He also mentions infix and postfix (RPN) notations for handling different formats of equations. He used the "Shunting-yard Algorithm" and how it relates to handling the different parts of the equation, one at a time, in the correct order. He rest of the post is dedicated to the details of the execution in the tool, including code examples and the tokenization of the strings passed into it.

0 comments voice your opinion now!
operator precedence parser string token shuntingyard algorithm


Ibuildings Blog:
DPCRadio Let's Build a Parser
October 24, 2012 @ 10:19:18

On the Ibuildings blog today they've released the latest episode of their DPC Radio podcast series as recorded at this year's Dutch PHP Conference (2012). In this new episode, they share Boy Baukema's session "Let's Build a Parser".

During this talk an introduction will be given to parsing. Terms like 'formal grammar', 'lexing / scanning', 'LL / LALR / PEG' will be explained and put into context. We will look at a recursive descent parsing as a practical way to parse languages. Finally the audience will be left with ways to get started with parsing structured text into memory.

You can listen to this latest episode either through the in-page player or by downloading the mp3. You can also see the slides from the presentation on Slideshare.

0 comments voice your opinion now!
dpcradio podcast dpc12 parser boybaukema tutorial


Joshua Thijssen's Blog:
Using vagrant and puppet to setup your symfony2 environment
June 29, 2012 @ 11:04:41

In his most recent post Joshua Theijssen shows you how to set up a complete Symfony2 environment, automated with the help of Puppet and Vagrant.

Together with other tools, setting up a complete development environment with just a single command is not only reality, but it's becoming for a lot of developers a daily practice. But even for open source projects like joind.in and protalk.me are seeing the benefits of having "development environment on the fly". New contributors don't have to spend a lot of time setting up their environment, but it's automatically generated: the code setup, the database server together with a filled set of data, any additional components like varnish, memcache, reddis etc. This blog post gives an overview on how to setup a symfony2 project with the help of vagrant and puppet.

He provides you with some examples in the form of a Vagrantfile that sets up a 64 bit CentOS instance and configures the server with a few settings and points it to a Puppet configuration. He includes a basic set of Puppet configuration examples and shows how to use it to install various packages, set up MySQL, load phpMyAdmin, configure PHP and, finally, bootstrap the Symfony2 by seeding a Doctrine schema.

0 comments voice your opinion now!
vagrant puppet tutorial configure setup symfony2 vagrantfile pp


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


Erik's Blog:
PHP implementation of an LALR1 parser generator
January 19, 2010 @ 13:03:57

Erik has posted about a new parser he's created, one based on the LALR parser method, that can be downloaded here [zip].

Parser tables, along with a lexer table, are the core constituents of any compiler's front end. This LALR parser generator is heavily based on my custom Php version of the map/reduce programming technique (functional programming). I will elaborate in future posts, on why I used a map/reduce basis to implement the parser generator.

Parsers organize a set of tokens based on the rules of a formal language the parser is given. Several of the grammar text files are included in the download so you can test it out for yourself. For more on the topic check out these two posts.

0 comments voice your opinion now!
lalr1 parser generator grammar


Erling Alf Ellingsen's Blog:
PHP Must Die
January 11, 2010 @ 13:49:41

In a (slightly inflammatory) post to his blog today Erling Alf Ellingsen shares why he thinks that "PHP must die", mostly due to some of the inconsistencies his has with other languages.

His examples include:

  • String vs. numeric handling
  • That PHP supports octal numbers "by accident"
  • A lexer bug with hex values
  • A parser bug involving the ternary operator

Comments on the post include those supporting the "die" opinion - that PHP just doesn't have it together like other languages - and those taking a bit more balanced approach on PHP's strengths and weaknesses.

1 comment voice your opinion now!
opinion lexer parser octal ternary


Phil Sturgeon's Blog:
Give CodeIgniter's Parser library more kick with Dwoo
November 24, 2009 @ 08:39:18

Phil Sturgeon has a new post to his blog talking about a way to give your CodeIgniter site a bit more "pep" - use his updated implementation of the Dwoo templating engine.

Not wanting to spend too much time re-inventing the wheel I had a look at existing templating engines and decided to use Dwoo. [...] So after a little head-scratching, we now have CodeIgniter-Dwoo. DwooParser? DwooIgniter? Whatever we call it, my new Dwoo implementation for CodeIgniter sits in with "the CodeIgniter way" perfectly and the only code you will need to change within your application is the Parser file and your view files. No changes to your controllers at all!

You can download the library from the code section of his site.

1 comment voice your opinion now!
codeigniter parser library dwoo framework


PHPImpact Blog:
PHP Simple HTML DOM Parser (jQuery Style)
August 08, 2008 @ 12:03:55

On the PHP::Impact blog today Federico points out a few HTML DOM parsers that work similar to jQuery:

Check out a previous tutorial of his for more information on using DOM parsers to scrape information from remote sites.

2 comments voice your opinion now!
dom parser simple html jquery zendomquery phpquery


Skaldrom's Blog:
Want to create your own progranning language? Lexer & Parser in PHP!
November 02, 2007 @ 11:12:00

Skaldrom passed along a link to an article he's written up to show how to use one of the more powerful PEAR packages in a simple "Hello World" kind of script - the PHP_LexerGenerator and PHP_ParserGenerator packages.

Who doesn't dream about it: Your own programming language, because the syntax and the word are expression! A step continue to go to ascend and from the programming language user to the language creator! This is now possible in PHP, but unfortunately only with minimum documentation.

He provides an example of the Lexer/Generator in action - handling a simple mathematical operation. The execution code is first with the Lexer definition file and the code for the parser following. Lastly, he has included the code to make things work - passing the test string into his custom Lexer which is passed off to the Parser and a value returned.

0 comments voice your opinion now!
lexter parser pear package generator example lexter parser pear package generator example


David Coallier's Blog:
SVN log-per-user parser using SimpleXML
March 27, 2007 @ 08:33:00

David Coallier has a quick hit post today on his blog. In it, he shows how, with a little bit of SimpleXML magic, to parse the log files from your Subversion installation.

Yesterday I was struggling trying to get svn log to display the results for a certain user and this was very annoying.. then I jumped on #svn on freenode, and someone mentionned svn log --xml

This apparently made my life much much easier with this simple script I have pulled in a couple minutes.

He includes the script and a brief set of instructions on how to use it in your installation.

0 comments voice your opinion now!
subversion parser log file peruser simplexxml repository subversion parser log file peruser simplexxml repository



Community Events





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


language zendserver interview series release update community tips symfony package deployment laravel api podcast install library introduction framework list opinion

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