[antlr-interest] Deep Disambiguation

Kay Roepke kroepke at classdump.org
Wed Nov 22 12:47:02 PST 2006


On 22. Nov 2006, at 20:40 , Randall R Schulz wrote:

> As you can see from comparing the two immediately preceding examples,
> until either the ampersand or the equal sign is encountered, the
> interpretation of preceding content is unknown.
>
> I should note, too, that there are no declarations that state  
> whether a
> given name refers to a predicate or a function.

Given that, I don't think it is possible without knowledge about the  
names (this
is like casts vs. function calls).

> So how do I resolve this? I'd rather not build a generic tree  
> structure
> and convert it to a Predicate Formula or a Function Term only after  
> the
> parse completes. Everything else in the grammar admits direct local
> construction of the formula and / or term constituents, building the
> overall tree structure incrementally as the parse proceeds.

That said, you might be able to get away with the backtrack option.
Sadly, without delving in to the problem domain, I cannot really give  
you an example, sorry.

I think you would somehow need a symbol table in which you keep track  
of what name
can be a predicate, or formula, or both, i.e. not yet decided. It  
sounds pretty hard
to avoid a second pass, though.

Hope that helps at least a little...

-k

-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list