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

shift/reduce errors in grammar



I have attached one of my grammars.  I am getting a shift/reduce error :
shift/reduce conflict in state [stack: TIf TIdentifier *] on TLPar in {
	[ PFactor = TIdentifier * TLPar PExprList TRPar ] (shift),
	[ PFactor = TIdentifier * ] followed by TLPar (reduce)
}

The grammar was working till I added one thing ... the line labeled 
{expr} in the production below:
    method_argument {->method_argument}   =
          {brkt_expr} less_than expression greater_than  {->New 
method_argument.expr(expression)}
        | {expr}   expression 				{->New method_argument.expr(expression)}

what I can't figure out is why this should be ambiguous... it 
doesn't seem to me to be ambiguous when I right out what I think it 
represents. And I am confused as to why it seems to be ambiguous on the IF statement.  Can someone point out what I doing wrong here?

Thanks for any help!


Roger

-- 
See Exclusive Video: Hollywood Life's 5th Annual Style Awards
http://www.hollywoodlife.net/Awards.aspx?AwardsID=style2008

Attachment: Syntax.sablecc
Description: Binary data