Types

Number Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef3843#1{{}}\mathdef3843{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=& \def\mathdef3882#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3882{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef3883#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3883{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef3884#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3884{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef3885#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3885{f64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f64}} \\ \end{array}\end{split}\]

Vector Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef3843#1{{}}\mathdef3843{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=& \def\mathdef3886#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3886{v128} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{v128}} \\ \end{array}\end{split}\]

Reference Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef3843#1{{}}\mathdef3843{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=& \def\mathdef3887#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3887{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef3888#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3888{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\ \def\mathdef3843#1{{}}\mathdef3843{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=& \def\mathdef3889#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3889{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef3890#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3890{extern} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\ \end{array}\end{split}\]

Value Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef3843#1{{}}\mathdef3843{value type} & \href{../text/types.html#text-valtype}{\mathtt{valtype}} &::=& t{:}\href{../text/types.html#text-numtype}{\mathtt{numtype}} &\Rightarrow& t \\ &&|& t{:}\href{../text/types.html#text-vectype}{\mathtt{vectype}} &\Rightarrow& t \\ &&|& t{:}\href{../text/types.html#text-reftype}{\mathtt{reftype}} &\Rightarrow& t \\ \end{array}\end{split}\]

Function Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef3843#1{{}}\mathdef3843{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=& \def\mathdef3891#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3891{(}~\def\mathdef3892#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3892{func}~~t_1^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-functype}{\mathtt{param}})~~t_2^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-functype}{\mathtt{result}})~\def\mathdef3893#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3893{)} &\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\ \def\mathdef3843#1{{}}\mathdef3843{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=& \def\mathdef3894#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3894{(}~\def\mathdef3895#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3895{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3896#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3896{)} &\Rightarrow& t \\ \def\mathdef3843#1{{}}\mathdef3843{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=& \def\mathdef3897#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3897{(}~\def\mathdef3898#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3898{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3899#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3899{)} &\Rightarrow& t \\ \end{array}\end{split}\]

Note

The optional identifier names for parameters in a function type only have documentation purpose. They cannot be referenced from anywhere.

Abbreviations

Multiple anonymous parameters or results may be combined into a single declaration:

\[\begin{split}\begin{array}{llclll} \def\mathdef3843#1{{}}\mathdef3843{parameter} & \def\mathdef3900#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3900{(}~~\def\mathdef3901#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3901{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3902#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3902{)} &\equiv& (\def\mathdef3903#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3903{(}~~\def\mathdef3904#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3904{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3905#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3905{)})^\ast \\ \def\mathdef3843#1{{}}\mathdef3843{result} & \def\mathdef3906#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3906{(}~~\def\mathdef3907#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3907{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3908#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3908{)} &\equiv& (\def\mathdef3909#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3909{(}~~\def\mathdef3910#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3910{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3911#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3911{)})^\ast \\ \end{array}\end{split}\]

Limits

\[\begin{split}\begin{array}{llclll} \def\mathdef3843#1{{}}\mathdef3843{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=& n{:}\href{../text/values.html#text-int}{\def\mathdef3868#1{{\mathtt{u}#1}}\mathdef3868{\mathtt{32}}} &\Rightarrow& \{ \href{../syntax/types.html#syntax-limits}{\mathsf{min}}~n, \href{../syntax/types.html#syntax-limits}{\mathsf{max}}~\epsilon \} \\ &&|& n{:}\href{../text/values.html#text-int}{\def\mathdef3868#1{{\mathtt{u}#1}}\mathdef3868{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3868#1{{\mathtt{u}#1}}\mathdef3868{\mathtt{32}}} &\Rightarrow& \{ \href{../syntax/types.html#syntax-limits}{\mathsf{min}}~n, \href{../syntax/types.html#syntax-limits}{\mathsf{max}}~m \} \\ \end{array}\end{split}\]

Memory Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef3843#1{{}}\mathdef3843{memory type} & \href{../text/types.html#text-memtype}{\mathtt{memtype}} &::=& \mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}} &\Rightarrow& \mathit{lim} \\ \end{array}\end{split}\]

Table Types

\[\begin{split}\begin{array}{llclll} \def\mathdef3843#1{{}}\mathdef3843{table type} & \href{../text/types.html#text-tabletype}{\mathtt{tabletype}} &::=& \mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}}~~\mathit{et}{:}\href{../text/types.html#text-reftype}{\mathtt{reftype}} &\Rightarrow& \mathit{lim}~\mathit{et} \\ \end{array}\end{split}\]

Global Types

\[\begin{split}\begin{array}{llclll} \def\mathdef3843#1{{}}\mathdef3843{global type} & \href{../text/types.html#text-globaltype}{\mathtt{globaltype}} &::=& t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{const}}~t \\ &&|& \def\mathdef3912#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3912{(}~\def\mathdef3913#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3913{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3914#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3914{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\ \end{array}\end{split}\]