Values¶
WebAssembly programs operate on primitive numeric values. Moreover, in the definition of programs, immutable sequences of values occur to represent more complex data, such as text strings or other vectors.
Bytes¶
The simplest form of value are raw uninterpreted bytes. In the abstract syntax they are represented as hexadecimal literals.
Conventions¶
The meta variable
ranges over bytes.Bytes are sometimes interpreted as natural numbers
.
Integers¶
Different classes of integers with different value ranges are distinguished by their bit width
The class
Note
The main integer types occurring in this specification are
Conventions¶
The meta variables
range over integers.Numbers may be denoted by simple arithmetics, as in the grammar above. In order to distinguish arithmetics like
from sequences like , the latter is distinguished with parentheses.
Floating-Point¶
Floating-point data represents 32 or 64 bit values that correspond to the respective binary formats of the IEEE 754 standard (Section 3.3).
Every value has a sign and a magnitude.
Magnitudes can either be expressed as normal numbers of the form
Possible magnitudes also include the special values
where
A canonical NaN is a floating-point value
An arithmetic NaN is a floating-point value
Note
In the abstract syntax, subnormals are distinguished by the leading 0 of the significand. The exponent of subnormals has the same value as the smallest possible exponent of a normal number. Only in the binary representation the exponent of a subnormal is encoded differently than the exponent of any normal number.
The notion of canonical NaN defined here is unrelated to the notion of canonical NaN that the IEEE 754 standard (Section 3.5.2) defines for decimal interchange formats.
Conventions¶
The meta variable
ranges over floating-point values where clear from context.
Vectors¶
Numeric vectors are 128-bit values that are processed by vector instructions (also known as SIMD instructions, single instruction multiple data).
They are represented in the abstract syntax using
Names¶
Names are sequences of characters, which are scalar values as defined by Unicode (Section 2.4).
Due to the limitations of the binary format, the length of a name is bounded by the length of its UTF-8 encoding.
Convention¶
Characters (Unicode scalar values) are sometimes used interchangeably with natural numbers
.