.. index:: type pair: text format; type
.. index:: number type pair: text format; number type
\begin{array}{llcll@{\qquad\qquad}l}
\production{number type} & \Tnumtype &::=&
\text{i32} &\Rightarrow& \I32 \\ &&|&
\text{i64} &\Rightarrow& \I64 \\ &&|&
\text{f32} &\Rightarrow& \F32 \\ &&|&
\text{f64} &\Rightarrow& \F64 \\
\end{array}
.. index:: vector type pair: text format; vector type
\begin{array}{llcll@{\qquad\qquad}l}
\production{vector type} & \Tvectype &::=&
\text{v128} &\Rightarrow& \V128 \\
\end{array}
.. index:: reference type pair: text format; reference type
\begin{array}{llcll@{\qquad\qquad}l}
\production{reference type} & \Treftype &::=&
\text{funcref} &\Rightarrow& \FUNCREF \\ &&|&
\text{externref} &\Rightarrow& \EXTERNREF \\
\production{heap type} & \Theaptype &::=&
\text{func} &\Rightarrow& \FUNCREF \\ &&|&
\text{extern} &\Rightarrow& \EXTERNREF \\
\end{array}
.. index:: value type, number type, vector type, reference type pair: text format; value type
\begin{array}{llcll@{\qquad\qquad}l}
\production{value type} & \Tvaltype &::=&
t{:}\Tnumtype &\Rightarrow& t \\ &&|&
t{:}\Tvectype &\Rightarrow& t \\ &&|&
t{:}\Treftype &\Rightarrow& t \\
\end{array}
.. index:: function type, value type, result type pair: text format; function type
\begin{array}{llclll@{\qquad\qquad}l}
\production{function type} & \Tfunctype &::=&
\text{(}~\text{func}~~t_1^\ast{:\,}\Tvec(\Tparam)~~t_2^\ast{:\,}\Tvec(\Tresult)~\text{)}
&\Rightarrow& [t_1^\ast] \to [t_2^\ast] \\
\production{parameter} & \Tparam &::=&
\text{(}~\text{param}~~\Tid^?~~t{:}\Tvaltype~\text{)}
&\Rightarrow& t \\
\production{result} & \Tresult &::=&
\text{(}~\text{result}~~t{:}\Tvaltype~\text{)}
&\Rightarrow& t \\
\end{array}
Note
The optional identifier names for parameters in a function type only have documentation purpose. They cannot be referenced from anywhere.
Multiple anonymous parameters or results may be combined into a single declaration:
\begin{array}{llclll}
\production{parameter} &
\text{(}~~\text{param}~~\Tvaltype^\ast~~\text{)} &\equiv&
(\text{(}~~\text{param}~~\Tvaltype~~\text{)})^\ast \\
\production{result} &
\text{(}~~\text{result}~~\Tvaltype^\ast~~\text{)} &\equiv&
(\text{(}~~\text{result}~~\Tvaltype~~\text{)})^\ast \\
\end{array}
.. index:: limits pair: text format; limits
\begin{array}{llclll}
\production{limits} & \Tlimits &::=&
n{:}\Tu32 &\Rightarrow& \{ \LMIN~n, \LMAX~\epsilon \} \\ &&|&
n{:}\Tu32~~m{:}\Tu32 &\Rightarrow& \{ \LMIN~n, \LMAX~m \} \\
\end{array}
.. index:: memory type, limits, page size pair: text format; memory type
\begin{array}{llclll@{\qquad\qquad}l}
\production{memory type} & \Tmemtype &::=&
\X{lim}{:}\Tlimits &\Rightarrow& \X{lim} \\
\end{array}
.. index:: table type, reference type, limits pair: text format; table type
\begin{array}{llclll}
\production{table type} & \Ttabletype &::=&
\X{lim}{:}\Tlimits~~\X{et}{:}\Treftype &\Rightarrow& \X{lim}~\X{et} \\
\end{array}
.. index:: global type, mutability, value type pair: text format; global type pair: text format; mutability
\begin{array}{llclll}
\production{global type} & \Tglobaltype &::=&
t{:}\Tvaltype &\Rightarrow& \MCONST~t \\ &&|&
\text{(}~\text{mut}~~t{:}\Tvaltype~\text{)} &\Rightarrow& \MVAR~t \\
\end{array}