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

Re: forced shift/reduce conflict resolution



On Thu, Oct 03, 2002 at 10:42:15PM +0200, VEROK Istvan wrote:
> 
> How would one go about making SableCC generate a greedy parser (that is,
> arbitrarily resolve during generation all shift/reduce conflicts as
> "shift") ?  No clue anywhere that I could find in the docs.

You have to encode such a thing by hand.  I will eventually include
some disambiguation support in SableCC, but not arbitrary shift/reduce
and reduce/reduce resolutions, as these things are *very* tricky to
use.

Look in src/org/sablecc/sablecc/Grammar.java.  You simply need to
change the computeLALR() method to resolve the conflict instead of
throwing an exception.

Be warned that you are playing a dangerous game.

Etienne

> 
> Regards,
> Istvan
> 
> 
> .

-- 
Etienne M. Gagnon                    http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/

Attachment: pgp00003.pgp
Description: PGP signature