Types¶
Number Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3808#1{{}}\mathdef3808{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=&
\def\mathdef3847#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3847{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|&
\def\mathdef3848#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3848{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|&
\def\mathdef3849#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3849{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|&
\def\mathdef3850#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3850{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\mathdef3808#1{{}}\mathdef3808{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=&
\def\mathdef3851#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3851{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\mathdef3808#1{{}}\mathdef3808{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=&
\def\mathdef3852#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3852{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|&
\def\mathdef3853#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3853{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\
\def\mathdef3808#1{{}}\mathdef3808{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=&
\def\mathdef3854#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3854{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|&
\def\mathdef3855#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3855{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\mathdef3808#1{{}}\mathdef3808{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\mathdef3808#1{{}}\mathdef3808{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=&
\def\mathdef3856#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3856{(}~\def\mathdef3857#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3857{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\mathdef3858#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3858{)}
&\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\
\def\mathdef3808#1{{}}\mathdef3808{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=&
\def\mathdef3859#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3859{(}~\def\mathdef3860#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3860{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3861#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3861{)}
&\Rightarrow& t \\
\def\mathdef3808#1{{}}\mathdef3808{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=&
\def\mathdef3862#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3862{(}~\def\mathdef3863#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3863{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3864#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3864{)}
&\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\mathdef3808#1{{}}\mathdef3808{parameter} &
\def\mathdef3865#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3865{(}~~\def\mathdef3866#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3866{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3867#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3867{)} &\equiv&
(\def\mathdef3868#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3868{(}~~\def\mathdef3869#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3869{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3870#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3870{)})^\ast \\
\def\mathdef3808#1{{}}\mathdef3808{result} &
\def\mathdef3871#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3871{(}~~\def\mathdef3872#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3872{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef3873#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3873{)} &\equiv&
(\def\mathdef3874#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3874{(}~~\def\mathdef3875#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3875{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef3876#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3876{)})^\ast \\
\end{array}\end{split}\]
Limits¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef3808#1{{}}\mathdef3808{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef3833#1{{\mathtt{u}#1}}\mathdef3833{\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\mathdef3833#1{{\mathtt{u}#1}}\mathdef3833{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3833#1{{\mathtt{u}#1}}\mathdef3833{\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\mathdef3808#1{{}}\mathdef3808{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\mathdef3808#1{{}}\mathdef3808{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\mathdef3808#1{{}}\mathdef3808{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\mathdef3877#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3877{(}~\def\mathdef3878#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3878{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef3879#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3879{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]