WebAssembly / WebAssembly/wabt

`(ref null extern)` fails parsing

Open
#2,647 4 comments 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

According to the WASM spec, externref is an alias for (ref null extern).

While externref works well in .wat files (for wat2wasm), (ref null extern) doesn't seem to be supported, even with --enable-all:

error: unexpected token null, expected a numeric index or a name

The same error appears if I try to parse (ref extern) (without the null).

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 reproducing the reported parsing errors with wat2wasm, including both (ref null extern) and (ref extern), and compare them with the working externref form. Trace the parser entry point for these reference types and consider the issue done when the reported forms parse successfully with the expected flags.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.