Types

Number Types

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

Value Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef4531#1{{}}\mathdef4531{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\mathdef4531#1{{}}\mathdef4531{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=& \def\mathdef4667#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4667{(}~\def\mathdef4668#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4668{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\mathdef4669#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4669{)} &\Rightarrow& [t_1^\ast] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\ \def\mathdef4531#1{{}}\mathdef4531{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=& \def\mathdef4670#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4670{(}~\def\mathdef4671#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4671{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4672#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4672{)} &\Rightarrow& t \\ \def\mathdef4531#1{{}}\mathdef4531{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=& \def\mathdef4673#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4673{(}~\def\mathdef4674#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4674{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4675#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4675{)} &\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\mathdef4531#1{{}}\mathdef4531{parameter} & \def\mathdef4676#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4676{(}~~\def\mathdef4677#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4677{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4678#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4678{)} &\equiv& (\def\mathdef4679#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4679{(}~~\def\mathdef4680#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4680{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4681#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4681{)})^\ast \\ \def\mathdef4531#1{{}}\mathdef4531{result} & \def\mathdef4682#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4682{(}~~\def\mathdef4683#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4683{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4684#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4684{)} &\equiv& (\def\mathdef4685#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4685{(}~~\def\mathdef4686#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4686{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4687#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4687{)})^\ast \\ \end{array}\end{split}\]

Aggregate Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4531#1{{}}\mathdef4531{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=& \def\mathdef4688#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4688{(}~\def\mathdef4689#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4689{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4690#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4690{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4531#1{{}}\mathdef4531{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=& \def\mathdef4691#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4691{(}~\def\mathdef4692#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4692{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4693#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4693{)} &\Rightarrow& \mathit{ft}^\ast \\ \def\mathdef4531#1{{}}\mathdef4531{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=& \def\mathdef4694#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4694{(}~\def\mathdef4695#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4695{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4696#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4696{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4531#1{{}}\mathdef4531{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\mathdef4697#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4697{(}~\def\mathdef4698#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4698{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4699#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4699{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\ \def\mathdef4531#1{{}}\mathdef4531{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\mathdef4531#1{{}}\mathdef4531{packed type} & \href{../text/types.html#text-packedtype}{\mathtt{packedtype}} &::=& \def\mathdef4700#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4700{i8} &\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i8}} \\ &&|& \def\mathdef4701#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4701{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\mathdef4531#1{{}}\mathdef4531{field} & \def\mathdef4702#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4702{(}~~\def\mathdef4703#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4703{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4704#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4704{)} &\equiv& (\def\mathdef4705#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4705{(}~~\def\mathdef4706#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4706{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4707#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4707{)})^\ast \\ \end{array}\end{split}\]

Composite Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4531#1{{}}\mathdef4531{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\mathdef4531#1{{}}\mathdef4531{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=& \def\mathdef4708#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4708{(}~\def\mathdef4709#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4709{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4710#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4710{)} &\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\ \def\mathdef4531#1{{}}\mathdef4531{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=& \def\mathdef4711#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4711{(}~\def\mathdef4712#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4712{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4713#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4713{)} &\Rightarrow& \mathit{st} \\ \def\mathdef4531#1{{}}\mathdef4531{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=& \def\mathdef4714#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4714{(}~\def\mathdef4715#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4715{sub}~~\def\mathdef4716#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4716{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\mathdef4717#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4717{)} &\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\mathdef4718#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4718{rec}\) keyword:

\[\begin{split}\begin{array}{llclll} \def\mathdef4531#1{{}}\mathdef4531{recursive type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv& \def\mathdef4719#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4719{(}~~\def\mathdef4720#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4720{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4721#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4721{)} \\ \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\mathdef4531#1{{}}\mathdef4531{sub type} & \href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv& \def\mathdef4722#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4722{(}~~\def\mathdef4723#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4723{sub}~~\def\mathdef4724#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4724{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4725#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4725{)} \\ \end{array}\end{split}\]

Limits

\[\begin{split}\begin{array}{llclll} \def\mathdef4531#1{{}}\mathdef4531{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=& n{:}\href{../text/values.html#text-int}{\def\mathdef4557#1{{\mathtt{u}#1}}\mathdef4557{\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\mathdef4557#1{{\mathtt{u}#1}}\mathdef4557{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef4557#1{{\mathtt{u}#1}}\mathdef4557{\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\mathdef4531#1{{}}\mathdef4531{memory type} & \href{../text/types.html#text-memtype}{\mathtt{memtype}}_I &::=& \mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}} &\Rightarrow& \mathit{lim} \\ \end{array}\end{split}\]

Table Types

\[\begin{split}\begin{array}{llclll} \def\mathdef4531#1{{}}\mathdef4531{table type} & \href{../text/types.html#text-tabletype}{\mathtt{tabletype}}_I &::=& \mathit{lim}{:}\href{../text/types.html#text-limits}{\mathtt{limits}}~~\mathit{et}{:}\href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &\Rightarrow& \mathit{lim}~\mathit{et} \\ \end{array}\end{split}\]

Global Types

\[\begin{split}\begin{array}{llclll} \def\mathdef4531#1{{}}\mathdef4531{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\mathdef4726#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4726{(}~\def\mathdef4727#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4727{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4728#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4728{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\ \end{array}\end{split}\]