A Haskell port of the WebAssembly spec. Work in progress.
- Name convention: when several different OCaml modules share a common identifier, a prefix is added to that name for disambiguation. e.g.
IntAdd
/FloatAdd
,IntBinOp
/FloatBinOp
. Also,underscore_case
s are turned tocamelCase
s. - Annotating the AST: the OCaml implementation uses a
phrase
datatype to bind source code position to every AST node. Here, I use anAnnotated
datatype for similar purpose, but it's a polymorphic binder and can annotate the AST nodes with any other type. For more on this topic, check out this blog post. I'm choosing the low-tech approach (compared to fixpoint functors, etc) here, since it already works well. - Error handling: the OCaml implementation uses exceptions heavily; here I use
MonadError
with a single error type whenever possible. Vector
s replace lists.
- Phase 1: port the WebAssembly AST/kernel AST
- Modeling in Haskell
- Implement checker/desugarer/interpreter
- Implement tests
- Implement S-expression parser
- Phase 2: implement missing utilities
- Binary encoder/decoder
- Pretty-printer
- REPL-mode of interpreter
- Phase 3: in case I really get here
- More test suites, benchmark, documentation, etc
- Call 3rd-party WebAssembly implementations (SpiderMonkey, V8, etc) for cross-testing
- Upload to Hackage/Stackage Nightly