[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to read error messages
it's this production (if I understand correctly):
simple_statement = {simple} identifier simple_statement_last |
{multiple_identifier} l_square_bracket output_variables r_square_bracket
assignop identifier l_paren params r_paren semicolon? ;
//{multiple_identifier} l_square_bracket output_variables r_square_bracket
simple_statement_last ;
I'm not exaclty sure what you mean with this production, but probably it's
something this:
simple_statement =
{simple} identifier simple_statement_last
|
{multiple_identifier1} l_square_bracket output_variables r_square_bracket
assignop identifier l_paren params r_paren semicolon?
|
{multiple_identifier2} l_square_bracket output_variables r_square_bracket
simple_statement_last ;
By the way, it's better not to use productions like:
production1 = production2 ....;
production2 = {empty} | ...;
better do something like:
production1 = production2? ....;
production2 = ...;
(notice the use of '?' )
> Thanks for your advice. May be you could help me further if you look at
> the
> grammar.
>
> At line 177 if I replace square_bracket with curly_bracket, it seems to
> solve the problem. But I would like to stick to the specification.
>
> Thanks
>
> -Ali
>
> ----- Original Message -----
> From: "Pieter van der Spek" <pieter@West.NL>
> To: "Ali Muhammad" <solent@sympatico.ca>
> Cc: <sablecc-list@sable.mcgill.ca>
> Sent: Friday, February 13, 2004 2:58 AM
> Subject: Re: How to read error messages
>
>
>> Well, the error message shows you have a production called
>> arguments_list.
>> this production is, however, empty: arguments_list = ;
>>
>> this can never be right, so I suggest you look at that production
>> (probably you can leave it out)
>>
>>
>> > Hi,
>> >
>> > I am writing a grammer for an interpreter. I get following error
>> message
>> > when I try to generate the code. Can somebody help me interpret this
>> > message.
>> >
>> > Thanks
>> >
>> > -Ali
>> >
>> > reduce/reduce conflict in state [stack: TLSquareBracket TIdentifier *]
> on
>> > TRSqua
>> > reBracket in {
>> > [ PArgumentsList = * ] followed by TRSquareBracket (reduce),
>> > [ POutputVariables = TIdentifier * ] followed by
>> TRSquareBracket
>> > (reduce
>> > )
>> > }
>> > java.lang.RuntimeException:
>> >
>> > reduce/reduce conflict in state [stack: TLSquareBracket TIdentifier *]
> on
>> > TRSqua
>> > reBracket in {
>> > [ PArgumentsList = * ] followed by TRSquareBracket (reduce),
>> > [ POutputVariables = TIdentifier * ] followed by
>> TRSquareBracket
>> > (reduce
>> > )
>> >
>>
>>
>> -------------------
>>
>> Pieter van der Spek
>> ---- West Consulting B.V. - www.west.nl
>> ---- Tu Delft / Computer Science - www.tudelft.nl
>>
>
-------------------
Pieter van der Spek
---- West Consulting B.V. - www.west.nl
---- Tu Delft / Computer Science - www.tudelft.nl