Hi,
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:
AST-lr.157
RefactoringEngine-lr.46 (Just updated)
SmaCC-lr.13
SmaCCDev-lr.18
I’m trying the examples listed in the tutorial and
this is the code that I’m putting in the scanner and the parser.
Scanner:
<number>
: [0-9]+ (\. [0-9]*) ? ;
Parser:
%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.
Regards,
Zak