Types

Number Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef3872#1{{}}\mathdef3872{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=& \def\mathdef3911#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3911{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef3912#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3912{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef3913#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3913{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef3914#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3914{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\mathdef3872#1{{}}\mathdef3872{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=& \def\mathdef3915#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3915{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\mathdef3872#1{{}}\mathdef3872{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=& \def\mathdef3916#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3916{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef3917#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3917{exnref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{exnref}} \\ &&|& \def\mathdef3918#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3918{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\ \def\mathdef3872#1{{}}\mathdef3872{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=& \def\mathdef3919#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3919{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef3920#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3920{exn} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{exnref}} \\ &&|& \def\mathdef3921#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3921{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\mathdef3872#1{{}}\mathdef3872{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\mathdef3872#1{{}}\mathdef3872{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=& \def\mathdef3922#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3922{(}~\def\mathdef3923#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3923{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\mathdef3924#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3924{)} &\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\ \def\mathdef3872#1{{}}\mathdef3872{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=& \def\mathdef3925#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3925{(}~\def\mathdef3926#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3926{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3927#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3927{)} &\Rightarrow& t \\ \def\mathdef3872#1{{}}\mathdef3872{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=& \def\mathdef3928#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3928{(}~\def\mathdef3929#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3929{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3930#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3930{)} &\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\mathdef3872#1{{}}\mathdef3872{parameter} & \def\mathdef3931#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3931{(}~~\def\mathdef3932#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3932{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3933#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3933{)} &\equiv& (\def\mathdef3934#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3934{(}~~\def\mathdef3935#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3935{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3936#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3936{)})^\ast \\ \def\mathdef3872#1{{}}\mathdef3872{result} & \def\mathdef3937#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3937{(}~~\def\mathdef3938#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3938{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3939#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3939{)} &\equiv& (\def\mathdef3940#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3940{(}~~\def\mathdef3941#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3941{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3942#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3942{)})^\ast \\ \end{array}\end{split}\]

Limits

\[\begin{split}\begin{array}{llclll} \def\mathdef3872#1{{}}\mathdef3872{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=& n{:}\href{../text/values.html#text-int}{\def\mathdef3897#1{{\mathtt{u}#1}}\mathdef3897{\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\mathdef3897#1{{\mathtt{u}#1}}\mathdef3897{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3897#1{{\mathtt{u}#1}}\mathdef3897{\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\mathdef3872#1{{}}\mathdef3872{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\mathdef3872#1{{}}\mathdef3872{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\mathdef3872#1{{}}\mathdef3872{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\mathdef3943#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3943{(}~\def\mathdef3944#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3944{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3945#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3945{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\ \end{array}\end{split}\]