maekawatoshiki / rapidus

ECMAScript implementation in Rust
MIT License
519 stars 21 forks source link

[BUG] Operator precedence #53

Closed LuoZijun closed 3 years ago

LuoZijun commented 5 years ago

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table

Node.js:

console.log(1 + 2*3 ** 2 - 1);
// Output: 18

Rapidus (WASM):

print(1 + 2*3 ** 2 - 1);
// Output: 7
maekawatoshiki commented 5 years ago

It's unimplemented. I'll work on it.

sisshiki1969 commented 5 years ago

The exponentiation operator is correctly parsed, but the code generator does not produce corresponding bytecodes in this version.

sisshiki1969 commented 5 years ago

fixed. #56 But be aware that 'Rapidus on WASM' web site is still using the older (unfixed) version.