Types¶
Number Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3789#1{{}}\mathdef3789{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=&
\def\mathdef3828#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3828{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|&
\def\mathdef3829#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3829{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|&
\def\mathdef3830#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3830{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|&
\def\mathdef3831#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3831{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\mathdef3789#1{{}}\mathdef3789{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=&
\def\mathdef3832#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3832{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\mathdef3789#1{{}}\mathdef3789{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=&
\def\mathdef3833#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3833{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|&
\def\mathdef3834#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3834{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\
\def\mathdef3789#1{{}}\mathdef3789{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=&
\def\mathdef3835#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3835{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|&
\def\mathdef3836#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3836{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\mathdef3789#1{{}}\mathdef3789{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\mathdef3789#1{{}}\mathdef3789{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=&
\def\mathdef3837#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3837{(}~\def\mathdef3838#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3838{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\mathdef3839#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3839{)}
&\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\
\def\mathdef3789#1{{}}\mathdef3789{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=&
\def\mathdef3840#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3840{(}~\def\mathdef3841#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3841{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3842#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3842{)}
&\Rightarrow& t \\
\def\mathdef3789#1{{}}\mathdef3789{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=&
\def\mathdef3843#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3843{(}~\def\mathdef3844#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3844{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3845#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3845{)}
&\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\mathdef3789#1{{}}\mathdef3789{parameter} &
\def\mathdef3846#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3846{(}~~\def\mathdef3847#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3847{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3848#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3848{)} &\equiv&
(\def\mathdef3849#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3849{(}~~\def\mathdef3850#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3850{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3851#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3851{)})^\ast \\
\def\mathdef3789#1{{}}\mathdef3789{result} &
\def\mathdef3852#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3852{(}~~\def\mathdef3853#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3853{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3854#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3854{)} &\equiv&
(\def\mathdef3855#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3855{(}~~\def\mathdef3856#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3856{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3857#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3857{)})^\ast \\
\end{array}\end{split}\]
Limits¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef3789#1{{}}\mathdef3789{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef3814#1{{\mathtt{u}#1}}\mathdef3814{\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\mathdef3814#1{{\mathtt{u}#1}}\mathdef3814{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3814#1{{\mathtt{u}#1}}\mathdef3814{\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\mathdef3789#1{{}}\mathdef3789{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\mathdef3789#1{{}}\mathdef3789{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\mathdef3789#1{{}}\mathdef3789{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\mathdef3858#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3858{(}~\def\mathdef3859#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3859{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3860#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3860{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]