Types¶
Number Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3848#1{{}}\mathdef3848{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=&
\def\mathdef3887#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3887{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|&
\def\mathdef3888#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3888{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|&
\def\mathdef3889#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3889{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|&
\def\mathdef3890#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3890{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\mathdef3848#1{{}}\mathdef3848{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=&
\def\mathdef3891#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3891{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\mathdef3848#1{{}}\mathdef3848{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=&
\def\mathdef3892#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3892{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|&
\def\mathdef3893#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3893{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\
\def\mathdef3848#1{{}}\mathdef3848{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=&
\def\mathdef3894#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3894{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|&
\def\mathdef3895#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3895{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\mathdef3848#1{{}}\mathdef3848{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\mathdef3848#1{{}}\mathdef3848{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=&
\def\mathdef3896#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3896{(}~\def\mathdef3897#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3897{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\mathdef3898#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3898{)}
&\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\
\def\mathdef3848#1{{}}\mathdef3848{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=&
\def\mathdef3899#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3899{(}~\def\mathdef3900#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3900{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3901#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3901{)}
&\Rightarrow& t \\
\def\mathdef3848#1{{}}\mathdef3848{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=&
\def\mathdef3902#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3902{(}~\def\mathdef3903#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3903{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3904#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3904{)}
&\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\mathdef3848#1{{}}\mathdef3848{parameter} &
\def\mathdef3905#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3905{(}~~\def\mathdef3906#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3906{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3907#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3907{)} &\equiv&
(\def\mathdef3908#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3908{(}~~\def\mathdef3909#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3909{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3910#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3910{)})^\ast \\
\def\mathdef3848#1{{}}\mathdef3848{result} &
\def\mathdef3911#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3911{(}~~\def\mathdef3912#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3912{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3913#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3913{)} &\equiv&
(\def\mathdef3914#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3914{(}~~\def\mathdef3915#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3915{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3916#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3916{)})^\ast \\
\end{array}\end{split}\]
Limits¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef3848#1{{}}\mathdef3848{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef3873#1{{\mathtt{u}#1}}\mathdef3873{\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\mathdef3873#1{{\mathtt{u}#1}}\mathdef3873{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3873#1{{\mathtt{u}#1}}\mathdef3873{\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\mathdef3848#1{{}}\mathdef3848{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\mathdef3848#1{{}}\mathdef3848{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\mathdef3848#1{{}}\mathdef3848{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\mathdef3917#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3917{(}~\def\mathdef3918#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3918{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3919#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3919{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]