Types
Number Types
\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l}
\def\mathdef4083#1{{}}\mathdef4083{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=&
\def\mathdef4127#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4127{i32} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}} \\ &&|&
\def\mathdef4128#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4128{i64} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle64}} \\ &&|&
\def\mathdef4129#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4129{f32} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{f\scriptstyle32}} \\ &&|&
\def\mathdef4130#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4130{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\mathdef4083#1{{}}\mathdef4083{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=&
\def\mathdef4131#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4131{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\mathdef4083#1{{}}\mathdef4083{abstract heap type} & \href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &::=&
\def\mathdef4132#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4132{any} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{any}} \\ &&|&
\def\mathdef4133#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4133{eq} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}} \\ &&|&
\def\mathdef4134#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4134{i31} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{i\scriptstyle31}} \\ &&|&
\def\mathdef4135#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4135{struct} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}} \\ &&|&
\def\mathdef4136#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4136{array} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{array}} \\ &&|&
\def\mathdef4137#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4137{none} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{none}} \\ &&|&
\def\mathdef4138#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4138{func} &\Rightarrow& \href{../syntax/modules.html#syntax-func}{\mathsf{func}} \\ &&|&
\def\mathdef4139#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4139{nofunc} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}} \\ &&|&
\def\mathdef4140#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4140{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|&
\def\mathdef4141#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4141{noexn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noexn}} \\ &&|&
\def\mathdef4142#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4142{exn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{exn}} \\ &&|&
\def\mathdef4143#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4143{noextern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}} \\
\def\mathdef4083#1{{}}\mathdef4083{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\mathdef4083#1{{}}\mathdef4083{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=&
\def\mathdef4144#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4144{(}~\def\mathdef4145#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4145{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4146#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4146{)}
&\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|&
\def\mathdef4147#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4147{(}~\def\mathdef4148#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4148{ref}~~\def\mathdef4149#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4149{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4150#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4150{)}
&\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\mathdef4083#1{{}}\mathdef4083{reference type} &
\def\mathdef4151#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4151{anyref} &\equiv& \def\mathdef4152#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4152{(}~\def\mathdef4153#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4153{ref}~~\def\mathdef4154#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4154{null}~~\def\mathdef4155#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4155{any}~\def\mathdef4156#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4156{)} \\
\def\mathdef4157#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4157{eqref} &\equiv& \def\mathdef4158#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4158{(}~\def\mathdef4159#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4159{ref}~~\def\mathdef4160#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4160{null}~~\def\mathdef4161#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4161{eq}~\def\mathdef4162#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4162{)} \\
\def\mathdef4163#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4163{i31ref} &\equiv& \def\mathdef4164#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4164{(}~\def\mathdef4165#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4165{ref}~~\def\mathdef4166#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4166{null}~~\def\mathdef4167#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4167{i31}~\def\mathdef4168#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4168{)} \\
\def\mathdef4169#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4169{structref} &\equiv& \def\mathdef4170#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4170{(}~\def\mathdef4171#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4171{ref}~~\def\mathdef4172#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4172{null}~~\def\mathdef4173#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4173{struct}~\def\mathdef4174#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4174{)} \\
\def\mathdef4175#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4175{arrayref} &\equiv& \def\mathdef4176#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4176{(}~\def\mathdef4177#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4177{ref}~~\def\mathdef4178#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4178{null}~~\def\mathdef4179#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4179{array}~\def\mathdef4180#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4180{)} \\
\def\mathdef4181#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4181{nullref} &\equiv& \def\mathdef4182#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4182{(}~\def\mathdef4183#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4183{ref}~~\def\mathdef4184#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4184{null}~~\def\mathdef4185#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4185{none}~\def\mathdef4186#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4186{)} \\
\def\mathdef4187#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4187{funcref} &\equiv& \def\mathdef4188#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4188{(}~\def\mathdef4189#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4189{ref}~~\def\mathdef4190#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4190{null}~~\def\mathdef4191#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4191{func}~\def\mathdef4192#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4192{)} \\
\def\mathdef4193#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4193{nullfuncref} &\equiv& \def\mathdef4194#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4194{(}~\def\mathdef4195#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4195{ref}~~\def\mathdef4196#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4196{null}~~\def\mathdef4197#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4197{nofunc}~\def\mathdef4198#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4198{)} \\
\def\mathdef4199#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4199{exnref} &\equiv& \def\mathdef4200#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4200{(}~\def\mathdef4201#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4201{ref}~~\def\mathdef4202#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4202{null}~~\def\mathdef4203#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4203{exn}~\def\mathdef4204#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4204{)} \\
\def\mathdef4205#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4205{nullexnref} &\equiv& \def\mathdef4206#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4206{(}~\def\mathdef4207#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4207{ref}~~\def\mathdef4208#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4208{null}~~\def\mathdef4209#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4209{noexn}~\def\mathdef4210#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4210{)} \\
\def\mathdef4211#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4211{externref} &\equiv& \def\mathdef4212#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4212{(}~\def\mathdef4213#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4213{ref}~~\def\mathdef4214#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4214{null}~~\def\mathdef4215#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4215{extern}~\def\mathdef4216#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4216{)} \\
\def\mathdef4217#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4217{nullexternref} &\equiv& \def\mathdef4218#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4218{(}~\def\mathdef4219#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4219{ref}~~\def\mathdef4220#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4220{null}~~\def\mathdef4221#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4221{noextern}~\def\mathdef4222#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4222{)} \\
\end{array}\end{split}\]
Value Types
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef4083#1{{}}\mathdef4083{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\mathdef4083#1{{}}\mathdef4083{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=&
\def\mathdef4223#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4223{(}~\def\mathdef4224#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4224{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\mathdef4225#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4225{)}
&\Rightarrow& [t_1^\ast] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\
\def\mathdef4083#1{{}}\mathdef4083{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=&
\def\mathdef4226#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4226{(}~\def\mathdef4227#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4227{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4228#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4228{)}
&\Rightarrow& t \\
\def\mathdef4083#1{{}}\mathdef4083{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=&
\def\mathdef4229#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4229{(}~\def\mathdef4230#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4230{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4231#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4231{)}
&\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\mathdef4083#1{{}}\mathdef4083{parameter} &
\def\mathdef4232#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4232{(}~~\def\mathdef4233#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4233{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4234#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4234{)} &\equiv&
(\def\mathdef4235#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4235{(}~~\def\mathdef4236#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4236{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4237#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4237{)})^\ast \\
\def\mathdef4083#1{{}}\mathdef4083{result} &
\def\mathdef4238#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4238{(}~~\def\mathdef4239#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4239{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4240#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4240{)} &\equiv&
(\def\mathdef4241#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4241{(}~~\def\mathdef4242#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4242{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4243#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4243{)})^\ast \\
\end{array}\end{split}\]
Aggregate Types
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef4083#1{{}}\mathdef4083{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=&
\def\mathdef4244#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4244{(}~\def\mathdef4245#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4245{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4246#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4246{)}
&\Rightarrow& \mathit{ft} \\
\def\mathdef4083#1{{}}\mathdef4083{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=&
\def\mathdef4247#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4247{(}~\def\mathdef4248#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4248{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4249#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4249{)}
&\Rightarrow& \mathit{ft}^\ast \\
\def\mathdef4083#1{{}}\mathdef4083{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=&
\def\mathdef4250#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4250{(}~\def\mathdef4251#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4251{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4252#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4252{)}
&\Rightarrow& \mathit{ft} \\
\def\mathdef4083#1{{}}\mathdef4083{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\mathdef4253#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4253{(}~\def\mathdef4254#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4254{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4255#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4255{)}
&\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\
\def\mathdef4083#1{{}}\mathdef4083{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\mathdef4083#1{{}}\mathdef4083{packed type} & \href{../text/types.html#text-packtype}{\mathtt{packtype}} &::=&
\def\mathdef4256#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4256{i8}
&\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i\scriptstyle8}} \\ &&|&
\def\mathdef4257#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4257{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\mathdef4083#1{{}}\mathdef4083{field} &
\def\mathdef4258#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4258{(}~~\def\mathdef4259#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4259{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4260#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4260{)} &\equiv&
(\def\mathdef4261#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4261{(}~~\def\mathdef4262#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4262{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4263#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4263{)})^\ast \\
\end{array}\end{split}\]
Composite Types
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef4083#1{{}}\mathdef4083{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\mathdef4083#1{{}}\mathdef4083{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=&
\def\mathdef4264#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4264{(}~\def\mathdef4265#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4265{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-list}{\mathtt{list}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4266#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4266{)}
&\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\
\def\mathdef4083#1{{}}\mathdef4083{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=&
\def\mathdef4267#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4267{(}~\def\mathdef4268#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4268{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4269#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4269{)}
&\Rightarrow& \mathit{st} \\
\def\mathdef4083#1{{}}\mathdef4083{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=&
\def\mathdef4270#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4270{(}~\def\mathdef4271#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4271{sub}~~\def\mathdef4272#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4272{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\mathdef4273#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4273{)}
&\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\mathdef4274#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4274{rec}\) keyword:
\[\begin{split}\begin{array}{llclll}
\def\mathdef4083#1{{}}\mathdef4083{recursive type} &
\href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv&
\def\mathdef4275#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4275{(}~~\def\mathdef4276#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4276{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4277#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4277{)} \\
\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\mathdef4083#1{{}}\mathdef4083{sub type} &
\href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv&
\def\mathdef4278#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4278{(}~~\def\mathdef4279#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4279{sub}~~\def\mathdef4280#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4280{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4281#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4281{)} \\
\end{array}\end{split}\]
Address Types
\[\begin{split}\begin{array}{llclll}
\def\mathdef4083#1{{}}\mathdef4083{address type} & \href{../text/types.html#text-addrtype}{\mathtt{addrtype}} &::=&
\def\mathdef4282#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4282{i32} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}} \\ &&|&
\def\mathdef4283#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4283{i64} &\Rightarrow& \href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle64}} \\
\end{array}\end{split}\]
Abbreviations
The address type can be omitted, in which case it defaults \(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}\):
\[\begin{array}{llclll}
\def\mathdef4083#1{{}}\mathdef4083{address type} &
\def\mathdef4284#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4284{} &\equiv& \def\mathdef4285#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4285{i32}
\end{array}\]
Limits
\[\begin{split}\begin{array}{llclll}
\def\mathdef4083#1{{}}\mathdef4083{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef4114#1{{\mathtt{u}#1}}\mathdef4114{\mathtt{64}}} &\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\mathdef4114#1{{\mathtt{u}#1}}\mathdef4114{\mathtt{64}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef4114#1{{\mathtt{u}#1}}\mathdef4114{\mathtt{64}}} &\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\mathdef4083#1{{}}\mathdef4083{memory type} & \href{../text/types.html#text-memtype}{\mathtt{memtype}}_I &::=&
\mathit{at}{:}\href{../text/types.html#text-addrtype}{\mathtt{addrtype}}~~\mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}} &\Rightarrow& \mathit{at}~\mathit{lim} \\
\end{array}\end{split}\]
Table Types
\[\begin{split}\begin{array}{llclll}
\def\mathdef4083#1{{}}\mathdef4083{table type} & \href{../text/types.html#text-tabletype}{\mathtt{tabletype}}_I &::=&
\mathit{at}{:}\href{../text/types.html#text-addrtype}{\mathtt{addrtype}}~~\mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}}~~\mathit{et}{:}\href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &\Rightarrow& \mathit{at}~\mathit{lim}~\mathit{et} \\
\end{array}\end{split}\]
Global Types
\[\begin{split}\begin{array}{llclll}
\def\mathdef4083#1{{}}\mathdef4083{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\mathdef4286#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4286{(}~\def\mathdef4287#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4287{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4288#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4288{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]