annotate vendor/nikic/php-parser/grammar/README.md @ 19:fa3358dc1485 tip

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