SmaCC: Shift/Reduce Conflict

Bergel, Alexandre bergel at iam.unibe.ch
Mon Apr 23 14:40:01 UTC 2007


Hi Mathieu!

> I suggest you to create a rule for the assignment.
> You can write something like
>
> Assignment :
> 	Id "=" Expression;

If I add
Expression :
        FunctionCall	
        | Assignment
        | ...

Assignment :
	Id "=" Expression;

Then it loops... Hence a conflict.

> ExpressionWithValue always end up with a Number which is not what  
> your example saw.
> Shift/Reduce dose not matter
> You can still parse the expression and you have some rule to say if  
> you want to follow the longer rule or not (ie. Shift or reduce).
> By default you SmaCC do a shift. Look at the tutorial pane in the  
> UI of SmaCC.

Are you saying that my grammar is well written and the conflict I  
have cannot be removed properly ?

Thanks,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.software-artist.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






More information about the Squeak-dev mailing list