A Wasm parser and interpreter written in Kotlin.
I'd also like to specify that I'm using this project to learn Kotlin. So things may not be written in the best way possible.
https://webassembly.github.io/spec/core/index.html
https://webassembly.github.io/spec/core/binary/index.html
https://webassembly.github.io/spec/core/exec/index.html
https://en.wikipedia.org/wiki/LEB128
https://github.com/WebAssembly/wabt
https://webassembly.github.io/wabt/demo/wat2wasm
https://webassembly.github.io/wabt/demo/wasm2wat
This project is now able to parse basic Wasm and run it. Elements, Tables and 'partially' Globals are not yet supported.
I plan on adding support for Wat parsing (or a custom language) in the future.
Here's a rough list of the supported features:
- Binary Format (read/write)
- Values
- Types
- Value Types
- Function Types
- Limits
- Memory Types
- Table Types
- Global Types
- Instructions
- Control (75%)
- Reference
- Parametric (33%)
- Variable
- Local
- Global (50%)
- Table
- Memory (~10%)
- Numeric
- I32 (20%)
- I64
- F32
- F64
- Vector
- Modules
- Magic
- Version
- Sections
- Custom
- Type
- Import
- Function
- Table
- Memory
- Global
- Function
- Table
- Memory
- Global
- Export
- Start
- Element
- Code
- Data
- Data Count
-
ValidationWho needs validation? - Execution
- Runtime Structures
- Values
- Number
- Vector
- Reference
- Store
- Functions
- Tables
- Memories
- Globals
- Elements
- Data
- Instances
- Module
- Types
- Functions
- Tables
- Memories
- Globals (only from Imports)
- Elements
- Data
- Exports
- Function
- Table
- Memory
- Global
- Element
- Data
- Export
- Module
- External Values
- Function
- Table
- Memory
- Global
- Stack
- Label
- Values
- Runtime Structures
These categories were taken from https://webassembly.github.io/spec/core/index.html
I'd need some Wasm examples which use the features that are not yet implemented to undestand exactly how they work and test them.
Usage examples can be found in the test Kotlin module.