Types¶
Number Types¶
\[\begin{split}\begin{array}{llrll@{\qquad\qquad}l}
\def\mathdef4298#1{{}}\mathdef4298{number type} & \href{../text/types.html#text-numtype}{\mathtt{numtype}}_I &::=&
\def\mathdef4337#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4337{i32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}} \\ &&|&
\def\mathdef4338#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4338{i64} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}} \\ &&|&
\def\mathdef4339#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4339{f32} &\Rightarrow& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}} \\ &&|&
\def\mathdef4340#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4340{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\mathdef4298#1{{}}\mathdef4298{vector type} & \href{../text/types.html#text-vectype}{\mathtt{vectype}}_I &::=&
\def\mathdef4341#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4341{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\mathdef4298#1{{}}\mathdef4298{abstract heap type} & \href{../text/types.html#text-absheaptype}{\mathtt{absheaptype}} &::=&
\def\mathdef4342#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4342{any} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{any}} \\ &&|&
\def\mathdef4343#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4343{eq} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}} \\ &&|&
\def\mathdef4344#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4344{i31} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{i31}} \\ &&|&
\def\mathdef4345#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4345{struct} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}} \\ &&|&
\def\mathdef4346#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4346{array} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{array}} \\ &&|&
\def\mathdef4347#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4347{none} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{none}} \\ &&|&
\def\mathdef4348#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4348{func} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{func}} \\ &&|&
\def\mathdef4349#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4349{nofunc} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}} \\ &&|&
\def\mathdef4350#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4350{extern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}} \\ &&|&
\def\mathdef4351#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4351{noexn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noexn}} \\ &&|&
\def\mathdef4352#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4352{exn} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{exn}} \\ &&|&
\def\mathdef4353#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4353{noextern} &\Rightarrow& \href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}} \\
\def\mathdef4298#1{{}}\mathdef4298{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\mathdef4298#1{{}}\mathdef4298{reference type} & \href{../text/types.html#text-reftype}{\mathtt{reftype}}_I &::=&
\def\mathdef4354#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4354{(}~\def\mathdef4355#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4355{ref}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4356#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4356{)}
&\Rightarrow& \href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\mathit{ht} \\ &&|&
\def\mathdef4357#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4357{(}~\def\mathdef4358#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4358{ref}~~\def\mathdef4359#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4359{null}~~\mathit{ht}{:}\href{../text/types.html#text-heaptype}{\mathtt{heaptype}}~\def\mathdef4360#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4360{)}
&\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\mathdef4298#1{{}}\mathdef4298{reference type} &
\def\mathdef4361#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4361{anyref} &\equiv& \def\mathdef4362#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4362{(}~\def\mathdef4363#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4363{ref}~~\def\mathdef4364#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4364{null}~~\def\mathdef4365#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4365{any}~\def\mathdef4366#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4366{)} \\
\def\mathdef4367#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4367{eqref} &\equiv& \def\mathdef4368#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4368{(}~\def\mathdef4369#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4369{ref}~~\def\mathdef4370#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4370{null}~~\def\mathdef4371#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4371{eq}~\def\mathdef4372#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4372{)} \\
\def\mathdef4373#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4373{i31ref} &\equiv& \def\mathdef4374#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4374{(}~\def\mathdef4375#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4375{ref}~~\def\mathdef4376#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4376{null}~~\def\mathdef4377#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4377{i31}~\def\mathdef4378#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4378{)} \\
\def\mathdef4379#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4379{structref} &\equiv& \def\mathdef4380#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4380{(}~\def\mathdef4381#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4381{ref}~~\def\mathdef4382#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4382{null}~~\def\mathdef4383#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4383{struct}~\def\mathdef4384#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4384{)} \\
\def\mathdef4385#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4385{arrayref} &\equiv& \def\mathdef4386#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4386{(}~\def\mathdef4387#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4387{ref}~~\def\mathdef4388#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4388{null}~~\def\mathdef4389#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4389{array}~\def\mathdef4390#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4390{)} \\
\def\mathdef4391#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4391{nullref} &\equiv& \def\mathdef4392#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4392{(}~\def\mathdef4393#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4393{ref}~~\def\mathdef4394#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4394{null}~~\def\mathdef4395#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4395{none}~\def\mathdef4396#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4396{)} \\
\def\mathdef4397#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4397{funcref} &\equiv& \def\mathdef4398#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4398{(}~\def\mathdef4399#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4399{ref}~~\def\mathdef4400#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4400{null}~~\def\mathdef4401#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4401{func}~\def\mathdef4402#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4402{)} \\
\def\mathdef4403#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4403{nullfuncref} &\equiv& \def\mathdef4404#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4404{(}~\def\mathdef4405#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4405{ref}~~\def\mathdef4406#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4406{null}~~\def\mathdef4407#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4407{nofunc}~\def\mathdef4408#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4408{)} \\
\def\mathdef4409#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4409{exnref} &\equiv& \def\mathdef4410#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4410{(}~\def\mathdef4411#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4411{ref}~~\def\mathdef4412#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4412{null}~~\def\mathdef4413#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4413{exn}~\def\mathdef4414#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4414{)} \\
\def\mathdef4415#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4415{nullexnref} &\equiv& \def\mathdef4416#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4416{(}~\def\mathdef4417#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4417{ref}~~\def\mathdef4418#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4418{null}~~\def\mathdef4419#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4419{noexn}~\def\mathdef4420#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4420{)} \\
\def\mathdef4421#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4421{externref} &\equiv& \def\mathdef4422#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4422{(}~\def\mathdef4423#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4423{ref}~~\def\mathdef4424#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4424{null}~~\def\mathdef4425#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4425{extern}~\def\mathdef4426#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4426{)} \\
\def\mathdef4427#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4427{nullexternref} &\equiv& \def\mathdef4428#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4428{(}~\def\mathdef4429#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4429{ref}~~\def\mathdef4430#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4430{null}~~\def\mathdef4431#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4431{noextern}~\def\mathdef4432#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4432{)} \\
\end{array}\end{split}\]
Value Types¶
\[\begin{split}\begin{array}{llcll@{\qquad\qquad}l}
\def\mathdef4298#1{{}}\mathdef4298{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\mathdef4298#1{{}}\mathdef4298{function type} & \href{../text/types.html#text-functype}{\mathtt{functype}}_I &::=&
\def\mathdef4433#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4433{(}~\def\mathdef4434#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4434{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\mathdef4435#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4435{)}
&\Rightarrow& [t_1^\ast] \mathrel{\href{../syntax/types.html#syntax-instrtype}{\rightarrow}} [t_2^\ast] \\
\def\mathdef4298#1{{}}\mathdef4298{parameter} & \href{../text/types.html#text-functype}{\mathtt{param}}_I &::=&
\def\mathdef4436#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4436{(}~\def\mathdef4437#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4437{param}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4438#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4438{)}
&\Rightarrow& t \\
\def\mathdef4298#1{{}}\mathdef4298{result} & \href{../text/types.html#text-functype}{\mathtt{result}}_I &::=&
\def\mathdef4439#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4439{(}~\def\mathdef4440#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4440{result}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4441#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4441{)}
&\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\mathdef4298#1{{}}\mathdef4298{parameter} &
\def\mathdef4442#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4442{(}~~\def\mathdef4443#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4443{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4444#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4444{)} &\equiv&
(\def\mathdef4445#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4445{(}~~\def\mathdef4446#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4446{param}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4447#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4447{)})^\ast \\
\def\mathdef4298#1{{}}\mathdef4298{result} &
\def\mathdef4448#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4448{(}~~\def\mathdef4449#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4449{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef4450#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4450{)} &\equiv&
(\def\mathdef4451#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4451{(}~~\def\mathdef4452#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4452{result}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef4453#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4453{)})^\ast \\
\end{array}\end{split}\]
Aggregate Types¶
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef4298#1{{}}\mathdef4298{array type} & \href{../text/types.html#text-arraytype}{\mathtt{arraytype}}_I &::=&
\def\mathdef4454#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4454{(}~\def\mathdef4455#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4455{array}~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4456#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4456{)}
&\Rightarrow& \mathit{ft} \\
\def\mathdef4298#1{{}}\mathdef4298{structure type} & \href{../text/types.html#text-structtype}{\mathtt{structtype}}_I &::=&
\def\mathdef4457#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4457{(}~\def\mathdef4458#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4458{struct}~~\mathit{ft}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-structtype}{\mathtt{field}}_I)~\def\mathdef4459#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4459{)}
&\Rightarrow& \mathit{ft}^\ast \\
\def\mathdef4298#1{{}}\mathdef4298{field} & \href{../text/types.html#text-structtype}{\mathtt{field}}_I &::=&
\def\mathdef4460#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4460{(}~\def\mathdef4461#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4461{field}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}_I~\def\mathdef4462#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4462{)}
&\Rightarrow& \mathit{ft} \\
\def\mathdef4298#1{{}}\mathdef4298{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\mathdef4463#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4463{(}~\def\mathdef4464#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4464{mut}~~\mathit{st}{:}\href{../binary/types.html#binary-storagetype}{\mathtt{storagetype}}~\def\mathdef4465#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4465{)}
&\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~\mathit{st} \\
\def\mathdef4298#1{{}}\mathdef4298{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\mathdef4298#1{{}}\mathdef4298{packed type} & \href{../text/types.html#text-packedtype}{\mathtt{packedtype}} &::=&
\def\mathdef4466#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4466{i8}
&\Rightarrow& \href{../syntax/runtime.html#syntax-storagetype}{\mathsf{i8}} \\ &&|&
\def\mathdef4467#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4467{i16}
&\Rightarrow& \href{../syntax/runtime.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\mathdef4298#1{{}}\mathdef4298{field} &
\def\mathdef4468#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4468{(}~~\def\mathdef4469#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4469{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}^\ast~~\def\mathdef4470#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4470{)} &\equiv&
(\def\mathdef4471#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4471{(}~~\def\mathdef4472#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4472{field}~~\href{../text/types.html#text-fieldtype}{\mathtt{fieldtype}}~~\def\mathdef4473#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4473{)})^\ast \\
\end{array}\end{split}\]
Composite Types¶
\[\begin{split}\begin{array}{llclll@{\qquad\qquad}l}
\def\mathdef4298#1{{}}\mathdef4298{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\mathdef4298#1{{}}\mathdef4298{recursive type} & \href{../text/types.html#text-rectype}{\mathtt{rectype}}_I &::=&
\def\mathdef4474#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4474{(}~\def\mathdef4475#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4475{rec}~~\mathit{st}^\ast{:\,}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/types.html#text-typedef}{\mathtt{typedef}}_I)~\def\mathdef4476#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4476{)}
&\Rightarrow& \href{../syntax/types.html#syntax-rectype}{\mathsf{rec}}~\mathit{st}^\ast \\
\def\mathdef4298#1{{}}\mathdef4298{defined type} & \href{../text/types.html#text-typedef}{\mathtt{typedef}}_I &::=&
\def\mathdef4477#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4477{(}~\def\mathdef4478#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4478{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{st}{:}\href{../text/types.html#text-subtype}{\mathtt{subtype}}_I~\def\mathdef4479#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4479{)}
&\Rightarrow& \mathit{st} \\
\def\mathdef4298#1{{}}\mathdef4298{sub type} & \href{../text/types.html#text-subtype}{\mathtt{subtype}}_I &::=&
\def\mathdef4480#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4480{(}~\def\mathdef4481#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4481{sub}~~\def\mathdef4482#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4482{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\mathdef4483#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4483{)}
&\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\mathdef4484#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4484{rec}\) keyword:
\[\begin{split}\begin{array}{llclll}
\def\mathdef4298#1{{}}\mathdef4298{recursive type} &
\href{../text/types.html#text-typedef}{\mathtt{typedef}} &\equiv&
\def\mathdef4485#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4485{(}~~\def\mathdef4486#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4486{rec}~~\href{../text/types.html#text-typedef}{\mathtt{typedef}}~~\def\mathdef4487#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4487{)} \\
\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\mathdef4298#1{{}}\mathdef4298{sub type} &
\href{../text/types.html#text-comptype}{\mathtt{comptype}} &\equiv&
\def\mathdef4488#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4488{(}~~\def\mathdef4489#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4489{sub}~~\def\mathdef4490#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4490{final}~~\epsilon~~\href{../text/types.html#text-comptype}{\mathtt{comptype}}~~\def\mathdef4491#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4491{)} \\
\end{array}\end{split}\]
Limits¶
\[\begin{split}\begin{array}{llclll}
\def\mathdef4298#1{{}}\mathdef4298{limits} & \href{../text/types.html#text-limits}{\mathtt{limits}} &::=&
n{:}\href{../text/values.html#text-int}{\def\mathdef4323#1{{\mathtt{u}#1}}\mathdef4323{\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\mathdef4323#1{{\mathtt{u}#1}}\mathdef4323{\mathtt{32}}}~~m{:}\href{../text/values.html#text-int}{\def\mathdef4323#1{{\mathtt{u}#1}}\mathdef4323{\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\mathdef4298#1{{}}\mathdef4298{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\mathdef4298#1{{}}\mathdef4298{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\mathdef4298#1{{}}\mathdef4298{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\mathdef4492#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4492{(}~\def\mathdef4493#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4493{mut}~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}_I~\def\mathdef4494#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef4494{)} &\Rightarrow& \href{../syntax/types.html#syntax-mut}{\mathsf{var}}~t \\
\end{array}\end{split}\]