Types¶
Number Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3931#1{{}}\mathdef3931{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=&
\def\mathdef3970#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3970{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|&
\def\mathdef3971#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3971{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|&
\def\mathdef3972#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3972{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|&
\def\mathdef3973#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3973{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\mathdef3931#1{{}}\mathdef3931{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=&
\def\mathdef3974#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3974{v128} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{v128}} \\
\end{array}\end{split}\]
Heap Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3931#1{{}}\mathdef3931{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}}_I &::=&
\def\mathdef3975#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3975{func} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{func}} \\ &&|&
\def\mathdef3976#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3976{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|&
x{:}\href{../text/modules.html#text-typeidx}{\mathtt{typeidx}}_I &\Rightarrow& x \\
\end{array}\end{split}\]
Reference Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3931#1{{}}\mathdef3931{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=&
\def\mathdef3977#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3977{(}~\def\mathdef3978#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3978{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef3979#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3979{)}
&\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|&
\def\mathdef3980#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3980{(}~\def\mathdef3981#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3981{ref}~~\def\mathdef3982#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3982{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef3983#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3983{)}
&\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\href{../syntax/types.html#syntax-reftype}{\mathsf{null}}~\mathit{ht} \\
\end{array}\end{split}\]
Abbreviations¶
There are shorthands for references to abstract heap types.
\[\begin{split}\begin{array}{llclll}
\def\mathdef3931#1{{}}\mathdef3931{reference type} &
\def\mathdef3984#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3984{funcref} &\equiv& \def\mathdef3985#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3985{(}~\def\mathdef3986#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3986{ref}~~\def\mathdef3987#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3987{null}~~\def\mathdef3988#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3988{func}~\def\mathdef3989#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3989{)} \\
\def\mathdef3990#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3990{externref} &\equiv& \def\mathdef3991#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3991{(}~\def\mathdef3992#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3992{ref}~~\def\mathdef3993#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3993{null}~~\def\mathdef3994#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3994{extern}~\def\mathdef3995#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3995{)} \\
\end{array}\end{split}\]
Value Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3931#1{{}}\mathdef3931{value type} & \href{../text/types.html#text-valtype}{\mathtt{valtype}}_I &::=&
t{:}\href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &\Rightarrow& t \\ &&|&
t{:}\href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &\Rightarrow& t \\ &&|&
t{:}\href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &\Rightarrow& t \\
\end{array}\end{split}\]
Function Types¶
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef3931#1{{}}\mathdef3931{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=&
\def\mathdef3996#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3996{(}~\def\mathdef3997#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3997{func}~~t_1^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-functype}{\mathtt{param}}_I)~~t_2^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-functype}{\mathtt{result}}_I)~\def\mathdef3998#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3998{)}
&\Rightarrow& [t_1^\ast] \href{../syntax/types.html#syntax-instrtype}{\rightarrow} [t_2^\ast] \\
\def\mathdef3931#1{{}}\mathdef3931{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=&
\def\mathdef3999#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3999{(}~\def\mathdef4000#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4000{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4001#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4001{)}
&\Rightarrow& t \\
\def\mathdef3931#1{{}}\mathdef3931{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=&
\def\mathdef4002#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4002{(}~\def\mathdef4003#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4003{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4004#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4004{)}
&\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\mathdef3931#1{{}}\mathdef3931{parameter} &
\def\mathdef4005#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4005{(}~~\def\mathdef4006#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4006{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4007#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4007{)} &\equiv&
(\def\mathdef4008#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4008{(}~~\def\mathdef4009#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4009{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4010#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4010{)})^\ast \\
\def\mathdef3931#1{{}}\mathdef3931{result} &
\def\mathdef4011#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4011{(}~~\def\mathdef4012#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4012{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4013#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4013{)} &\equiv&
(\def\mathdef4014#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4014{(}~~\def\mathdef4015#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4015{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4016#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4016{)})^\ast \\
\end{array}\end{split}\]
Limits¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef3931#1{{}}\mathdef3931{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef3956#1{{\mathtt{u}#1}}\mathdef3956{\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\mathdef3956#1{{\mathtt{u}#1}}\mathdef3956{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3956#1{{\mathtt{u}#1}}\mathdef3956{\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\mathdef3931#1{{}}\mathdef3931{memory type} & \href{../text/types.html#text-memtype}{\mathtt{memtype}}_I &::=&
\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\mathdef3931#1{{}}\mathdef3931{table type} & \href{../text/types.html#text-tabletype}{\mathtt{tabletype}}_I &::=&
\mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}}~~\mathit{et}{:}\href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &\Rightarrow& \mathit{lim}~\mathit{et} \\
\end{array}\end{split}\]
Global Types¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef3931#1{{}}\mathdef3931{global type} & \href{../text/types.html#text-globaltype}{\mathtt{globaltype}}_I &::=&
t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{const}}~t \\ &&|&
\def\mathdef4017#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4017{(}~\def\mathdef4018#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4018{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4019#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4019{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]