comparison vendor/nikic/php-parser/grammar/README.md @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 What do all those files mean?
2 =============================
3
4 * `php5.y`: PHP 5 grammar written in a pseudo language
5 * `php7.y`: PHP 7 grammar written in a pseudo language
6 * `tokens.y`: Tokens definition shared between PHP 5 and PHP 7 grammars
7 * `parser.template`: A `kmyacc` parser prototype file for PHP
8 * `tokens.template`: A `kmyacc` prototype file for the `Tokens` class
9 * `rebuildParsers.php`: Preprocesses the grammar and builds the parser using `kmyacc`
10
11 .phpy pseudo language
12 =====================
13
14 The `.y` file is a normal grammar in `kmyacc` (`yacc`) style, with some transformations
15 applied to it:
16
17 * Nodes are created using the syntax `Name[..., ...]`. This is transformed into
18 `new Name(..., ..., attributes())`
19 * Some function-like constructs are resolved (see `rebuildParsers.php` for a list)
20
21 Building the parser
22 ===================
23
24 In order to rebuild the parser, you need [moriyoshi's fork of kmyacc](https://github.com/moriyoshi/kmyacc-forked).
25 After you compiled/installed it, run the `rebuildParsers.php` script.
26
27 By default only the `Parser.php` is built. If you want to additionally emit debug symbols and create `y.output`, run the
28 script with `--debug`. If you want to retain the preprocessed grammar pass `--keep-tmp-grammar`.