[squeak-dev] Precedence in SmaCC

Andrew Wakeling andrew.wakeling at objective.com
Sun Mar 9 10:08:24 UTC 2008



I've recently attempted to get SmaCC working in Squeak.


I'm having trouble getting precedence working in my image.


My base image is Squeak 3.9 final 7067.


I have confirmed that I have all the pre-requisite packages loaded:



RefactoringEngine-lr.46 (Just updated)




I'm trying the examples listed in the tutorial and this is the code that
I'm putting in the scanner and the parser.


<number>        :       [0-9]+ (\. [0-9]*) ? ;

%left "+" "-";
%left "*" "/"; Expression : 
          Expression 'exp1' "+" Expression 'exp2' {exp1 + exp2} |
Expression 'exp1' "-" Expression 'exp2' {exp1 - exp2} | Expression
'exp1' "*" Expression 'exp2' {exp1 * exp2} | Expression 'exp1' "/"
Expression 'exp2' {exp1 / exp2} | Number 'number' {number};
Number : <number> 'numberToken' {numberToken value asNumber};


When I type in, "2+3*4" and hit "Parse and Inspect", I'm getting 20
instead of 14.


Is anybody else getting this behaviour?


It would be great too if anybody who tries this can send me their
generated classes so I can compare the results.


I'm running my Squeak in Windows XP too.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080309/61d05e15/attachment.htm

More information about the Squeak-dev mailing list