Types

Number Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef4098#1{{}}\mathdef4098{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=& \def\mathdef4137#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4137{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef4138#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4138{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef4139#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4139{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef4140#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4140{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\mathdef4098#1{{}}\mathdef4098{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}} &::=& \def\mathdef4141#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4141{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\mathdef4098#1{{}}\mathdef4098{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=& \def\mathdef4142#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4142{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef4143#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4143{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\ \def\mathdef4098#1{{}}\mathdef4098{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=& \def\mathdef4144#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4144{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef4145#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4145{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\mathdef4098#1{{}}\mathdef4098{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\mathdef4098#1{{}}\mathdef4098{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=& \def\mathdef4146#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4146{(}~\def\mathdef4147#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4147{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\mathdef4148#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4148{)} &\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\ \def\mathdef4098#1{{}}\mathdef4098{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=& \def\mathdef4149#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4149{(}~\def\mathdef4150#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4150{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef4151#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4151{)} &\Rightarrow& t \\ \def\mathdef4098#1{{}}\mathdef4098{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=& \def\mathdef4152#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4152{(}~\def\mathdef4153#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4153{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef4154#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4154{)} &\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\mathdef4098#1{{}}\mathdef4098{parameter} & \def\mathdef4155#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4155{(}~~\def\mathdef4156#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4156{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4157#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4157{)} &\equiv& (\def\mathdef4158#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4158{(}~~\def\mathdef4159#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4159{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4160#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4160{)})^\ast \\ \def\mathdef4098#1{{}}\mathdef4098{result} & \def\mathdef4161#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4161{(}~~\def\mathdef4162#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4162{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4163#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4163{)} &\equiv& (\def\mathdef4164#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4164{(}~~\def\mathdef4165#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4165{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4166#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4166{)})^\ast \\ \end{array}\end{split}\]

Limits

\[\begin{split}\begin{array}{llclll} \def\mathdef4098#1{{}}\mathdef4098{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=& n{:}\href{../text/values.html#text-int}{\def\mathdef4123#1{{\mathtt{u}#1}}\mathdef4123{\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\mathdef4123#1{{\mathtt{u}#1}}\mathdef4123{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef4123#1{{\mathtt{u}#1}}\mathdef4123{\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\mathdef4098#1{{}}\mathdef4098{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\mathdef4098#1{{}}\mathdef4098{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\mathdef4098#1{{}}\mathdef4098{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\mathdef4167#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4167{(}~\def\mathdef4168#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4168{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef4169#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4169{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\ \end{array}\end{split}\]