GregT2 wrote
Given 'let x = y + 2 > 5 + 4 < 7';
I believe the grammar specified on Page 209 would accept this as valid. My question is, what is the correct way to handle it during code generation?
The only difference between operators in Jack is what VM command they generate.
| | a - b * c + d | | a > b + c < d |
Compiles to | |
push a
push b
sub
push c
mult
pushd
add
| |
push a
push b
gt
push c
add
pushd
lt
|
The compiler doesn't need to worry about the semantics of the various operators.
--Mark