This library module provides a recursive descent grammar parser to help analyze and modify a source code file. The goal is that, by organizing the source code based on the grammar of the programming language (as opposed to low-level tokens), complex changes to the code can be more readily made in a programmatic fashion (i.e. by other code using the parser engine).

This library handles PHP grammar, building on the tokenizer functions available in PHP.

Some of the applications for this library module are:

Suggestions for other applications are welcome.

A few things to note:

  • This project is a PHP code library available as a library using the Libraries API (2.x-dev) and also as a Drupal module (because the Drupal project API does not offer a library type).
  • This code library is not specific to a Drupal version. It is more likely specific to a PHP library version. When used as a module, the download below labeled as a 7.x version can be used with any version of Drupal (simply by changing the version string in the info file).
  • If used as a library, then install it in a libraries directory (e.g., "sites/all/libraries" or equivalent) but do not "enable" it as a module.
  • If used as a module, then install it in a modules directory.
  • A user interface is provided by the Grammar Parser UI module.
  • A library interface is provided by the Grammar Parser Library module.

This project was part of the 2009 Google Summer of Code.

This project is sponsored by Boombatower Development.

Looking for 6.x support?
The Grammar Parser library module is not specific to a Drupal version. To run the Grammar Parser as a 6.x module, simply change the '7.x' references in the .info file to '6.x' (e.g., the 'core = 7.x' line becomes 'core = 6.x'). For use with Drush Make, see this issue.

Project information

Releases