Name Date Size #Lines LOC

..06-Dec-2024-

README.mdH A D30-Aug-20221.2 KiB2820

parser.templateH A D21-Feb-20242.4 KiB11089

php.yH A D08-Oct-202458.5 KiB1,4281,229

phpyLang.phpH A D21-Feb-20245.2 KiB172121

rebuildParsers.phpH A D29-Aug-20222.2 KiB8155

README.md

1What do all those files mean?
2=============================
3
4 * `php.y`:              PHP 5-8 grammar written in a pseudo language
5 * `parser.template`:    A `kmyacc` parser prototype file for PHP
6 * `rebuildParsers.php`: Preprocesses the grammar and builds the parser using `kmyacc`
7
8.phpy pseudo language
9=====================
10
11The `.y` file is a normal grammar in `kmyacc` (`yacc`) style, with some transformations
12applied to it:
13
14 * Nodes are created using the syntax `Name[..., ...]`. This is transformed into
15   `new Name(..., ..., attributes())`
16 * Some function-like constructs are resolved (see `rebuildParsers.php` for a list)
17
18Building the parser
19===================
20
21Run `php grammar/rebuildParsers.php` to rebuild the parsers. Additional options:
22
23 * The `KMYACC` environment variable can be used to specify an alternative `kmyacc` binary.
24   By default the `phpyacc` dev dependency will be used. To use the original `kmyacc`, you
25   need to compile [moriyoshi's fork](https://github.com/moriyoshi/kmyacc-forked).
26 * The `--debug` option enables emission of debug symbols and creates the `y.output` file.
27 * The `--keep-tmp-grammar` option preserves the preprocessed grammar file.
28