[antlr-interest] wanted: multiple result ASTs

Eric researcher0x00 at gmail.com
Wed Jun 6 06:43:21 PDT 2012

Hi Scobie,

Since I often come across the answer to your question and just came across
it again, this time as a good example in a new book, I thought I would
share it here.

In "Thinking as Computation: A First Course" by Hector J. Levesque

Using Amazon's Look Inside feature

Take a look at Figure 8.3 on page 158.

On Wed, May 23, 2012 at 7:06 AM, Eric <researcher0x00 at gmail.com> wrote:

> Hi Scobie,
> I have never written a parser for natural language yet, but from working
> with Artificial Intelligence and PROLOG, that is where I would focus my
> search. In particular, PROLOG will generate multipule results for a given
> query. So if the input is ambiguios, there would be multiple ways to match
> against the rules, and the results would be each way that the PROLOG
> program matched the rules against the input.
> Hope that helps,
> Eric
> On Tue, May 22, 2012 at 7:59 PM, Scobie Smith (Insight Global) <
> v-scobis at microsoft.com> wrote:
>> 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
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address

More information about the antlr-interest mailing list