bytecodealliance/wac

Syntax supported in WIT but not in WAC

Closed this issue · 2 comments

The README states that "The wac language is a declarative superset of wit" and the language guide's that "WAC is a superset of the WIT language."

However, when I tried to use the following WIT fragment in my .wac file:

interface spork {
    use wasi:http/types@0.2.0.{incoming-request, response-outparam};
    handle: func(request: incoming-request, response-out: response-outparam);
}

wac encode printed:

error: failed to parse document

  × `0.2.0.` is not a valid semantic version
   ╭─[compose.wac:4:25]
 3 │ interface spork {
 4 │     use wasi:http/types@0.2.0.{incoming-request, response-outparam};
   ·                         ───┬──
   ·                            ╰── invalid version
 5 │     handle: func(request: incoming-request, response-out: response-outparam);
   ╰────

Is this expected to work? If not, it would be useful for the docs to clarify what WIT syntax is supported in WAC and what is not. Although I realise that may be a moving target at this stage of development... Thanks!

That is expected to work and is a bug. I think the lexer needs to be updated to not allow a trailing period in a version or perhaps use a real regex for it, provided they don't need backtracking and logos allows it.

Thanks @peterhuene! logos seemed happy with the official regex so I've sent #129.