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