You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.4 KiB

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