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