Types

Number Types

\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l} \def\mathdef4160#1{{}}\mathdef4160{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=& \def\mathdef4199#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4199{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|& \def\mathdef4200#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4200{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|& \def\mathdef4201#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4201{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|& \def\mathdef4202#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4202{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\mathdef4160#1{{}}\mathdef4160{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=& \def\mathdef4203#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4203{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\mathdef4160#1{{}}\mathdef4160{abstract heap type} & \href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &::=& \def\mathdef4204#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4204{any} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{any}} \\ &&|& \def\mathdef4205#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4205{eq} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}} \\ &&|& \def\mathdef4206#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4206{i31} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{i31}} \\ &&|& \def\mathdef4207#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4207{struct} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}} \\ &&|& \def\mathdef4208#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4208{array} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{array}} \\ &&|& \def\mathdef4209#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4209{none} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{none}} \\ &&|& \def\mathdef4210#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4210{func} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{func}} \\ &&|& \def\mathdef4211#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4211{nofunc} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}} \\ &&|& \def\mathdef4212#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4212{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|& \def\mathdef4213#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4213{noextern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}} \\ \def\mathdef4160#1{{}}\mathdef4160{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\mathdef4160#1{{}}\mathdef4160{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=& \def\mathdef4214#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4214{(}~\def\mathdef4215#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4215{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4216#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4216{)} &\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|& \def\mathdef4217#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4217{(}~\def\mathdef4218#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4218{ref}~~\def\mathdef4219#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4219{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4220#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4220{)} &\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\mathdef4160#1{{}}\mathdef4160{reference type} & \def\mathdef4221#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4221{anyref} &\equiv& \def\mathdef4222#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4222{(}~\def\mathdef4223#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4223{ref}~~\def\mathdef4224#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4224{null}~~\def\mathdef4225#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4225{any}~\def\mathdef4226#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4226{)} \\ \def\mathdef4227#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4227{eqref} &\equiv& \def\mathdef4228#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4228{(}~\def\mathdef4229#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4229{ref}~~\def\mathdef4230#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4230{null}~~\def\mathdef4231#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4231{eq}~\def\mathdef4232#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4232{)} \\ \def\mathdef4233#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4233{i31ref} &\equiv& \def\mathdef4234#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4234{(}~\def\mathdef4235#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4235{ref}~~\def\mathdef4236#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4236{null}~~\def\mathdef4237#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4237{i31}~\def\mathdef4238#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4238{)} \\ \def\mathdef4239#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4239{structref} &\equiv& \def\mathdef4240#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4240{(}~\def\mathdef4241#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4241{ref}~~\def\mathdef4242#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4242{null}~~\def\mathdef4243#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4243{struct}~\def\mathdef4244#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4244{)} \\ \def\mathdef4245#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4245{arrayref} &\equiv& \def\mathdef4246#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4246{(}~\def\mathdef4247#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4247{ref}~~\def\mathdef4248#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4248{null}~~\def\mathdef4249#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4249{array}~\def\mathdef4250#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4250{)} \\ \def\mathdef4251#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4251{nullref} &\equiv& \def\mathdef4252#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4252{(}~\def\mathdef4253#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4253{ref}~~\def\mathdef4254#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4254{null}~~\def\mathdef4255#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4255{none}~\def\mathdef4256#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4256{)} \\ \def\mathdef4257#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4257{funcref} &\equiv& \def\mathdef4258#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4258{(}~\def\mathdef4259#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4259{ref}~~\def\mathdef4260#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4260{null}~~\def\mathdef4261#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4261{func}~\def\mathdef4262#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4262{)} \\ \def\mathdef4263#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4263{nullfuncref} &\equiv& \def\mathdef4264#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4264{(}~\def\mathdef4265#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4265{ref}~~\def\mathdef4266#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4266{null}~~\def\mathdef4267#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4267{nofunc}~\def\mathdef4268#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4268{)} \\ \def\mathdef4269#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4269{externref} &\equiv& \def\mathdef4270#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4270{(}~\def\mathdef4271#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4271{ref}~~\def\mathdef4272#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4272{null}~~\def\mathdef4273#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4273{extern}~\def\mathdef4274#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4274{)} \\ \def\mathdef4275#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4275{nullexternref} &\equiv& \def\mathdef4276#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4276{(}~\def\mathdef4277#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4277{ref}~~\def\mathdef4278#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4278{null}~~\def\mathdef4279#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4279{noextern}~\def\mathdef4280#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4280{)} \\ \end{array}\end{split}\]

Value Types

\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l} \def\mathdef4160#1{{}}\mathdef4160{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\mathdef4160#1{{}}\mathdef4160{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=& \def\mathdef4281#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4281{(}~\def\mathdef4282#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4282{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\mathdef4283#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4283{)} &\Rightarrow& [t_1^\ast] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\ \def\mathdef4160#1{{}}\mathdef4160{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=& \def\mathdef4284#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4284{(}~\def\mathdef4285#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4285{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4286#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4286{)} &\Rightarrow& t \\ \def\mathdef4160#1{{}}\mathdef4160{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=& \def\mathdef4287#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4287{(}~\def\mathdef4288#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4288{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4289#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4289{)} &\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\mathdef4160#1{{}}\mathdef4160{parameter} & \def\mathdef4290#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4290{(}~~\def\mathdef4291#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4291{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4292#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4292{)} &\equiv& (\def\mathdef4293#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4293{(}~~\def\mathdef4294#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4294{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4295#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4295{)})^\ast \\ \def\mathdef4160#1{{}}\mathdef4160{result} & \def\mathdef4296#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4296{(}~~\def\mathdef4297#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4297{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4298#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4298{)} &\equiv& (\def\mathdef4299#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4299{(}~~\def\mathdef4300#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4300{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4301#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4301{)})^\ast \\ \end{array}\end{split}\]

Aggregate Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4160#1{{}}\mathdef4160{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=& \def\mathdef4302#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4302{(}~\def\mathdef4303#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4303{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4304#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4304{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4160#1{{}}\mathdef4160{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=& \def\mathdef4305#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4305{(}~\def\mathdef4306#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4306{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4307#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4307{)} &\Rightarrow& \mathit{ft}^\ast \\ \def\mathdef4160#1{{}}\mathdef4160{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=& \def\mathdef4308#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4308{(}~\def\mathdef4309#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4309{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4310#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4310{)} &\Rightarrow& \mathit{ft} \\ \def\mathdef4160#1{{}}\mathdef4160{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\mathdef4311#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4311{(}~\def\mathdef4312#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4312{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4313#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4313{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\ \def\mathdef4160#1{{}}\mathdef4160{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\mathdef4160#1{{}}\mathdef4160{packed type} & \href{../text/types.html#text-packedtype}{\mathtt{packedtype}} &::=& \def\mathdef4314#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4314{i8} &\Rightarrow& \href{../syntax/types.html#syntax-storagetype}{\mathsf{i8}} \\ &&|& \def\mathdef4315#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4315{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\mathdef4160#1{{}}\mathdef4160{field} & \def\mathdef4316#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4316{(}~~\def\mathdef4317#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4317{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4318#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4318{)} &\equiv& (\def\mathdef4319#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4319{(}~~\def\mathdef4320#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4320{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4321#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4321{)})^\ast \\ \end{array}\end{split}\]

Composite Types

\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l} \def\mathdef4160#1{{}}\mathdef4160{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\mathdef4160#1{{}}\mathdef4160{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=& \def\mathdef4322#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4322{(}~\def\mathdef4323#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4323{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4324#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4324{)} &\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\ \def\mathdef4160#1{{}}\mathdef4160{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=& \def\mathdef4325#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4325{(}~\def\mathdef4326#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4326{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4327#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4327{)} &\Rightarrow& \mathit{st} \\ \def\mathdef4160#1{{}}\mathdef4160{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=& \def\mathdef4328#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4328{(}~\def\mathdef4329#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4329{sub}~~\def\mathdef4330#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4330{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\mathdef4331#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4331{)} &\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\mathdef4332#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4332{rec}\) keyword:

\[\begin{split}\begin{array}{llclll} \def\mathdef4160#1{{}}\mathdef4160{recursive type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv& \def\mathdef4333#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4333{(}~~\def\mathdef4334#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4334{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4335#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4335{)} \\ \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\mathdef4160#1{{}}\mathdef4160{sub type} & \href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv& \def\mathdef4336#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4336{(}~~\def\mathdef4337#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4337{sub}~~\def\mathdef4338#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4338{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4339#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4339{)} \\ \end{array}\end{split}\]

Limits

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