Modules
Indices
Indices can be given either in raw numeric form or as symbolic identifiers when bound by a respective construct.
Such identifiers are looked up in the suitable space of the identifier context \(I\).
\[\begin{split}\begin{array}{llcllllllll}
\def\mathdef2081#1{{}}\mathdef2081{type index} & \href{../text/modules.html#text-typeidx}{\mathtt{typeidx}}_I &::=&
x{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& x \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& x & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{types}}[x] = v) \\
\def\mathdef2081#1{{}}\mathdef2081{function index} & \href{../text/modules.html#text-funcidx}{\mathtt{funcidx}}_I &::=&
x{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& x \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& x & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{funcs}}[x] = v) \\
\def\mathdef2081#1{{}}\mathdef2081{table index} & \href{../text/modules.html#text-tableidx}{\mathtt{tableidx}}_I &::=&
x{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& x \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& x & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{tables}}[x] = v) \\
\def\mathdef2081#1{{}}\mathdef2081{memory index} & \href{../text/modules.html#text-memidx}{\mathtt{memidx}}_I &::=&
x{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& x \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& x & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{mems}}[x] = v) \\
\def\mathdef2081#1{{}}\mathdef2081{global index} & \href{../text/modules.html#text-globalidx}{\mathtt{globalidx}}_I &::=&
x{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& x \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& x & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{globals}}[x] = v) \\
\def\mathdef2081#1{{}}\mathdef2081{local index} & \href{../text/modules.html#text-localidx}{\mathtt{localidx}}_I &::=&
x{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& x \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& x & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{locals}}[x] = v) \\
\def\mathdef2081#1{{}}\mathdef2081{label index} & \href{../text/modules.html#text-labelidx}{\mathtt{labelidx}}_I &::=&
l{:}\href{../text/values.html#text-int}{\def\mathdef2106#1{{\mathtt{u}#1}}\mathdef2106{\mathtt{32}}} &\Rightarrow& l \\&&|&
v{:}\href{../text/values.html#text-id}{\mathtt{id}} &\Rightarrow& l & (\mathrel{\mbox{if}} I.\href{../text/conventions.html#text-context}{\mathsf{labels}}[l] = v) \\
\end{array}\end{split}\]
Types
Type definitions can bind a symbolic type identifier.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{type definition} & \href{../text/modules.html#text-typedef}{\mathtt{type}} &::=&
\def\mathdef2118#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2118{(}~\def\mathdef2119#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2119{type}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{ft}{:}\href{../text/types.html#text-functype}{\mathtt{functype}}~\def\mathdef2120#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2120{)}
&\Rightarrow& \mathit{ft} \\
\end{array}\end{split}\]
Type Uses
A type use is a reference to a type definition.
It may optionally be augmented by explicit inlined parameter and result declarations.
That allows binding symbolic identifiers to name the local indices of parameters.
If inline declarations are given, then their types must match the referenced function type.
\[\begin{split}\begin{array}{llcllll}
\def\mathdef2081#1{{}}\mathdef2081{type use} & \href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}_I &::=&
\def\mathdef2121#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2121{(}~\def\mathdef2122#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2122{type}~~x{:}\href{../text/modules.html#text-typeidx}{\mathtt{typeidx}}_I~\def\mathdef2123#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2123{)}
\quad\Rightarrow\quad x, I' \\ &&& \qquad
(\mathrel{\mbox{if}} \begin{array}[t]{@{}l@{}}
I.\href{../text/conventions.html#text-context}{\mathsf{typedefs}}[x] = [t_1^n] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \wedge
I' = \{\href{../text/conventions.html#text-context}{\mathsf{locals}}~(\epsilon)^n\}) \\
\end{array} \\[1ex] &&|&
\def\mathdef2124#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2124{(}~\def\mathdef2125#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2125{type}~~x{:}\href{../text/modules.html#text-typeidx}{\mathtt{typeidx}}_I~\def\mathdef2126#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2126{)}
~~(t_1{:}\href{../text/types.html#text-functype}{\mathtt{param}})^\ast~~(t_2{:}\href{../text/types.html#text-functype}{\mathtt{result}})^\ast
\quad\Rightarrow\quad x, I' \\ &&& \qquad
(\mathrel{\mbox{if}} \begin{array}[t]{@{}l@{}}
I.\href{../text/conventions.html#text-context}{\mathsf{typedefs}}[x] = [t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast] \wedge
I' = \{\href{../text/conventions.html#text-context}{\mathsf{locals}}~\mathrm{id}(\href{../text/types.html#text-functype}{\mathtt{param}})^\ast\} ~\href{../text/conventions.html#text-context-wf}{\mbox{well-formed}}) \\
\end{array} \\
\end{array}\end{split}\]
The synthesized attribute of a \(\href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}\) is a pair consisting of both the used type index and the updated identifier context including possible parameter identifiers.
The following auxiliary function extracts optional identifiers from parameters:
\[\begin{split}\begin{array}{lcl@{\qquad\qquad}l}
\mathrm{id}(\def\mathdef2127#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2127{(}~\def\mathdef2128#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2128{param}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2129#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2129{)}) &=& \href{../text/values.html#text-id}{\mathtt{id}}^? \\
\end{array}\end{split}\]
Note
Both productions overlap for the case that the function type is \([] \href{../syntax/types.html#syntax-functype}{\rightarrow} []\).
However, in that case, they also produce the same results, so that the choice is immaterial.
The well-formedness condition on \(I'\) ensures that the parameters do not contain duplicate identifier.
Abbreviations
A \(\href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}\) may also be replaced entirely by inline parameter and result declarations.
In that case, a type index is automatically inserted:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{type use} &
(t_1{:}\href{../text/types.html#text-functype}{\mathtt{param}})^\ast~~(t_2{:}\href{../text/types.html#text-functype}{\mathtt{result}})^\ast &\equiv&
\def\mathdef2130#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2130{(}~\def\mathdef2131#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2131{type}~~x~\def\mathdef2132#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2132{)}~~\href{../text/types.html#text-functype}{\mathtt{param}}^\ast~~\href{../text/types.html#text-functype}{\mathtt{result}}^\ast \\
\end{array}\end{split}\]
where \(x\) is the smallest existing type index whose definition in the current module is the function type \([t_1^\ast] \href{../syntax/types.html#syntax-functype}{\rightarrow} [t_2^\ast]\).
If no such index exists, then a new type definition of the form
\[\def\mathdef2133#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2133{(}~\def\mathdef2134#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2134{type}~~\def\mathdef2135#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2135{(}~\def\mathdef2136#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2136{func}~~\href{../text/types.html#text-functype}{\mathtt{param}}^\ast~~\href{../text/types.html#text-functype}{\mathtt{result}}^\ast~\def\mathdef2137#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2137{)}~\def\mathdef2138#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2138{)}\]
is inserted at the end of the module.
Abbreviations are expanded in the order they appear, such that previously inserted type definitions are reused by consecutive expansions.
Imports
The descriptors in imports can bind a symbolic function, table, memory, or global identifier.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{import} & \href{../text/modules.html#text-import}{\mathtt{import}}_I &::=&
\def\mathdef2139#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2139{(}~\def\mathdef2140#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2140{import}~~\mathit{mod}{:}\href{../text/values.html#text-name}{\mathtt{name}}~~\mathit{nm}{:}\href{../text/values.html#text-name}{\mathtt{name}}~~d{:}\href{../text/modules.html#text-importdesc}{\mathtt{importdesc}}_I~\def\mathdef2141#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2141{)} \\ &&& \qquad
\Rightarrow\quad \{ \href{../syntax/modules.html#syntax-import}{\mathsf{module}}~\mathit{mod}, \href{../syntax/modules.html#syntax-import}{\mathsf{name}}~\mathit{nm}, \href{../syntax/modules.html#syntax-import}{\mathsf{desc}}~d \} \\[1ex]
\def\mathdef2081#1{{}}\mathdef2081{import description} & \href{../text/modules.html#text-importdesc}{\mathtt{importdesc}}_I &::=&
\def\mathdef2142#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2142{(}~\def\mathdef2143#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2143{func}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~x,I'{:}\href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}_I~\def\mathdef2144#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2144{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-importdesc}{\mathsf{func}}~x \\ &&|&
\def\mathdef2145#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2145{(}~\def\mathdef2146#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2146{table}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{tt}{:}\href{../text/types.html#text-tabletype}{\mathtt{tabletype}}~\def\mathdef2147#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2147{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-importdesc}{\mathsf{table}}~\mathit{tt} \\ &&|&
\def\mathdef2148#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2148{(}~\def\mathdef2149#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2149{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{mt}{:}\href{../text/types.html#text-memtype}{\mathtt{memtype}}~\def\mathdef2150#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2150{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-importdesc}{\mathsf{mem}}~~\mathit{mt} \\ &&|&
\def\mathdef2151#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2151{(}~\def\mathdef2152#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2152{global}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{gt}{:}\href{../text/types.html#text-globaltype}{\mathtt{globaltype}}~\def\mathdef2153#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2153{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-importdesc}{\mathsf{global}}~\mathit{gt} \\
\end{array}\end{split}\]
Abbreviations
As an abbreviation, imports may also be specified inline with function, table, memory, or global definitions; see the respective sections.
Functions
Function definitions can bind a symbolic function identifier, and local identifiers for its parameters and locals.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{function} & \href{../text/modules.html#text-func}{\mathtt{func}}_I &::=&
\def\mathdef2154#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2154{(}~\def\mathdef2155#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2155{func}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~x,I'{:}\href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}_I~~
(t{:}\href{../text/modules.html#text-local}{\mathtt{local}})^\ast~~(\mathit{in}{:}\href{../text/instructions.html#text-instr}{\mathtt{instr}}_{I''})^\ast~\def\mathdef2156#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2156{)} \\ &&& \qquad
\Rightarrow\quad \{ \href{../syntax/modules.html#syntax-func}{\mathsf{type}}~x, \href{../syntax/modules.html#syntax-func}{\mathsf{locals}}~t^\ast, \href{../syntax/modules.html#syntax-func}{\mathsf{body}}~\mathit{in}^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \} \\ &&& \qquad\qquad\qquad
(\mathrel{\mbox{if}} I'' = I' \href{../syntax/conventions.html#notation-compose}{\oplus} \{\href{../text/conventions.html#text-context}{\mathsf{locals}}~\mathrm{id}(\href{../text/modules.html#text-local}{\mathtt{local}})^\ast\} ~\href{../text/conventions.html#text-context-wf}{\mbox{well-formed}}) \\[1ex]
\def\mathdef2081#1{{}}\mathdef2081{local} & \href{../text/modules.html#text-local}{\mathtt{local}} &::=&
\def\mathdef2157#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2157{(}~\def\mathdef2158#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2158{local}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~t{:}\href{../text/types.html#text-valtype}{\mathtt{valtype}}~\def\mathdef2159#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2159{)}
\quad\Rightarrow\quad t \\
\end{array}\end{split}\]
The definition of the local identifier context \(I''\) uses the following auxiliary function to extract optional identifiers from locals:
\[\begin{split}\begin{array}{lcl@{\qquad\qquad}l}
\mathrm{id}(\def\mathdef2160#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2160{(}~\def\mathdef2161#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2161{local}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2162#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2162{)}) &=& \href{../text/values.html#text-id}{\mathtt{id}}^? \\
\end{array}\end{split}\]
Note
The well-formedness condition on \(I''\) ensures that parameters and locals do not contain duplicate identifiers.
Abbreviations
Multiple anonymous locals may be combined into a single declaration:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{local} &
\def\mathdef2163#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2163{(}~~\def\mathdef2164#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2164{local}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}^\ast~~\def\mathdef2165#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2165{)} &\equiv&
(\def\mathdef2166#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2166{(}~~\def\mathdef2167#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2167{local}~~\href{../text/types.html#text-valtype}{\mathtt{valtype}}~~\def\mathdef2168#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2168{)})^\ast \\
\end{array}\end{split}\]
Functions can be defined as imports or exports inline:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{module field} &
\def\mathdef2169#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2169{(}~\def\mathdef2170#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2170{func}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2171#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2171{(}~\def\mathdef2172#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2172{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~\def\mathdef2173#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2173{)}~~\href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}~\def\mathdef2174#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2174{)} \quad\equiv \\ & \qquad
\def\mathdef2175#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2175{(}~\def\mathdef2176#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2176{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~~\def\mathdef2177#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2177{(}~\def\mathdef2178#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2178{func}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\href{../text/modules.html#text-typeuse}{\mathtt{typeuse}}~\def\mathdef2179#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2179{)}~\def\mathdef2180#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2180{)} \\[1ex] &
\def\mathdef2181#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2181{(}~\def\mathdef2182#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2182{func}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2183#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2183{(}~\def\mathdef2184#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2184{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~\def\mathdef2185#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2185{)}~~\dots~\def\mathdef2186#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2186{)} \quad\equiv \\ & \qquad
\def\mathdef2187#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2187{(}~\def\mathdef2188#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2188{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~~\def\mathdef2189#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2189{(}~\def\mathdef2190#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2190{func}~~\href{../text/values.html#text-id}{\mathtt{id}}'~\def\mathdef2191#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2191{)}~\def\mathdef2192#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2192{)}~~
\def\mathdef2193#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2193{(}~\def\mathdef2194#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2194{func}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~\dots~\def\mathdef2195#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2195{)}
\\ & \qquad\qquad
(\mathrel{\mbox{if}} \href{../text/values.html#text-id}{\mathtt{id}}' = \href{../text/values.html#text-id}{\mathtt{id}}^? \neq \epsilon \vee \href{../text/values.html#text-id}{\mathtt{id}}' ~\href{../text/values.html#text-id-fresh}{\mbox{fresh}}) \\
\end{array}\end{split}\]
The latter abbreviation can be applied repeatedly, with “\(\dots\)” containing another import or export.
Tables
Table definitions can bind a symbolic table identifier.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{table} & \href{../text/modules.html#text-table}{\mathtt{table}}_I &::=&
\def\mathdef2196#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2196{(}~\def\mathdef2197#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2197{table}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{tt}{:}\href{../text/types.html#text-tabletype}{\mathtt{tabletype}}~\def\mathdef2198#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2198{)}
&\Rightarrow& \{ \href{../syntax/modules.html#syntax-table}{\mathsf{type}}~\mathit{tt} \} \\
\end{array}\end{split}\]
Abbreviations
An element segment can be given inline with a table definition, in which case its offset is \(0\) and the limits of the table type are inferred from the length of the given segment:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{module field} &
\def\mathdef2199#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2199{(}~\def\mathdef2200#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2200{table}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\href{../text/types.html#text-elemtype}{\mathtt{elemtype}}~~\def\mathdef2201#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2201{(}~\def\mathdef2202#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2202{elem}~~x^n{:}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/modules.html#text-funcidx}{\mathtt{funcidx}})~\def\mathdef2203#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2203{)}~~\def\mathdef2204#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2204{)} \quad\equiv \\ & \qquad
\def\mathdef2205#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2205{(}~\def\mathdef2206#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2206{table}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~n~~n~~\href{../text/types.html#text-elemtype}{\mathtt{elemtype}}~\def\mathdef2207#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2207{)}~~
\def\mathdef2208#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2208{(}~\def\mathdef2209#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2209{elem}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~\def\mathdef2210#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2210{(}~\def\mathdef2211#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2211{i32.const}~~\def\mathdef2212#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2212{0}~\def\mathdef2213#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2213{)}~~\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/modules.html#text-funcidx}{\mathtt{funcidx}})~\def\mathdef2214#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2214{)}
\\ & \qquad\qquad
(\mathrel{\mbox{if}} \href{../text/values.html#text-id}{\mathtt{id}}' = \href{../text/values.html#text-id}{\mathtt{id}}^? \neq \epsilon \vee \href{../text/values.html#text-id}{\mathtt{id}}' ~\href{../text/values.html#text-id-fresh}{\mbox{fresh}}) \\
\end{array}\end{split}\]
Tables can be defined as imports or exports inline:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{module field} &
\def\mathdef2215#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2215{(}~\def\mathdef2216#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2216{table}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2217#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2217{(}~\def\mathdef2218#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2218{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~\def\mathdef2219#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2219{)}~~\href{../text/types.html#text-tabletype}{\mathtt{tabletype}}~\def\mathdef2220#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2220{)} \quad\equiv \\ & \qquad
\def\mathdef2221#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2221{(}~\def\mathdef2222#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2222{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~~\def\mathdef2223#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2223{(}~\def\mathdef2224#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2224{table}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\href{../text/types.html#text-tabletype}{\mathtt{tabletype}}~\def\mathdef2225#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2225{)}~\def\mathdef2226#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2226{)} \\[1ex] &
\def\mathdef2227#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2227{(}~\def\mathdef2228#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2228{table}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2229#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2229{(}~\def\mathdef2230#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2230{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~\def\mathdef2231#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2231{)}~~\dots~\def\mathdef2232#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2232{)} \quad\equiv \\ & \qquad
\def\mathdef2233#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2233{(}~\def\mathdef2234#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2234{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~~\def\mathdef2235#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2235{(}~\def\mathdef2236#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2236{table}~~\href{../text/values.html#text-id}{\mathtt{id}}'~\def\mathdef2237#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2237{)}~\def\mathdef2238#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2238{)}~~
\def\mathdef2239#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2239{(}~\def\mathdef2240#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2240{table}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~\dots~\def\mathdef2241#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2241{)}
\\ & \qquad\qquad
(\mathrel{\mbox{if}} \href{../text/values.html#text-id}{\mathtt{id}}' = \href{../text/values.html#text-id}{\mathtt{id}}^? \neq \epsilon \vee \href{../text/values.html#text-id}{\mathtt{id}}' ~\href{../text/values.html#text-id-fresh}{\mbox{fresh}}) \\
\end{array}\end{split}\]
The latter abbreviation can be applied repeatedly, with “\(\dots\)” containing another import or export or an inline elements segment.
Memories
Memory definitions can bind a symbolic memory identifier.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{memory} & \href{../text/modules.html#text-mem}{\mathtt{mem}}_I &::=&
\def\mathdef2242#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2242{(}~\def\mathdef2243#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2243{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{mt}{:}\href{../text/types.html#text-memtype}{\mathtt{memtype}}~\def\mathdef2244#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2244{)}
&\Rightarrow& \{ \href{../syntax/modules.html#syntax-mem}{\mathsf{type}}~\mathit{mt} \} \\
\end{array}\end{split}\]
Abbreviations
A data segment can be given inline with a memory definition, in which case its offset is \(0\) the limits of the memory type are inferred from the length of the data, rounded up to page size:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{module field} &
\def\mathdef2245#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2245{(}~\def\mathdef2246#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2246{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2247#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2247{(}~\def\mathdef2248#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2248{data}~~b^n{:}\href{../text/modules.html#text-datastring}{\mathtt{datastring}}~\def\mathdef2249#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2249{)}~~\def\mathdef2250#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2250{)} \quad\equiv \\ & \qquad
\def\mathdef2251#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2251{(}~\def\mathdef2252#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2252{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~m~~m~\def\mathdef2253#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2253{)}~~
\def\mathdef2254#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2254{(}~\def\mathdef2255#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2255{data}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~\def\mathdef2256#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2256{(}~\def\mathdef2257#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2257{i32.const}~~\def\mathdef2258#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2258{0}~\def\mathdef2259#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2259{)}~~\href{../text/modules.html#text-datastring}{\mathtt{datastring}}~\def\mathdef2260#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2260{)}
\\ & \qquad\qquad
(\mathrel{\mbox{if}} \href{../text/values.html#text-id}{\mathtt{id}}' = \href{../text/values.html#text-id}{\mathtt{id}}^? \neq \epsilon \vee \href{../text/values.html#text-id}{\mathtt{id}}' ~\href{../text/values.html#text-id-fresh}{\mbox{fresh}}, m = \mathrm{ceil}(n / 64\mathrm{Ki})) \\
\end{array}\end{split}\]
Memories can be defined as imports or exports inline:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{module field} &
\def\mathdef2261#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2261{(}~\def\mathdef2262#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2262{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2263#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2263{(}~\def\mathdef2264#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2264{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~\def\mathdef2265#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2265{)}~~\href{../text/types.html#text-memtype}{\mathtt{memtype}}~\def\mathdef2266#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2266{)} \quad\equiv \\ & \qquad
\def\mathdef2267#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2267{(}~\def\mathdef2268#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2268{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~~\def\mathdef2269#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2269{(}~\def\mathdef2270#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2270{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\href{../text/types.html#text-memtype}{\mathtt{memtype}}~\def\mathdef2271#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2271{)}~\def\mathdef2272#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2272{)}
\\[1ex] &
\def\mathdef2273#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2273{(}~\def\mathdef2274#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2274{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2275#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2275{(}~\def\mathdef2276#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2276{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~\def\mathdef2277#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2277{)}~~\dots~\def\mathdef2278#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2278{)} \quad\equiv \\ & \qquad
\def\mathdef2279#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2279{(}~\def\mathdef2280#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2280{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~~\def\mathdef2281#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2281{(}~\def\mathdef2282#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2282{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}'~\def\mathdef2283#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2283{)}~\def\mathdef2284#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2284{)}~~
\def\mathdef2285#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2285{(}~\def\mathdef2286#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2286{memory}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~\dots~\def\mathdef2287#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2287{)}
\\ & \qquad\qquad
(\mathrel{\mbox{if}} \href{../text/values.html#text-id}{\mathtt{id}}' = \href{../text/values.html#text-id}{\mathtt{id}}^? \neq \epsilon \vee \href{../text/values.html#text-id}{\mathtt{id}}' ~\href{../text/values.html#text-id-fresh}{\mbox{fresh}}) \\
\end{array}\end{split}\]
The latter abbreviation can be applied repeatedly, with “\(\dots\)” containing another import or export or an inline data segment.
Globals
Global definitions can bind a symbolic global identifier.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{global} & \href{../text/modules.html#text-global}{\mathtt{global}}_I &::=&
\def\mathdef2288#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2288{(}~\def\mathdef2289#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2289{global}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\mathit{gt}{:}\href{../text/types.html#text-globaltype}{\mathtt{globaltype}}~~e{:}\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2290#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2290{)}
&\Rightarrow& \{ \href{../syntax/modules.html#syntax-global}{\mathsf{type}}~\mathit{gt}, \href{../syntax/modules.html#syntax-global}{\mathsf{init}}~e \} \\
\end{array}\end{split}\]
Abbreviations
Globals can be defined as imports or exports inline:
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{module field} &
\def\mathdef2291#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2291{(}~\def\mathdef2292#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2292{global}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2293#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2293{(}~\def\mathdef2294#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2294{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~\def\mathdef2295#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2295{)}~~\href{../text/types.html#text-globaltype}{\mathtt{globaltype}}~\def\mathdef2296#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2296{)} \quad\equiv \\ & \qquad
\def\mathdef2297#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2297{(}~\def\mathdef2298#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2298{import}~~\href{../text/values.html#text-name}{\mathtt{name}}_1~~\href{../text/values.html#text-name}{\mathtt{name}}_2~~\def\mathdef2299#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2299{(}~\def\mathdef2300#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2300{global}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\href{../text/types.html#text-globaltype}{\mathtt{globaltype}}~\def\mathdef2301#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2301{)}~\def\mathdef2302#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2302{)}
\\[1ex] &
\def\mathdef2303#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2303{(}~\def\mathdef2304#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2304{global}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~\def\mathdef2305#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2305{(}~\def\mathdef2306#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2306{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~\def\mathdef2307#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2307{)}~~\dots~\def\mathdef2308#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2308{)} \quad\equiv \\ & \qquad
\def\mathdef2309#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2309{(}~\def\mathdef2310#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2310{export}~~\href{../text/values.html#text-name}{\mathtt{name}}~~\def\mathdef2311#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2311{(}~\def\mathdef2312#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2312{global}~~\href{../text/values.html#text-id}{\mathtt{id}}'~\def\mathdef2313#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2313{)}~\def\mathdef2314#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2314{)}~~
\def\mathdef2315#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2315{(}~\def\mathdef2316#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2316{global}~~\href{../text/values.html#text-id}{\mathtt{id}}'~~\dots~\def\mathdef2317#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2317{)}
\\ & \qquad\qquad
(\mathrel{\mbox{if}} \href{../text/values.html#text-id}{\mathtt{id}}' = \href{../text/values.html#text-id}{\mathtt{id}}^? \neq \epsilon \vee \href{../text/values.html#text-id}{\mathtt{id}}' ~\href{../text/values.html#text-id-fresh}{\mbox{fresh}}) \\
\end{array}\end{split}\]
The latter abbreviation can be applied repeatedly, with “\(\dots\)” containing another import or export.
Exports
The syntax for exports mirrors their abstract syntax directly.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{export} & \href{../text/modules.html#text-export}{\mathtt{export}}_I &::=&
\def\mathdef2318#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2318{(}~\def\mathdef2319#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2319{export}~~\mathit{nm}{:}\href{../text/values.html#text-name}{\mathtt{name}}~~d{:}\href{../text/modules.html#text-exportdesc}{\mathtt{exportdesc}}_I~\def\mathdef2320#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2320{)}
&\Rightarrow& \{ \href{../syntax/modules.html#syntax-export}{\mathsf{name}}~\mathit{nm}, \href{../syntax/modules.html#syntax-export}{\mathsf{desc}}~d \} \\
\def\mathdef2081#1{{}}\mathdef2081{export description} & \href{../text/modules.html#text-exportdesc}{\mathtt{exportdesc}}_I &::=&
\def\mathdef2321#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2321{(}~\def\mathdef2322#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2322{func}~~x{:}\href{../text/modules.html#text-funcidx}{\mathtt{funcidx}}_I~\def\mathdef2323#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2323{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-exportdesc}{\mathsf{func}}~x \\ &&|&
\def\mathdef2324#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2324{(}~\def\mathdef2325#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2325{table}~~x{:}\href{../text/modules.html#text-tableidx}{\mathtt{tableidx}}_I~\def\mathdef2326#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2326{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-exportdesc}{\mathsf{table}}~x \\ &&|&
\def\mathdef2327#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2327{(}~\def\mathdef2328#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2328{memory}~~x{:}\href{../text/modules.html#text-memidx}{\mathtt{memidx}}_I~\def\mathdef2329#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2329{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-exportdesc}{\mathsf{mem}}~x \\ &&|&
\def\mathdef2330#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2330{(}~\def\mathdef2331#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2331{global}~~x{:}\href{../text/modules.html#text-globalidx}{\mathtt{globalidx}}_I~\def\mathdef2332#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2332{)}
&\Rightarrow& \href{../syntax/modules.html#syntax-exportdesc}{\mathsf{global}}~x \\
\end{array}\end{split}\]
Abbreviations
As an abbreviation, exports may also be specified inline with function, table, memory, or global definitions; see the respective sections.
Start Function
A start function is defined in terms of its index.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{start function} & \href{../text/modules.html#text-start}{\mathtt{start}}_I &::=&
\def\mathdef2333#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2333{(}~\def\mathdef2334#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2334{start}~~x{:}\href{../text/modules.html#text-funcidx}{\mathtt{funcidx}}_I~\def\mathdef2335#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2335{)}
&\Rightarrow& \{ \href{../syntax/modules.html#syntax-start}{\mathsf{func}}~x \} \\
\end{array}\end{split}\]
Note
At most one start function may occur in a module,
which is ensured by a suitable side condition on the \(\href{../text/modules.html#text-module}{\mathtt{module}}\) grammar.
Element Segments
Element segments allow for an optional table index to identify the table to initialize.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{element segment} & \href{../text/modules.html#text-elem}{\mathtt{elem}}_I &::=&
\def\mathdef2336#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2336{(}~\def\mathdef2337#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2337{elem}~~x{:}\href{../text/modules.html#text-tableidx}{\mathtt{tableidx}}_I~~\def\mathdef2338#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2338{(}~\def\mathdef2339#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2339{offset}~~e{:}\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2340#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2340{)}~~y^\ast{:}\href{../text/conventions.html#text-vec}{\mathtt{vec}}(\href{../text/modules.html#text-funcidx}{\mathtt{funcidx}}_I)~\def\mathdef2341#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2341{)} \\ &&& \qquad
\Rightarrow\quad \{ \href{../syntax/modules.html#syntax-elem}{\mathsf{table}}~x, \href{../syntax/modules.html#syntax-elem}{\mathsf{offset}}~e, \href{../syntax/modules.html#syntax-elem}{\mathsf{init}}~y^\ast \} \\
\end{array}\end{split}\]
Note
In the current version of WebAssembly, the only valid table index is 0
or a symbolic table identifier resolving to the same value.
Abbreviations
As an abbreviation, a single instruction may occur in place of the offset:
\[\begin{array}{llcll}
\def\mathdef2081#1{{}}\mathdef2081{element offset} &
\href{../text/instructions.html#text-instr}{\mathtt{instr}} &\equiv&
\def\mathdef2342#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2342{(}~\def\mathdef2343#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2343{offset}~~\href{../text/instructions.html#text-instr}{\mathtt{instr}}~\def\mathdef2344#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2344{)}
\end{array}\]
Also, the table index can be omitted, defaulting to \(\mathtt{0}\).
\[\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{element segment} &
\def\mathdef2345#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2345{(}~\def\mathdef2346#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2346{elem}~~\def\mathdef2347#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2347{(}~\def\mathdef2348#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2348{offset}~~\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2349#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2349{)}~~\dots~\def\mathdef2350#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2350{)}
&\equiv&
\def\mathdef2351#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2351{(}~\def\mathdef2352#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2352{elem}~~0~~\def\mathdef2353#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2353{(}~\def\mathdef2354#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2354{offset}~~\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2355#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2355{)}~~\dots~\def\mathdef2356#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2356{)}
\end{array}\]
As another abbreviation, element segments may also be specified inline with table definitions; see the respective section.
Data Segments
Data segments allow for an optional memory index to identify the memory to initialize.
The data is written as a string, which may be split up into a possibly empty sequence of individual string literals.
\[\begin{split}\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{data segment} & \href{../text/modules.html#text-data}{\mathtt{data}}_I &::=&
\def\mathdef2357#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2357{(}~\def\mathdef2358#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2358{data}~~x{:}\href{../text/modules.html#text-memidx}{\mathtt{memidx}}_I~~\def\mathdef2359#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2359{(}~\def\mathdef2360#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2360{offset}~~e{:}\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2361#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2361{)}~~b^\ast{:}\href{../text/modules.html#text-datastring}{\mathtt{datastring}}~\def\mathdef2362#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2362{)} \\ &&& \qquad
\Rightarrow\quad \{ \href{../syntax/modules.html#syntax-data}{\mathsf{data}}~x', \href{../syntax/modules.html#syntax-data}{\mathsf{offset}}~e, \href{../syntax/modules.html#syntax-data}{\mathsf{init}}~b^\ast \} \\[1ex]
\def\mathdef2081#1{{}}\mathdef2081{data string} & \href{../text/modules.html#text-datastring}{\mathtt{datastring}} &::=&
(b^\ast{:}\href{../text/values.html#text-string}{\mathtt{string}})^\ast \quad\Rightarrow\quad \href{../syntax/conventions.html#notation-concat}{\mathrm{concat}}((b^\ast)^\ast) \\
\end{array}\end{split}\]
Note
In the current version of WebAssembly, the only valid memory index is 0
or a symbolic memory identifier resolving to the same value.
Abbreviations
As an abbreviation, a single instruction may occur in place of the offset:
\[\begin{array}{llcll}
\def\mathdef2081#1{{}}\mathdef2081{data offset} &
\href{../text/instructions.html#text-instr}{\mathtt{instr}} &\equiv&
\def\mathdef2363#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2363{(}~\def\mathdef2364#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2364{offset}~~\href{../text/instructions.html#text-instr}{\mathtt{instr}}~\def\mathdef2365#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2365{)}
\end{array}\]
Also, the memory index can be omitted, defaulting to \(\mathtt{0}\).
\[\begin{array}{llclll}
\def\mathdef2081#1{{}}\mathdef2081{data segment} &
\def\mathdef2366#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2366{(}~\def\mathdef2367#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2367{data}~~\def\mathdef2368#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2368{(}~\def\mathdef2369#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2369{offset}~~\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2370#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2370{)}~~\dots~\def\mathdef2371#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2371{)}
&\equiv&
\def\mathdef2372#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2372{(}~\def\mathdef2373#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2373{data}~~0~~\def\mathdef2374#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2374{(}~\def\mathdef2375#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2375{offset}~~\href{../text/instructions.html#text-expr}{\mathtt{expr}}_I~\def\mathdef2376#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2376{)}~~\dots~\def\mathdef2377#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2377{)}
\end{array}\]
As another abbreviation, data segments may also be specified inline with memory definitions; see the respective section.
Modules
A module consists of a sequence of fields that can occur in any order.
All definitions and their respective bound identifiers scope over the entire module, including the text preceding them.
A module may optionally bind an identifier that names the module.
The name serves a documentary role only.
\[\begin{split}\begin{array}{lll}
\def\mathdef2081#1{{}}\mathdef2081{module} & \href{../text/modules.html#text-module}{\mathtt{module}} &
\begin{array}[t]{@{}cllll}
::=&
\def\mathdef2378#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2378{(}~\def\mathdef2379#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2379{module}~~\href{../text/values.html#text-id}{\mathtt{id}}^?~~(m{:}\href{../text/modules.html#text-modulefield}{\mathtt{modulefield}}_I)^\ast~\def\mathdef2380#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2380{)}
\quad\Rightarrow\quad \href{../syntax/conventions.html#notation-compose}{\bigoplus} m^\ast \\
&\qquad (\mathrel{\mbox{if}} I = \href{../syntax/conventions.html#notation-compose}{\bigoplus} \mathrm{idc}(\href{../text/modules.html#text-modulefield}{\mathtt{modulefield}})^\ast ~\href{../text/conventions.html#text-context-wf}{\mbox{well-formed}}) \\
\end{array} \\[1ex]
\def\mathdef2081#1{{}}\mathdef2081{module field} & \href{../text/modules.html#text-modulefield}{\mathtt{modulefield}}_I &
\begin{array}[t]{@{}clll}
::=&
\mathit{ty}{:}\href{../text/modules.html#text-typedef}{\mathtt{type}} &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{types}}~\mathit{ty}\} \\ |&
\mathit{im}{:}\href{../text/modules.html#text-import}{\mathtt{import}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{imports}}~\mathit{im}\} \\ |&
\mathit{fn}{:}\href{../text/modules.html#text-func}{\mathtt{func}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{funcs}}~\mathit{fn}\} \\ |&
\mathit{ta}{:}\href{../text/modules.html#text-table}{\mathtt{table}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{tables}}~\mathit{ta}\} \\ |&
\mathit{me}{:}\href{../text/modules.html#text-mem}{\mathtt{mem}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{mems}}~\mathit{me}\} \\ |&
\mathit{gl}{:}\href{../text/modules.html#text-global}{\mathtt{global}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{globals}}~\mathit{gl}\} \\ |&
\mathit{ex}{:}\href{../text/modules.html#text-export}{\mathtt{export}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{exports}}~\mathit{ex}\} \\ |&
\mathit{st}{:}\href{../text/modules.html#text-start}{\mathtt{start}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{start}}~\mathit{st}\} \\ |&
\mathit{el}{:}\href{../text/modules.html#text-elem}{\mathtt{elem}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{elem}}~\mathit{el}\} \\ |&
\mathit{da}{:}\href{../text/modules.html#text-data}{\mathtt{data}}_I &\Rightarrow& \{\href{../syntax/modules.html#syntax-module}{\mathsf{data}}~\mathit{da}\} \\
\end{array}
\end{array}\end{split}\]
The following restrictions are imposed on the composition of modules: \(m_1 \href{../syntax/conventions.html#notation-compose}{\oplus} m_2\) is defined if and only if
\(m_1.\href{../syntax/modules.html#syntax-module}{\mathsf{start}} = \epsilon \vee m_2.\href{../syntax/modules.html#syntax-module}{\mathsf{start}} = \epsilon\)
\(m_1.\href{../syntax/modules.html#syntax-module}{\mathsf{funcs}} = m_1.\href{../syntax/modules.html#syntax-module}{\mathsf{tables}} = m_1.\href{../syntax/modules.html#syntax-module}{\mathsf{mems}} = m_1.\href{../syntax/modules.html#syntax-module}{\mathsf{globals}} = \epsilon \vee m_2.\href{../syntax/modules.html#syntax-module}{\mathsf{imports}} = \epsilon\)
Note
The first condition ensures that there is at most one start function.
The second condition enforces that all imports must occur before any regular definition of a function, table, memory, or global,
thereby maintaining the ordering of the respective index spaces.
The well-formedness condition on \(I\) in the grammar for \(\href{../text/modules.html#text-module}{\mathtt{module}}\) ensures that no namespace contains duplicate identifiers.
The definition of the initial identifier context \(I\) uses the following auxiliary definition which maps each relevant definition to a singular context with one (possibly empty) identifier:
\[\begin{split}\begin{array}{@{}lcl@{\qquad\qquad}l}
\mathrm{idc}(\def\mathdef2381#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2381{(}~\def\mathdef2382#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2382{type}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\mathit{ft}{:}\href{../text/types.html#text-functype}{\mathtt{functype}}~\def\mathdef2383#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2383{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{types}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?), \href{../text/conventions.html#text-context}{\mathsf{typedefs}}~\mathit{ft}\} \\
\mathrm{idc}(\def\mathdef2384#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2384{(}~\def\mathdef2385#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2385{func}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2386#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2386{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{funcs}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2387#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2387{(}~\def\mathdef2388#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2388{table}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2389#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2389{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{tables}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2390#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2390{(}~\def\mathdef2391#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2391{memory}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2392#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2392{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{mems}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2393#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2393{(}~\def\mathdef2394#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2394{global}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2395#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2395{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{globals}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2396#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2396{(}~\def\mathdef2397#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2397{import}~\dots~\def\mathdef2398#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2398{(}~\def\mathdef2399#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2399{func}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2400#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2400{)}~\def\mathdef2401#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2401{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{funcs}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2402#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2402{(}~\def\mathdef2403#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2403{import}~\dots~\def\mathdef2404#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2404{(}~\def\mathdef2405#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2405{table}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2406#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2406{)}~\def\mathdef2407#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2407{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{tables}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2408#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2408{(}~\def\mathdef2409#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2409{import}~\dots~\def\mathdef2410#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2410{(}~\def\mathdef2411#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2411{memory}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2412#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2412{)}~\def\mathdef2413#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2413{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{mems}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2414#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2414{(}~\def\mathdef2415#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2415{import}~\dots~\def\mathdef2416#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2416{(}~\def\mathdef2417#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2417{global}~\href{../text/values.html#text-id}{\mathtt{id}}^?~\dots~\def\mathdef2418#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2418{)}~\def\mathdef2419#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2419{)}) &=&
\{\href{../text/conventions.html#text-context}{\mathsf{globals}}~(\href{../text/values.html#text-id}{\mathtt{id}}^?)\} \\
\mathrm{idc}(\def\mathdef2420#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2420{(}~\dots~\def\mathdef2421#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2421{)}) &=&
\{\} \\
\end{array}\end{split}\]
Abbreviations
In a source file, the toplevel \(\mathtt{(module}~\dots\mathtt{)}\) surrounding the module body may be omitted.
\[\begin{array}{llcll}
\def\mathdef2081#1{{}}\mathdef2081{module} &
\href{../text/modules.html#text-modulefield}{\mathtt{modulefield}}^\ast &\equiv&
\def\mathdef2422#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2422{(}~\def\mathdef2423#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2423{module}~~\href{../text/modules.html#text-modulefield}{\mathtt{modulefield}}^\ast~\def\mathdef2424#1{\mbox{‘}\mathtt{#1}\mbox{’}}\mathdef2424{)}
\end{array}\]