Types

Number Types

\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l} \def\mathdef4516#1{{}}\mathdef4516{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=& \def\mathdef4556#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4556{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef4557#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4557{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef4558#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4558{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef4559#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4559{f64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f64}} \\ \end{array}\end{split}\]

Vector Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef4516#1{{}}\mathdef4516{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=& \def\mathdef4560#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4560{v128} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{v128}} \\ \end{array}\end{split}\]

Heap Types

\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l} \def\mathdef4516#1{{}}\mathdef4516{abstract heap type} & \href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &::=& \def\mathdef4561#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4561{any} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{any}} \\ &&|& \def\mathdef4562#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4562{eq} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}} \\ &&|& \def\mathdef4563#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4563{i31} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{i31}} \\ &&|& \def\mathdef4564#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4564{struct} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}} \\ &&|& \def\mathdef4565#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4565{array} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{array}} \\ &&|& \def\mathdef4566#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4566{none} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{none}} \\ &&|& \def\mathdef4567#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4567{func} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{func}} \\ &&|& \def\mathdef4568#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4568{nofunc} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}} \\ &&|& \def\mathdef4569#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4569{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|& \def\mathdef4570#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4570{noexn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noexn}} \\ &&|& \def\mathdef4571#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4571{exn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{exn}} \\ &&|& \def\mathdef4572#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4572{noextern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}} \\ \def\mathdef4516#1{{}}\mathdef4516{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\mathdef4516#1{{}}\mathdef4516{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=& \def\mathdef4573#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4573{(}~\def\mathdef4574#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4574{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4575#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4575{)} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|& \def\mathdef4576#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4576{(}~\def\mathdef4577#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4577{ref}~~\def\mathdef4578#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4578{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4579#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4579{)} &\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\mathdef4516#1{{}}\mathdef4516{reference type} & \def\mathdef4580#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4580{anyref} &\equiv& \def\mathdef4581#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4581{(}~\def\mathdef4582#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4582{ref}~~\def\mathdef4583#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4583{null}~~\def\mathdef4584#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4584{any}~\def\mathdef4585#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4585{)} \\ \def\mathdef4586#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4586{eqref} &\equiv& \def\mathdef4587#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4587{(}~\def\mathdef4588#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4588{ref}~~\def\mathdef4589#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4589{null}~~\def\mathdef4590#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4590{eq}~\def\mathdef4591#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4591{)} \\ \def\mathdef4592#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4592{i31ref} &\equiv& \def\mathdef4593#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4593{(}~\def\mathdef4594#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4594{ref}~~\def\mathdef4595#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4595{null}~~\def\mathdef4596#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4596{i31}~\def\mathdef4597#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4597{)} \\ \def\mathdef4598#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4598{structref} &\equiv& \def\mathdef4599#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4599{(}~\def\mathdef4600#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4600{ref}~~\def\mathdef4601#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4601{null}~~\def\mathdef4602#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4602{struct}~\def\mathdef4603#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4603{)} \\ \def\mathdef4604#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4604{arrayref} &\equiv& \def\mathdef4605#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4605{(}~\def\mathdef4606#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4606{ref}~~\def\mathdef4607#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4607{null}~~\def\mathdef4608#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4608{array}~\def\mathdef4609#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4609{)} \\ \def\mathdef4610#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4610{nullref} &\equiv& \def\mathdef4611#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4611{(}~\def\mathdef4612#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4612{ref}~~\def\mathdef4613#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4613{null}~~\def\mathdef4614#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4614{none}~\def\mathdef4615#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4615{)} \\ \def\mathdef4616#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4616{funcref} &\equiv& \def\mathdef4617#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4617{(}~\def\mathdef4618#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4618{ref}~~\def\mathdef4619#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4619{null}~~\def\mathdef4620#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4620{func}~\def\mathdef4621#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4621{)} \\ \def\mathdef4622#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4622{nullfuncref} &\equiv& \def\mathdef4623#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4623{(}~\def\mathdef4624#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4624{ref}~~\def\mathdef4625#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4625{null}~~\def\mathdef4626#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4626{nofunc}~\def\mathdef4627#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4627{)} \\ \def\mathdef4628#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4628{exnref} &\equiv& \def\mathdef4629#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4629{(}~\def\mathdef4630#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4630{ref}~~\def\mathdef4631#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4631{null}~~\def\mathdef4632#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4632{exn}~\def\mathdef4633#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4633{)} \\ \def\mathdef4634#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4634{nullexnref} &\equiv& \def\mathdef4635#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4635{(}~\def\mathdef4636#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4636{ref}~~\def\mathdef4637#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4637{null}~~\def\mathdef4638#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4638{noexn}~\def\mathdef4639#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4639{)} \\ \def\mathdef4640#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4640{externref} &\equiv& \def\mathdef4641#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4641{(}~\def\mathdef4642#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4642{ref}~~\def\mathdef4643#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4643{null}~~\def\mathdef4644#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4644{extern}~\def\mathdef4645#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4645{)} \\ \def\mathdef4646#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4646{nullexternref} &\equiv& \def\mathdef4647#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4647{(}~\def\mathdef4648#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4648{ref}~~\def\mathdef4649#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4649{null}~~\def\mathdef4650#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4650{noextern}~\def\mathdef4651#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4651{)} \\ \end{array}\end{split}\]

Value Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef4516#1{{}}\mathdef4516{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\mathdef4516#1{{}}\mathdef4516{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=& \def\mathdef4652#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4652{(}~\def\mathdef4653#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4653{func}~~t_1^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-functype}{\mathtt{param}}_I)~~t_2^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-functype}{\mathtt{result}}_I)~\def\mathdef4654#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4654{)} &\Rightarrow& [t_1^\ast] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\ \def\mathdef4516#1{{}}\mathdef4516{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=& \def\mathdef4655#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4655{(}~\def\mathdef4656#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4656{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4657#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4657{)} &\Rightarrow& t \\ \def\mathdef4516#1{{}}\mathdef4516{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=& \def\mathdef4658#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4658{(}~\def\mathdef4659#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4659{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4660#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4660{)} &\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\mathdef4516#1{{}}\mathdef4516{parameter} & \def\mathdef4661#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4661{(}~~\def\mathdef4662#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4662{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4663#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4663{)} &\equiv& (\def\mathdef4664#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4664{(}~~\def\mathdef4665#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4665{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4666#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4666{)})^\ast \\ \def\mathdef4516#1{{}}\mathdef4516{result} & \def\mathdef4667#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4667{(}~~\def\mathdef4668#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4668{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4669#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4669{)} &\equiv& (\def\mathdef4670#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4670{(}~~\def\mathdef4671#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4671{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4672#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4672{)})^\ast \\ \end{array}\end{split}\]

Aggregate Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4516#1{{}}\mathdef4516{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=& \def\mathdef4673#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4673{(}~\def\mathdef4674#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4674{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4675#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4675{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4516#1{{}}\mathdef4516{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=& \def\mathdef4676#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4676{(}~\def\mathdef4677#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4677{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4678#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4678{)} &\Rightarrow& \mathit{ft}^\ast \\ \def\mathdef4516#1{{}}\mathdef4516{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=& \def\mathdef4679#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4679{(}~\def\mathdef4680#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4680{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4681#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4681{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4516#1{{}}\mathdef4516{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\mathdef4682#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4682{(}~\def\mathdef4683#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4683{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4684#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4684{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\ \def\mathdef4516#1{{}}\mathdef4516{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-packedtype}{\mathtt{packedtype}} &\Rightarrow& t \\ \def\mathdef4516#1{{}}\mathdef4516{packed type} & \href{../text/types.html#text-packedtype}{\mathtt{packedtype}} &::=& \def\mathdef4685#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4685{i8} &\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i8}} \\ &&|& \def\mathdef4686#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4686{i16} &\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i16}} \\ \end{array}\end{split}\]

Abbreviations

Multiple anonymous structure fields may be combined into a single declaration:

\[\begin{split}\begin{array}{llclll} \def\mathdef4516#1{{}}\mathdef4516{field} & \def\mathdef4687#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4687{(}~~\def\mathdef4688#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4688{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4689#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4689{)} &\equiv& (\def\mathdef4690#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4690{(}~~\def\mathdef4691#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4691{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4692#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4692{)})^\ast \\ \end{array}\end{split}\]

Composite Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4516#1{{}}\mathdef4516{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\mathdef4516#1{{}}\mathdef4516{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=& \def\mathdef4693#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4693{(}~\def\mathdef4694#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4694{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4695#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4695{)} &\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\ \def\mathdef4516#1{{}}\mathdef4516{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=& \def\mathdef4696#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4696{(}~\def\mathdef4697#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4697{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4698#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4698{)} &\Rightarrow& \mathit{st} \\ \def\mathdef4516#1{{}}\mathdef4516{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=& \def\mathdef4699#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4699{(}~\def\mathdef4700#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4700{sub}~~\def\mathdef4701#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4701{final}^?~~x^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/modules.html#text-typeidx}{\mathtt{typeidx}}_I)~~\mathit{ct}{:}\href{../text/types.html#text-comptype}{\mathtt{comptype}}_I~\def\mathdef4702#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4702{)} &\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\mathdef4703#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4703{rec}\) keyword:

\[\begin{split}\begin{array}{llclll} \def\mathdef4516#1{{}}\mathdef4516{recursive type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv& \def\mathdef4704#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4704{(}~~\def\mathdef4705#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4705{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4706#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4706{)} \\ \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\mathdef4516#1{{}}\mathdef4516{sub type} & \href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv& \def\mathdef4707#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4707{(}~~\def\mathdef4708#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4708{sub}~~\def\mathdef4709#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4709{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4710#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4710{)} \\ \end{array}\end{split}\]

Address Types

\[\begin{split}\begin{array}{llclll} \def\mathdef4516#1{{}}\mathdef4516{address type} & \href{../text/types.html#text-addrtype}{\mathtt{addrtype}} &::=& \def\mathdef4711#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4711{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef4712#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4712{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ \end{array}\end{split}\]

Abbreviations

The address type can be omited, in which case it defaults \(\href{../syntax/types.html#syntax-valtype}{\mathsf{i32}}\):

\[\begin{array}{llclll} \def\mathdef4516#1{{}}\mathdef4516{address type} & \def\mathdef4713#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4713{} &\equiv& \def\mathdef4714#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4714{i32} \end{array}\]

Limits

\[\begin{split}\begin{array}{llclll} \def\mathdef4516#1{{}}\mathdef4516{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=& n{:}\href{../text/values.html#text-int}{\def\mathdef4542#1{{\mathtt{u}#1}}\mathdef4542{\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\mathdef4542#1{{\mathtt{u}#1}}\mathdef4542{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef4542#1{{\mathtt{u}#1}}\mathdef4542{\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\mathdef4516#1{{}}\mathdef4516{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\mathdef4516#1{{}}\mathdef4516{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\mathdef4516#1{{}}\mathdef4516{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\mathdef4715#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4715{(}~\def\mathdef4716#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4716{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4717#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4717{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\ \end{array}\end{split}\]