[antlr-interest] wanted: multiple result ASTs

Scobie Smith (Insight Global) v-scobis at microsoft.com
Tue Jun 12 18:02:58 PDT 2012


Thanks, Eric. Prolog is certainly an interesting option, but the idea I have in mind would work well (in principle) with the non-deterministic sort of parser. I would have to make a major reorientation in architecture with Prolog. But that book looks interesting too. I have been reading Levesque's book on Knowledge Representation, which is also a good one.

From: Eric [mailto:researcher0x00 at gmail.com]
Sent: Wednesday, June 06, 2012 6:43 AM
To: Scobie Smith (Insight Global)
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] wanted: multiple result ASTs

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
http://www.amazon.com/Thinking-Computation-Hector-J-Levesque/dp/0262016990

Using Amazon's Look Inside feature
http://www.amazon.com/Thinking-Computation-Hector-J-Levesque/dp/0262016990/ref=zg_bs_3987_1#reader_0262016990

Take a look at Figure 8.3 on page 158.

Eric
On Wed, May 23, 2012 at 7:06 AM, Eric <researcher0x00 at gmail.com<mailto: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<mailto: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