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

Re: How to interperet error messages



Hi Roger, All,

SableCC3 does internal transformation to the grammar it receives as input. Inside a production, all alternative elements with the operator *, ?, and + are transformed. In case of operators * and +, a new Let's look at an example :

// First example with the '*' operator
 ....
Productions
 ....
a = b c d*;

is transformed to
a {-> a}
= {1} b c $d {-> New a(b, c, [ $d.d ]) }
| {2} b c {-> New a(b, c, [ ])} ;
$d {-> d*}
= {nonterminal} $d d {-> [ $d.d, d ] }
| {terminal} d {-> [ d ] }
;
---------------------------------------------- and
//Second example with the '+' operator
....
Productions
....
a = b c d+;


is transformed to
            a                              {-> a}
               =  {1}  b  c $d     {-> New a(b, c, [ $d.d ])   }
            ;
            $d                                             {-> d*}
               = {nonterminal}  $d d     {-> [ $d.d, d ] }
               |   {terminal}         d          {-> [ d ] }
            ;

Notice that a new production has been added to the grammar. This production helps realize the '*' or the '+' operator.
So, now in the transformed grammar, P$D refers to the new added production ($d) .
In summary, every time a '+' and '*' occured after an alternative element, this element is replaced within the grammar as shown above.
Hope that this could help you,


Kevin.

Thanks for the reference.... they have been helpful.

In the error message I get, like the one below, sometimes there are lables of the form
P$Blank. Is there a way to know exactly what the P$Blank refers to so I can look back in my grammar & find where the offending line is?


reduce/reduce conflict in state [stack: P$Blank TBlank *] on TIdentifier in {
	[ P$Blank = P$Blank TBlank * ] followed by TIdentifier (reduce),
	[ P$Blank = TBlank * ] followed by TIdentifier (reduce)


----- Original Message ----- From: Etienne Gagnon <gagnon.etienne_m@uqam.ca> Date: Wed, 04 Feb 2004 16:40:35 -0500 To: Roger Pomeroy <rogerandsue@mail.com> Subject: Re: How to interperet error messages



Hi Roger,

Have a look at:
http://www.sable.mcgill.ca/listarchives/sablecc-list/msg00238.html

Etienne

Roger Pomeroy wrote:


I would like some help in interpereting the error output. Specifically, what tips can you give on locating the statments in the input grammar that are causing the reduce/reduce conflict?

Thanks!

Roger


java.lang.RuntimeException:


reduce/reduce conflict in state [stack: PName TLPar *] on TComma in {
	[ PActualParamList = * ] followed by TComma (reduce),
	[ PRelational = * ] followed by TComma (reduce)
}



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