WAVE (Web Assembly Value Encoding) defines a grammar for representing values. A value can be any of the following types:
- number: Finite numbers,
nan, inf, or -inf. - char: A single character enclosed in single quotes (e.g.,
'a'). - string: A double-quoted string or a triple-quoted
multiline-string. - variant-case: A labeled value, often used for
Bool, Variant, Enum, Option, and Result types. It follows the pattern label (payload). - tuple: A sequence of values enclosed in parentheses:
(val1, val2). - list: A sequence of values enclosed in square brackets:
[val1, val2]. - flags: A set of labels enclosed in curly braces:
{label1, label2}. - record: A collection of key-value pairs enclosed in curly braces:
{label: value}.
Note that variant-case, Bool, Variant, Enum, Option, and Result are grouped under variant-case because they require type information to be distinguished. Many applications allow whitespace (value-ws) around these values, including comments starting with //.
value ::= number
| char
| string
| variant-case
| tuple
| list
| flags
| record