Types

Number Types

\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l} \def\mathdef4343#1{{}}\mathdef4343{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=& \def\mathdef4382#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4382{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef4383#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4383{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef4384#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4384{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef4385#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4385{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\mathdef4343#1{{}}\mathdef4343{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=& \def\mathdef4386#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4386{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\mathdef4343#1{{}}\mathdef4343{abstract heap type} & \href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &::=& \def\mathdef4387#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4387{any} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{any}} \\ &&|& \def\mathdef4388#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4388{eq} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}} \\ &&|& \def\mathdef4389#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4389{i31} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{i31}} \\ &&|& \def\mathdef4390#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4390{struct} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}} \\ &&|& \def\mathdef4391#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4391{array} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{array}} \\ &&|& \def\mathdef4392#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4392{none} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{none}} \\ &&|& \def\mathdef4393#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4393{func} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{func}} \\ &&|& \def\mathdef4394#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4394{nofunc} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}} \\ &&|& \def\mathdef4395#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4395{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|& \def\mathdef4396#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4396{noexn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noexn}} \\ &&|& \def\mathdef4397#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4397{exn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{exn}} \\ &&|& \def\mathdef4398#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4398{noextern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}} \\ \def\mathdef4343#1{{}}\mathdef4343{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\mathdef4343#1{{}}\mathdef4343{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=& \def\mathdef4399#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4399{(}~\def\mathdef4400#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4400{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4401#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4401{)} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|& \def\mathdef4402#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4402{(}~\def\mathdef4403#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4403{ref}~~\def\mathdef4404#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4404{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4405#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4405{)} &\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\mathdef4343#1{{}}\mathdef4343{reference type} & \def\mathdef4406#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4406{anyref} &\equiv& \def\mathdef4407#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4407{(}~\def\mathdef4408#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4408{ref}~~\def\mathdef4409#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4409{null}~~\def\mathdef4410#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4410{any}~\def\mathdef4411#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4411{)} \\ \def\mathdef4412#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4412{eqref} &\equiv& \def\mathdef4413#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4413{(}~\def\mathdef4414#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4414{ref}~~\def\mathdef4415#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4415{null}~~\def\mathdef4416#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4416{eq}~\def\mathdef4417#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4417{)} \\ \def\mathdef4418#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4418{i31ref} &\equiv& \def\mathdef4419#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4419{(}~\def\mathdef4420#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4420{ref}~~\def\mathdef4421#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4421{null}~~\def\mathdef4422#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4422{i31}~\def\mathdef4423#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4423{)} \\ \def\mathdef4424#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4424{structref} &\equiv& \def\mathdef4425#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4425{(}~\def\mathdef4426#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4426{ref}~~\def\mathdef4427#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4427{null}~~\def\mathdef4428#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4428{struct}~\def\mathdef4429#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4429{)} \\ \def\mathdef4430#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4430{arrayref} &\equiv& \def\mathdef4431#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4431{(}~\def\mathdef4432#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4432{ref}~~\def\mathdef4433#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4433{null}~~\def\mathdef4434#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4434{array}~\def\mathdef4435#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4435{)} \\ \def\mathdef4436#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4436{nullref} &\equiv& \def\mathdef4437#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4437{(}~\def\mathdef4438#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4438{ref}~~\def\mathdef4439#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4439{null}~~\def\mathdef4440#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4440{none}~\def\mathdef4441#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4441{)} \\ \def\mathdef4442#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4442{funcref} &\equiv& \def\mathdef4443#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4443{(}~\def\mathdef4444#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4444{ref}~~\def\mathdef4445#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4445{null}~~\def\mathdef4446#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4446{func}~\def\mathdef4447#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4447{)} \\ \def\mathdef4448#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4448{nullfuncref} &\equiv& \def\mathdef4449#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4449{(}~\def\mathdef4450#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4450{ref}~~\def\mathdef4451#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4451{null}~~\def\mathdef4452#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4452{nofunc}~\def\mathdef4453#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4453{)} \\ \def\mathdef4454#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4454{exnref} &\equiv& \def\mathdef4455#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4455{(}~\def\mathdef4456#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4456{ref}~~\def\mathdef4457#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4457{null}~~\def\mathdef4458#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4458{exn}~\def\mathdef4459#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4459{)} \\ \def\mathdef4460#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4460{nullexnref} &\equiv& \def\mathdef4461#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4461{(}~\def\mathdef4462#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4462{ref}~~\def\mathdef4463#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4463{null}~~\def\mathdef4464#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4464{noexn}~\def\mathdef4465#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4465{)} \\ \def\mathdef4466#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4466{externref} &\equiv& \def\mathdef4467#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4467{(}~\def\mathdef4468#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4468{ref}~~\def\mathdef4469#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4469{null}~~\def\mathdef4470#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4470{extern}~\def\mathdef4471#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4471{)} \\ \def\mathdef4472#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4472{nullexternref} &\equiv& \def\mathdef4473#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4473{(}~\def\mathdef4474#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4474{ref}~~\def\mathdef4475#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4475{null}~~\def\mathdef4476#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4476{noextern}~\def\mathdef4477#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4477{)} \\ \end{array}\end{split}\]

Value Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef4343#1{{}}\mathdef4343{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\mathdef4343#1{{}}\mathdef4343{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=& \def\mathdef4478#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4478{(}~\def\mathdef4479#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4479{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\mathdef4480#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4480{)} &\Rightarrow& [t_1^\ast] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\ \def\mathdef4343#1{{}}\mathdef4343{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=& \def\mathdef4481#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4481{(}~\def\mathdef4482#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4482{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4483#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4483{)} &\Rightarrow& t \\ \def\mathdef4343#1{{}}\mathdef4343{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=& \def\mathdef4484#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4484{(}~\def\mathdef4485#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4485{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4486#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4486{)} &\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\mathdef4343#1{{}}\mathdef4343{parameter} & \def\mathdef4487#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4487{(}~~\def\mathdef4488#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4488{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4489#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4489{)} &\equiv& (\def\mathdef4490#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4490{(}~~\def\mathdef4491#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4491{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4492#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4492{)})^\ast \\ \def\mathdef4343#1{{}}\mathdef4343{result} & \def\mathdef4493#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4493{(}~~\def\mathdef4494#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4494{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4495#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4495{)} &\equiv& (\def\mathdef4496#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4496{(}~~\def\mathdef4497#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4497{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4498#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4498{)})^\ast \\ \end{array}\end{split}\]

Aggregate Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4343#1{{}}\mathdef4343{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=& \def\mathdef4499#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4499{(}~\def\mathdef4500#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4500{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4501#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4501{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4343#1{{}}\mathdef4343{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=& \def\mathdef4502#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4502{(}~\def\mathdef4503#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4503{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4504#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4504{)} &\Rightarrow& \mathit{ft}^\ast \\ \def\mathdef4343#1{{}}\mathdef4343{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=& \def\mathdef4505#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4505{(}~\def\mathdef4506#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4506{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4507#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4507{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4343#1{{}}\mathdef4343{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\mathdef4508#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4508{(}~\def\mathdef4509#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4509{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4510#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4510{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\ \def\mathdef4343#1{{}}\mathdef4343{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\mathdef4343#1{{}}\mathdef4343{packed type} & \href{../text/types.html#text-packedtype}{\mathtt{packedtype}} &::=& \def\mathdef4511#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4511{i8} &\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i8}} \\ &&|& \def\mathdef4512#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4512{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\mathdef4343#1{{}}\mathdef4343{field} & \def\mathdef4513#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4513{(}~~\def\mathdef4514#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4514{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4515#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4515{)} &\equiv& (\def\mathdef4516#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4516{(}~~\def\mathdef4517#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4517{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4518#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4518{)})^\ast \\ \end{array}\end{split}\]

Composite Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4343#1{{}}\mathdef4343{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\mathdef4343#1{{}}\mathdef4343{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=& \def\mathdef4519#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4519{(}~\def\mathdef4520#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4520{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4521#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4521{)} &\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\ \def\mathdef4343#1{{}}\mathdef4343{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=& \def\mathdef4522#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4522{(}~\def\mathdef4523#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4523{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4524#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4524{)} &\Rightarrow& \mathit{st} \\ \def\mathdef4343#1{{}}\mathdef4343{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=& \def\mathdef4525#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4525{(}~\def\mathdef4526#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4526{sub}~~\def\mathdef4527#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4527{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\mathdef4528#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4528{)} &\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\mathdef4529#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4529{rec}\) keyword:

\[\begin{split}\begin{array}{llclll} \def\mathdef4343#1{{}}\mathdef4343{recursive type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv& \def\mathdef4530#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4530{(}~~\def\mathdef4531#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4531{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4532#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4532{)} \\ \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\mathdef4343#1{{}}\mathdef4343{sub type} & \href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv& \def\mathdef4533#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4533{(}~~\def\mathdef4534#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4534{sub}~~\def\mathdef4535#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4535{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4536#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4536{)} \\ \end{array}\end{split}\]

Limits

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