SmaCC: Shift/Reduce Conflict
Bergel, Alexandre
bergel at iam.unibe.ch
Tue Apr 24 10:36:20 UTC 2007
Those comments helped me:
> You can parse "z = 1 + 2" multiple ways:
> (z = 1) + 2
> or
> z = (1 + 2)
>> The main reason why its occurs is when you write something like this:
>>
>> Expression:
>> FixedPattern
>> | FixedPattern Expression
>>
>> this will force parser to shift and to grow its stack.
It was not clear to me.
My grammar contains something like:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Expression :
Id "=" Expression {SPAssignment new name: '1'; expression: '3'}
| Conditional {'1'}
| VariableDefinition {SPVariableDefinition new name: '1'}
| BinaryOp {'1'}
| Term {'1'}
;
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The conflict disappeared.
Thanks for you help Mathieu
Alexandre
On 24 Apr 2007, at 10:43, Mathieu Suen wrote:
>>> The main reason why its occurs is when you write something like
>>> this:
>>>
>>> Expression:
>>> FixedPattern
>>> | FixedPattern Expression
>>>
>>> this will force parser to shift and to grow its stack.
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.software-artist.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
More information about the Squeak-dev
mailing list
|