[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to handle ambiguity



I have a grammar for an ambiguous language, which of course gives me
many reduce/reduce conflicts. I understand the method of inlining to
solve conflicts, but that doesn't help when the language itself is
ambiguous.

If I know conceptually how to resolve each ambiguity, is there a
general approach to re-writing the grammar to resolve them? I.e.,
anytime a reduce/reduce conflict occurs between two alternatives, I
want to be able to specify the winner, but there doesn't seem to be a
way to do this in the grammar. JavaCC has "semantic lookahead" to
deal with this, but I know this violates the separation of syntax and
semantics in SableCC. So what to do?