Closed huanghantao closed 4 years ago
The documentation only says to install antlr-php-runtime
, but it doesn't say how do we get antlr4 to use antlr-php-runtime
?
I don't know -Dlanguage=PHP
how does it find antlr-php-runtime
?
Hi @huanghantao!
When generating the parser/lexer, you need to specify what the target language passing -Dlanguage=PHP
. The ANTLR tool will then generate the code in the target language you've specified.
To be able to parse files using your just generated parser, you will need the antlr-php-runtime
. The recommended installation method is through the package manager Composer, as described in the docs. Just write a new composer file, add this library as a dependency, and you should be ready to try your new parser.
I have installed antlr4 according to the inside of the https://github.com/antlr/antlr4/blob/master/doc/getting-started.md document.
And my antlr version:
os:
macOS 10.15.2