rylev / wepl

A repl for WebAssembly Components
Apache License 2.0
108 stars 8 forks source link

Add document for encoding literal values for all wit types #1

Closed rylev closed 1 year ago

rylev commented 1 year ago

Adds docs written by @lann for how to encode literal values for all the various wit types. Once this is merged we can update the parser to handle this.

One interesting thing will be that in this proposal some the type of literals are not ambiguous. For example: 1 can be any of the various integer types. "hello" can be a string, option<string> result<string> and more. We'll have to see if this causes problems and perhaps make the encoding more strict if it does.

rylev commented 1 year ago

Was able to get support in for records, enums and variants, and it seems to work fairly well. Going to merge this.

lann commented 1 year ago

Cool. I've been slowly working on a standalone parser & writer for the syntax too with the hope of eventually upstreaming it into wasm-tools.