Types

Number Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef2621#1{{}}\mathdef2621{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}} &::=& \def\mathdef2658#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2658{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef2659#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2659{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef2660#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2660{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef2661#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2661{f64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f64}} \\ \end{array}\end{split}\]

Reference Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef2621#1{{}}\mathdef2621{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}} &::=& \def\mathdef2662#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2662{funcref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef2663#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2663{externref} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{externref}} \\ \def\mathdef2621#1{{}}\mathdef2621{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}} &::=& \def\mathdef2664#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2664{func} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}} \\ &&|& \def\mathdef2665#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2665{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\mathdef2621#1{{}}\mathdef2621{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-reftype}{\mathtt{reftype}} &\Rightarrow& t \\ \end{array}\end{split}\]

Function Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef2621#1{{}}\mathdef2621{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}} &::=& \def\mathdef2666#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2666{(}~\def\mathdef2667#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2667{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\mathdef2668#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2668{)} &\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \\ \def\mathdef2621#1{{}}\mathdef2621{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}} &::=& \def\mathdef2669#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2669{(}~\def\mathdef2670#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2670{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef2671#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2671{)} &\Rightarrow& t \\ \def\mathdef2621#1{{}}\mathdef2621{result} & \href{../text/types.html#text-functype}{\mathtt{result}} &::=& \def\mathdef2672#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2672{(}~\def\mathdef2673#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2673{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef2674#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2674{)} &\Rightarrow& t \\ \end{array}\end{split}\]

Abbreviations

Multiple anonymous parameters or results may be combined into a single declaration:

\[\begin{split}\begin{array}{llclll} \def\mathdef2621#1{{}}\mathdef2621{parameter} & \def\mathdef2675#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2675{(}~~\def\mathdef2676#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2676{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef2677#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2677{)} &\equiv& (\def\mathdef2678#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2678{(}~~\def\mathdef2679#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2679{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef2680#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2680{)})^\ast \\ \def\mathdef2621#1{{}}\mathdef2621{result} & \def\mathdef2681#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2681{(}~~\def\mathdef2682#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2682{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef2683#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2683{)} &\equiv& (\def\mathdef2684#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2684{(}~~\def\mathdef2685#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2685{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef2686#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2686{)})^\ast \\ \end{array}\end{split}\]

Limits

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