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