antlr / antlr-php-runtime

PHP Runtime for ANTLR4
BSD 3-Clause "New" or "Revised" License
81 stars 19 forks source link

Is it really needed ANTLR? #9

Closed acuna-public closed 3 years ago

acuna-public commented 3 years ago

Seems I've missed something, but is it really need an ANTLR installed for it if it's an PHP runtime which can be loaded independently with PHP? Thanks.

marcospassos commented 3 years ago

The ANTLR is needed for generating the parser, which depends on the runtime.

acuna-public commented 3 years ago

Ah, depends on the runtime, get it, thanks, I though it's plain PHP implementation like another generators like yacc or lemon :(

marcospassos commented 3 years ago

@acuna-public, it's a plain PHP implementation. The ANTLR is a parser generator, meaning that you write a grammar, and ANTLR generates the PHP parser for you. From this point, you don't depend on ANTLR anymore (or at least until you need to update the grammar and regenerate the parser). The generated parser depends on the runtime library.

acuna-public commented 3 years ago

Aah, I see, seems that I don't get it right what is runtime means, thank you.

And I don't want to create another issue, so can I ask you there, I see the PhpLexer.g4 in grammar folder, so does it means that ANTLR can generate lexers too, because I know that it's only parsers generator tool?