Login   Register  
PHP Classes

Pragmatic BNF-a-like parser: Parse language source with a BNF grammar syntax

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2011-10-26 (3 years ago) RSS 2.0 feedNot enough user ratingsTotal: 478 This week: 1All time: 5,425 This week: 1,547Up
Version License PHP version Categories  
pragmatic-parser 0.3GNU General Public Lice...5.3PHP 5, Text processing, Parsers
Description Author  

This package can parse source code in a given language based on the language syntax defined in the BNF format (Backus-Naur Form).

It takes a grammar with syntax rules defined in BNF format and parses the syntax to build a XML parse tree.

The main class also takes as parameter a reference to a lexer object that splits the source code text in tokens.

A SQL parser and a RTF parser are provided as examples.

Innovation Award  
PHP Programming Innovation award nominee
October 2011
Number 4

Prize: One book of choice by Packt
BNF (Backus-Naur Form) defines a syntax for representing the grammar of the commands of a given programming language.

This implements a parser to process a language grammar in the BNF format, so it can be used to implement parsers and compilers for that language.

Manuel Lemos
Picture of Richard Keizer
Name: Richard Keizer <contact>
Classes: 7 packages by
Country: The Netherlands The Netherlands
Age: 39
All time rank: 48313 in The Netherlands The Netherlands
Week rank: 254 Up9 in The Netherlands The Netherlands Up
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

  Files folder image Files  
File Role Description
Files folder imageRTF (3 files)
Files folder imageSQL (2 files)
Accessible without login Plain text file example_rtf.php Example usage example
Accessible without login Plain text file example_sql.php Example usage example
Accessible without login Plain text file howto_grammar.txt Doc. grammar basics explained
Accessible without login Plain text file howto_lexer.txt Doc. lexer basics explained
Plain text file parser.class.php Class main class(es)

  Files folder image Files  /  RTF  
File Role Description
  Accessible without login Plain text file rtf.grammar.txt Data simplified rtf grammar
  Plain text file RTFLexer.class.php Class rtf lexer
  Accessible without login Plain text file simple.rtf Data rtf file

  Files folder image Files  /  SQL  
File Role Description
  Accessible without login Plain text file sql.grammar.txt Data sql grammar
  Plain text file SQLLexer.class.php Class sql lexer

 Version Control Unique User Downloads Download Rankings  
 100%Total:478All time:5,425
 This week:1This week:1,547Up
 User Comments (1)  
more docs/examples please!
3 years ago (Colin McKinnon)