wasm-tools
wasm-tools copied to clipboard
Using wast in combination with wasm-encoder
I'm trying to parse a WAT Expression
and emit the instructions into a wasm-encoder Function
.
This is for a language compiler i'm writing that has inlines WAT code.
The problem is that wast::Instruction
is not compatible with wasm_encoder::Instruction
.
Also the wast::binary::Encode
trait is private, so i can't use that in combination with wasm_encoder::Function::raw
either.
My suggestion is to either make the wast Encode
trait public, or implement From<wast::Instruction> for wasm_encoder::Instruction
.
Thanks for the report! The eventual goal is to have wast
depend on wasm-encoder
, and at that point we could have conversion from the wast
AST to types in the wasm-encoder
trait, such as wast::Expression
returning a Vec<wasm_encoder::Instruction>
or similar. At this time though that's not yet implemented, but if you're interested to help out I think it'd be great to implement!