Types

Number Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef3689#1{{}}\mathdef3689{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=& \def\mathdef3728#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3728{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef3729#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3729{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef3730#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3730{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef3731#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3731{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\mathdef3689#1{{}}\mathdef3689{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=& \def\mathdef3732#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3732{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\mathdef3689#1{{}}\mathdef3689{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=& \def\mathdef3733#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3733{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef3734#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3734{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\ \def\mathdef3689#1{{}}\mathdef3689{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=& \def\mathdef3735#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3735{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef3736#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3736{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\mathdef3689#1{{}}\mathdef3689{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\mathdef3689#1{{}}\mathdef3689{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=& \def\mathdef3737#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3737{(}~\def\mathdef3738#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3738{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\mathdef3739#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3739{)} &\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\ \def\mathdef3689#1{{}}\mathdef3689{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=& \def\mathdef3740#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3740{(}~\def\mathdef3741#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3741{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3742#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3742{)} &\Rightarrow& t \\ \def\mathdef3689#1{{}}\mathdef3689{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=& \def\mathdef3743#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3743{(}~\def\mathdef3744#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3744{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3745#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3745{)} &\Rightarrow& t \\ \end{array}\end{split}\]

Abbreviations

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

\[\begin{split}\begin{array}{llclll} \def\mathdef3689#1{{}}\mathdef3689{parameter} & \def\mathdef3746#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3746{(}~~\def\mathdef3747#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3747{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3748#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3748{)} &\equiv& (\def\mathdef3749#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3749{(}~~\def\mathdef3750#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3750{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3751#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3751{)})^\ast \\ \def\mathdef3689#1{{}}\mathdef3689{result} & \def\mathdef3752#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3752{(}~~\def\mathdef3753#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3753{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3754#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3754{)} &\equiv& (\def\mathdef3755#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3755{(}~~\def\mathdef3756#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3756{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3757#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3757{)})^\ast \\ \end{array}\end{split}\]

Limits

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