Types¶
Number Types¶
\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=&
\def\mathdef3930#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3930{i32} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}} \\ &&|&
\def\mathdef3931#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3931{i64} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle64}} \\ &&|&
\def\mathdef3932#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3932{f32} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{f\scriptstyle32}} \\ &&|&
\def\mathdef3933#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3933{f64} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{f\scriptstyle64}} \\
\end{array}\end{split}\]
Vector Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=&
\def\mathdef3934#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3934{v128} &\Rightarrow& \href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} \\
\end{array}\end{split}\]
Heap Types¶
\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{abstract heap type} & \href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &::=&
\def\mathdef3935#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3935{any} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{any}} \\ &&|&
\def\mathdef3936#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3936{eq} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}} \\ &&|&
\def\mathdef3937#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3937{i31} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{i\scriptstyle31}} \\ &&|&
\def\mathdef3938#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3938{struct} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}} \\ &&|&
\def\mathdef3939#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3939{array} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{array}} \\ &&|&
\def\mathdef3940#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3940{none} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{none}} \\ &&|&
\def\mathdef3941#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3941{func} &\Rightarrow& \href{../syntax/modules.html#syntax-func}{\mathsf{func}} \\ &&|&
\def\mathdef3942#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3942{nofunc} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}} \\ &&|&
\def\mathdef3943#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3943{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|&
\def\mathdef3944#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3944{noexn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noexn}} \\ &&|&
\def\mathdef3945#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3945{exn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{exn}} \\ &&|&
\def\mathdef3946#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3946{noextern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}} \\
\def\mathdef3887#1{{}}\mathdef3887{heap type} & \href{../text/types.html#text-heaptype}{\mathtt{heaptype}}_I &::=&
t{:}\href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &\Rightarrow& y \\ &&|&
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\mathdef3887#1{{}}\mathdef3887{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=&
\def\mathdef3947#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3947{(}~\def\mathdef3948#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3948{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef3949#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3949{)}
&\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|&
\def\mathdef3950#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3950{(}~\def\mathdef3951#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3951{ref}~~\def\mathdef3952#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3952{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef3953#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3953{)}
&\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\mathdef3887#1{{}}\mathdef3887{reference type} &
\def\mathdef3954#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3954{anyref} &\equiv& \def\mathdef3955#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3955{(}~\def\mathdef3956#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3956{ref}~~\def\mathdef3957#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3957{null}~~\def\mathdef3958#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3958{any}~\def\mathdef3959#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3959{)} \\
\def\mathdef3960#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3960{eqref} &\equiv& \def\mathdef3961#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3961{(}~\def\mathdef3962#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3962{ref}~~\def\mathdef3963#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3963{null}~~\def\mathdef3964#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3964{eq}~\def\mathdef3965#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3965{)} \\
\def\mathdef3966#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3966{i31ref} &\equiv& \def\mathdef3967#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3967{(}~\def\mathdef3968#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3968{ref}~~\def\mathdef3969#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3969{null}~~\def\mathdef3970#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3970{i31}~\def\mathdef3971#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3971{)} \\
\def\mathdef3972#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3972{structref} &\equiv& \def\mathdef3973#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3973{(}~\def\mathdef3974#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3974{ref}~~\def\mathdef3975#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3975{null}~~\def\mathdef3976#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3976{struct}~\def\mathdef3977#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3977{)} \\
\def\mathdef3978#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3978{arrayref} &\equiv& \def\mathdef3979#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3979{(}~\def\mathdef3980#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3980{ref}~~\def\mathdef3981#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3981{null}~~\def\mathdef3982#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3982{array}~\def\mathdef3983#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3983{)} \\
\def\mathdef3984#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3984{nullref} &\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{none}~\def\mathdef3989#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3989{)} \\
\def\mathdef3990#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3990{funcref} &\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{func}~\def\mathdef3995#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3995{)} \\
\def\mathdef3996#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3996{nullfuncref} &\equiv& \def\mathdef3997#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3997{(}~\def\mathdef3998#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3998{ref}~~\def\mathdef3999#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef3999{null}~~\def\mathdef4000#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4000{nofunc}~\def\mathdef4001#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4001{)} \\
\def\mathdef4002#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4002{exnref} &\equiv& \def\mathdef4003#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4003{(}~\def\mathdef4004#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4004{ref}~~\def\mathdef4005#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4005{null}~~\def\mathdef4006#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4006{exn}~\def\mathdef4007#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4007{)} \\
\def\mathdef4008#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4008{nullexnref} &\equiv& \def\mathdef4009#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4009{(}~\def\mathdef4010#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4010{ref}~~\def\mathdef4011#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4011{null}~~\def\mathdef4012#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4012{noexn}~\def\mathdef4013#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4013{)} \\
\def\mathdef4014#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4014{externref} &\equiv& \def\mathdef4015#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4015{(}~\def\mathdef4016#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4016{ref}~~\def\mathdef4017#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4017{null}~~\def\mathdef4018#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4018{extern}~\def\mathdef4019#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4019{)} \\
\def\mathdef4020#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4020{nullexternref} &\equiv& \def\mathdef4021#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4021{(}~\def\mathdef4022#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4022{ref}~~\def\mathdef4023#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4023{null}~~\def\mathdef4024#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4024{noextern}~\def\mathdef4025#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4025{)} \\
\end{array}\end{split}\]
Value Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{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\mathdef3887#1{{}}\mathdef3887{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=&
\def\mathdef4026#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4026{(}~\def\mathdef4027#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4027{func}~~t_1^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/types.html#text-functype}{\mathtt{param}}_I)~~t_2^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/types.html#text-functype}{\mathtt{result}}_I)~\def\mathdef4028#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4028{)}
&\Rightarrow& [t_1^\ast] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\
\def\mathdef3887#1{{}}\mathdef3887{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=&
\def\mathdef4029#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4029{(}~\def\mathdef4030#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4030{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4031#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4031{)}
&\Rightarrow& t \\
\def\mathdef3887#1{{}}\mathdef3887{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=&
\def\mathdef4032#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4032{(}~\def\mathdef4033#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4033{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4034#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4034{)}
&\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\mathdef3887#1{{}}\mathdef3887{parameter} &
\def\mathdef4035#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4035{(}~~\def\mathdef4036#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4036{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4037#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4037{)} &\equiv&
(\def\mathdef4038#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4038{(}~~\def\mathdef4039#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4039{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4040#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4040{)})^\ast \\
\def\mathdef3887#1{{}}\mathdef3887{result} &
\def\mathdef4041#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4041{(}~~\def\mathdef4042#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4042{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4043#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4043{)} &\equiv&
(\def\mathdef4044#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4044{(}~~\def\mathdef4045#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4045{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4046#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4046{)})^\ast \\
\end{array}\end{split}\]
Aggregate Types¶
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=&
\def\mathdef4047#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4047{(}~\def\mathdef4048#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4048{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4049#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4049{)}
&\Rightarrow& \mathit{ft} \\
\def\mathdef3887#1{{}}\mathdef3887{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=&
\def\mathdef4050#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4050{(}~\def\mathdef4051#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4051{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4052#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4052{)}
&\Rightarrow& \mathit{ft}^\ast \\
\def\mathdef3887#1{{}}\mathdef3887{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=&
\def\mathdef4053#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4053{(}~\def\mathdef4054#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4054{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4055#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4055{)}
&\Rightarrow& \mathit{ft} \\
\def\mathdef3887#1{{}}\mathdef3887{field type} & \href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I &::=&
\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}
&\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{const}}~\mathit{st} \\ &&|&
\def\mathdef4056#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4056{(}~\def\mathdef4057#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4057{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4058#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4058{)}
&\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\
\def\mathdef3887#1{{}}\mathdef3887{storage type} & \href{../text/types.html#text-storagetype}{\mathtt{storagetype}}_I &::=&
t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I
&\Rightarrow& t \\ &&|&
t{:}\href{../text/types.html#text-packtype}{\mathtt{packtype}}
&\Rightarrow& t \\
\def\mathdef3887#1{{}}\mathdef3887{packed type} & \href{../text/types.html#text-packtype}{\mathtt{packtype}} &::=&
\def\mathdef4059#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4059{i8}
&\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i\scriptstyle8}} \\ &&|&
\def\mathdef4060#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4060{i16}
&\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i\scriptstyle16}} \\
\end{array}\end{split}\]
Abbreviations¶
Multiple anonymous structure fields may be combined into a single declaration:
\[\begin{split}\begin{array}{llclll}
\def\mathdef3887#1{{}}\mathdef3887{field} &
\def\mathdef4061#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4061{(}~~\def\mathdef4062#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4062{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4063#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4063{)} &\equiv&
(\def\mathdef4064#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4064{(}~~\def\mathdef4065#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4065{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4066#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4066{)})^\ast \\
\end{array}\end{split}\]
Composite Types¶
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{composite type} & \href{../text/types.html#text-comptype}{\mathtt{comptype}}_I &::=&
\mathit{at}{:}\href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I
&\Rightarrow& \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~\mathit{at} \\ &&|&
\mathit{st}{:}\href{../text/types.html#text-structtype}{\mathtt{structtype}}_I
&\Rightarrow& \href{../syntax/types.html#syntax-comptype}{\mathsf{struct}}~\mathit{at} \\ &&|&
\mathit{ft}{:}\href{../text/types.html#text-functype}{\mathtt{functype}}_I
&\Rightarrow& \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~\mathit{ft} \\
\end{array}\end{split}\]
Recursive Types¶
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef3887#1{{}}\mathdef3887{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=&
\def\mathdef4067#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4067{(}~\def\mathdef4068#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4068{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4069#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4069{)}
&\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\
\def\mathdef3887#1{{}}\mathdef3887{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=&
\def\mathdef4070#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4070{(}~\def\mathdef4071#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4071{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4072#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4072{)}
&\Rightarrow& \mathit{st} \\
\def\mathdef3887#1{{}}\mathdef3887{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=&
\def\mathdef4073#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4073{(}~\def\mathdef4074#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4074{sub}~~\def\mathdef4075#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4075{final}^?~~x^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/modules.html#text-typeidx}{\mathtt{typeidx}}_I)~~\mathit{ct}{:}\href{../text/types.html#text-comptype}{\mathtt{comptype}}_I~\def\mathdef4076#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4076{)}
&\Rightarrow& \href{../syntax/types.html#syntax-subtype}{\mathsf{sub}}~\href{../syntax/types.html#syntax-subtype}{\mathsf{final}}^?~x^\ast~\mathit{ct} \\
\end{array}\end{split}\]
Abbreviations¶
Singular recursive types can omit the \(\def\mathdef4077#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4077{rec}\) keyword:
\[\begin{split}\begin{array}{llclll}
\def\mathdef3887#1{{}}\mathdef3887{recursive type} &
\href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv&
\def\mathdef4078#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4078{(}~~\def\mathdef4079#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4079{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4080#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4080{)} \\
\end{array}\end{split}\]
Similarly, final sub types with no super-types can omit the \(\href{../syntax/types.html#syntax-subtype}{\mathsf{sub}}\) keyword and arguments:
\[\begin{split}\begin{array}{llclll}
\def\mathdef3887#1{{}}\mathdef3887{sub type} &
\href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv&
\def\mathdef4081#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4081{(}~~\def\mathdef4082#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4082{sub}~~\def\mathdef4083#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4083{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4084#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4084{)} \\
\end{array}\end{split}\]
Limits¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef3887#1{{}}\mathdef3887{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef3916#1{{\mathtt{u}#1}}\mathdef3916{\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\mathdef3916#1{{\mathtt{u}#1}}\mathdef3916{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef3916#1{{\mathtt{u}#1}}\mathdef3916{\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\mathdef3887#1{{}}\mathdef3887{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\mathdef3887#1{{}}\mathdef3887{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\mathdef3887#1{{}}\mathdef3887{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\mathdef4085#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4085{(}~\def\mathdef4086#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4086{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4087#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4087{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]