webassemblyjs
webassemblyjs copied to clipboard
Should the the different WATF formats have different AST representations
These two functions are equivalent -
operations written in a 'stack' form:
(func $add (param f32) (param f32) (result f32)
(get_local 0)
(get_local 1)
(f32.add)
)
and in a 'function call' form:
(func $add (param f32) (param f32) (result f32)
(f32.add
(get_local 0)
(get_local 1)
)
)
However, our interpreter has to treat each differently. Here's an example that allows unary operations to use the 'function call' form:
https://github.com/xtuc/js-webassembly-interpreter/pull/116/commits/ca3b3a346ea61f930306f33b162da357c69259ed
I think it would be better if the interpreter didn't have to handle this. Should these two forms result in the same AST?