WebAssembly / WebAssembly/wabt

feature request: support for WASI preview 2 component model

Open
#2,376 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

The example code doesn't compile with wat2wasm

https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#component-definitions

(component
  (component
    (core module (func (export "one") (result i32) (i32.const 1)))
    (core module (func (export "two") (result f32) (f32.const 2)))
  )
  (core module (func (export "three") (result i64) (i64.const 3)))
  (component
    (component
      (core module (func (export "four") (result f64) (f64.const 4)))
    )
  )
  (component)
)
$ wat2wasm --version
1.0.34
$ wat2wasm main.wat 
main.wat:1:2: error: unexpected token "component", expected a module field or a module.
(component
 ^^^^^^^^^
main.wat:2:3: error: unexpected token (, expected EOF.
  (component
  ^

Other tools that support the component model https://component-model.bytecodealliance.org/language-support.html#building-a-component-with-wasm-tools

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked Component Model explainer and reproducing the failure with the provided WAT example and wat2wasm 1.0.34. Trace wat2wasm's parsing entry point to determine the scope of component support; done means the example compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.