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

Re: Understanding error messages: reduce/reduce with only 1 alternative



Hello!

I managed to find the reason/solution:
When having empty productions that are optional there will be problems
like this one:
    new_type_id = type_specifier_seq new_declarator?;

    // possibility of being empty of original:
    new_declarator =
    	/* {Original} ptr_operator* direct_new_declarator?*/
    	{direct_only} direct_new_declarator
    	| {with_pointer_ops} ptr_operator+ direct_new_declarator?;

The solution is indicated.
The error reported by SableCC is a reduce/reduce conflict with one
alternative... which can leave one startled ;-)

bye
Georg

On Sa, 12.06.2004, 17:40, georgk@bnet-ibb.de sagte:
> Hello!
>
> This time I have an error message I don't quite understand:
>
> reduce/reduce conflict in state [stack: TNew PTypeSpecifierSeq *] on TRBkt
> in {
> 	[ PUnaryExpression = TNew PTypeSpecifierSeq * ] followed by TRBkt
> (reduce)
> }
>
> reduce/reduce conflict in state [stack: TNew PTypeSpecifierSeq *] on TRPar
> in {
> 	[ PUnaryExpression = TNew PTypeSpecifierSeq * ] followed by TRPar
> (reduce)
> }
>
> reduce/reduce conflict in state [stack: TNew PTypeSpecifierSeq *] on
> TComma in {
> 	[ PUnaryExpression = TNew PTypeSpecifierSeq * ] followed by TComma
> (reduce)
> }
>
> reduce/reduce conflict in state [stack: TNew PTypeSpecifierSeq *] on
> TSemicolon
> in {
> 	[ PUnaryExpression = TNew PTypeSpecifierSeq * ] followed by TSemicolon
> (reduce)
> }
>
> reduce/reduce conflict in state [stack: TNew PTypeSpecifierSeq *] on
> TGreaterThan in {
> 	[ PUnaryExpression = TNew PTypeSpecifierSeq * ] followed by TGreaterThan
> (reduce)
> }
>
> Why does it complain if it's telling me that there's just one choice?
>
> The grammar is attached.
> Georg