[antlr-interest] wanted: multiple result ASTs

Scobie Smith (Insight Global) v-scobis at microsoft.com
Tue May 22 16:59:30 PDT 2012


I'm fairly new to ANTLR; please bear with me if this has been asked before.

I am looking for a way to have ANTLR generate multiple result trees from my grammar, in order NOT to resolve ambiguity. Suppose I have a grammar that is "incomplete" or ambiguous, in that for some input text, there can be more than one "valid" way of parsing the input. (This is particularly useful in natural language parsing.) What I would like is to have rules that can collect all of these result ASTs-a list of ASTs, not just one AST. At the end of a successful parse run, there would then be a list of trees.

I know this is not a typical need, particularly with formal languages. But I am looking to apply ANTLR for some natural language parsing.

Any tips or pointers will be much appreciated. So far I do not see any easy way of doing this with ANTLR, but maybe there is some way of hacking in actions or the like.

Thanks.
Scobie



More information about the antlr-interest mailing list