You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm starting a new program to translate binary wasm to an AST as the first step in determining if we can translate wasm to MVM. I have a test example, it's hello-wasm in the repo. Uses Rust but also some other stuff designed for Javascript integration so not entirely appropriate. Any help getting hold of binary *.wasm files to use as test data appreciated.
My plan for the numerical ops is to delegate the problem to the MVM team by translating all WASM numerical codes to "wasm::math::*" using a synthesised name for each wasm operation. Some of these operations, such as vector ops and floating point, will not be implementable easily, others such as signed arithmetic must be implemented for any toolchain we build. Many, hopefully, will map directly to existing MVM opcodes. So this will provide a way of finding out what the midenVM may need to complete support for wasm, at least for the numerical operations.
An advantage of using the binary format is it's easier to parse, and more importantly all the lookup which translates names to integer indices is already done. The downside is that printing the AST to see what we got will have to be done (but that's probably needed anyhow). Formatting S-expressions is non-trivial (printing them is a piece of cake .. getting things to indent and line break in sensible places is another story altogether).
The other challenges will become evident as we go. The control structures available seem to be close to SAL. Wasm br_indirect (default, <vector of indices>) for example is the same instruction as BBL switch except switch doesn't allow defaults.
One further note, not really related to the topic: compilers are term rewriting systems which are usually passes translating one language to another. There's often a lot of commonality between input and output phases. In addition, we're experimenting with multiple languages and need to find out how to factor things at different levels: math, control, memory access, and overall processing architecture.
The best tech for doing this is polymorphic variants which Felix has stolen from Ocaml and aren't available in other languages, especially in conjunction with open recursion. However the big disadvantage is that unlike Ocaml, Felix cannot backtrack structural types to type aliases so an error involving say MVM opcodes will be hundreds of terms long. But they save a huge amount of coding whilst still providing strong typing.
The text was updated successfully, but these errors were encountered:
I'm starting a new program to translate binary wasm to an AST as the first step in determining if we can translate wasm to MVM. I have a test example, it's hello-wasm in the repo. Uses Rust but also some other stuff designed for Javascript integration so not entirely appropriate. Any help getting hold of binary *.wasm files to use as test data appreciated.
My plan for the numerical ops is to delegate the problem to the MVM team by translating all WASM numerical codes to "wasm::math::*" using a synthesised name for each wasm operation. Some of these operations, such as vector ops and floating point, will not be implementable easily, others such as signed arithmetic must be implemented for any toolchain we build. Many, hopefully, will map directly to existing MVM opcodes. So this will provide a way of finding out what the midenVM may need to complete support for wasm, at least for the numerical operations.
An advantage of using the binary format is it's easier to parse, and more importantly all the lookup which translates names to integer indices is already done. The downside is that printing the AST to see what we got will have to be done (but that's probably needed anyhow). Formatting S-expressions is non-trivial (printing them is a piece of cake .. getting things to indent and line break in sensible places is another story altogether).
The other challenges will become evident as we go. The control structures available seem to be close to SAL. Wasm
br_indirect (default, <vector of indices>)
for example is the same instruction as BBLswitch
exceptswitch
doesn't allow defaults.One further note, not really related to the topic: compilers are term rewriting systems which are usually passes translating one language to another. There's often a lot of commonality between input and output phases. In addition, we're experimenting with multiple languages and need to find out how to factor things at different levels: math, control, memory access, and overall processing architecture.
The best tech for doing this is polymorphic variants which Felix has stolen from Ocaml and aren't available in other languages, especially in conjunction with open recursion. However the big disadvantage is that unlike Ocaml, Felix cannot backtrack structural types to type aliases so an error involving say MVM opcodes will be hundreds of terms long. But they save a huge amount of coding whilst still providing strong typing.
The text was updated successfully, but these errors were encountered: