Download the PHP package vanderlee/comprehend without Composer
On this page you can find all versions of the php package vanderlee/comprehend. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package comprehend
Comprehend - a PHP *BNF parser framework
Build object oriented LR(1) lexer, tokenizers and parsers in PHP using BNF-based syntax.
Copyright © 2011-2024 Martijn W. van der Lee Toyls.com, MIT license applies.
Features
- Closely follows BNF syntax using objects as operands.
- Includes various pre-defined RFC syntax rules.
- Whitespace skipping.
- Support for tokenizing.
- Add your own custom parsers.
- Create full sets of rules.
- Optional case (in)sensitivity.
Example
ABNF
word = [A-Za-z]+
list = word *[ ',' word ]
Comprehend, using objects:
$word = new Repeat(new Regex('/[a-z][A-Z]/'), 1);
$list = new Sequence($word, new Repeat(new Sequence(',', $word)));
Comprehend, using objects and array notation:
$word = new Repeat(new Regex('/[a-z][A-Z]/'), 1);
$list = new Sequence($word, new Repeat([',', $word]));
Comprehend, using library functions:
$word = plus(regex('/[a-z][A-Z]/'));
$list = s($word, star([',', $word]));
Comprehend, using Ruleset constructor
$list = new Ruleset([
'word' => plus(regex('/[a-z][A-Z]/')),
Ruleset::ROOT => s($word, star([',', $word])),
]);
All versions of comprehend with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.0.0
The package vanderlee/comprehend contains the following files
Loading the files please wait ....