[antlr-interest] Removing output=AST lets ANTLR fail to generate

Christian chwchw at gmx.de
Fri Nov 11 14:00:00 PST 2011


> So, in other words, the feature request is that AST-related syntax be
> ignored if output!=AST? 
Very well summarized! Yes.

> The only thing I wonder is, for that not-generating-an-AST-any-more
> parser, wouldn't it need some different actions from the original
> AST-generating version in order to be any use whatsoever? 
Sure, that will be problematic. However, I personally do not use action
code because I do not like to mix languages. So, for such scenarios, it
should be relatively easy to implement the feature. For the first
release, you could perhaps show a warning or even a compiler-error if
the grammar also contains action code.

> If you create a combined grammar that has lexer, parser, and AST rules, you
> could select an option to refactor the grammar into three separate grammar
> files.
Nice idea, but how could rewrite rules/operators be separated from a
parser grammar? As I understand and use the formers, they are integrated
and bound to specific rules. Spontaneously, I have no idea how you could
separate them cleverly. Somehow, you must define and maintain a mapping.

Regards,
Christian


More information about the antlr-interest mailing list