@@ -236,8 +236,8 @@ The syntax for defining a core module instance is:
236236core:instance ::= (instance <id>? <core:instancexpr>)
237237core:instanceexpr ::= (instantiate <core:moduleidx> <core:instantiatearg>*)
238238 | <core:inlineexport>*
239- core:instantiatearg ::= (with <core:name > (instance <core:instanceidx>))
240- | (with <core:name > (instance <core:inlineexport>*))
239+ core:instantiatearg ::= (with <core:string > (instance <core:instanceidx>))
240+ | (with <core:string > (instance <core:inlineexport>*))
241241core:sortidx ::= (<core:sort> <u32>)
242242core:sort ::= func
243243 | table
@@ -247,17 +247,18 @@ core:sort ::= func
247247 | type
248248 | module
249249 | instance
250- core:inlineexport ::= (export <core:name> <core:sortidx>)
251- ```
252- When instantiating a module via ` instantiate ` , the two-level imports of the
253- core modules are resolved as follows:
254- 1 . The first ` core:name ` of the import is looked up in the named list of
255- ` core:instantiatearg ` to select a core module instance. (In the future,
256- other ` core:sort ` s could be allowed if core wasm adds single-level
257- imports.)
258- 2 . The second ` core:name ` of the import is looked up in the named list of
259- exports of the core module instance found by the first step to select the
260- imported core definition.
250+ core:inlineexport ::= (export <core:string> <core:sortidx>)
251+ ```
252+ where [ ` core:string ` ] is the WebAssembly text format's quoted string literal.
253+
254+ When instantiating a module via ` instantiate ` , the two-level imports of the core
255+ modules are resolved as follows:
256+ 1 . The first import name is looked up in the named list of ` core:instantiatearg `
257+ to select a core module instance. (In the future, other ` core:sort ` s could be
258+ allowed if core wasm adds single-level imports.)
259+ 2 . The second import name is looked up in the named list of exports of the core
260+ module instance found by the first step to select the imported core
261+ definition.
261262
262263Each ` core:sort ` corresponds 1:1 with a distinct [ index space] that contains
263264only core definitions of that * sort* . The ` u32 ` field of ` core:sortidx `
@@ -294,9 +295,9 @@ instances, but with an expanded component-level definition of `sort`:
294295instance ::= (instance <id>? <instanceexpr>)
295296instanceexpr ::= (instantiate <componentidx> <instantiatearg>*)
296297 | <inlineexport>*
297- instantiatearg ::= (with <name > <sortidx>)
298- | (with <name > (instance <inlineexport>*))
299- name ::= <core:name >
298+ instantiatearg ::= (with <string > <sortidx>)
299+ | (with <string > (instance <inlineexport>*))
300+ string ::= <core:string >
300301sortidx ::= (<sort> <u32>)
301302sort ::= core <core:sort>
302303 | func
@@ -316,9 +317,9 @@ future include `data`). Thus, component-level `sort` injects the full set
316317of ` core:sort ` , so that they may be referenced (leaving it up to validation
317318rules to throw out the core sorts that aren't allowed in various contexts).
318319
319- The ` name ` production reuses the ` core:name ` quoted-string-literal syntax of
320- Core WebAssembly ( which appears in core module imports and exports and can
321- contain any valid UTF-8 string) .
320+ Component-level ` string ` literals reuse the Core WebAssembly text format's
321+ quoted-string-literal syntax which includes literals such as ` "a" ` , ` "☃︎" ` ,
322+ ` "\7f" ` and ` "\u{7fff}" ` .
322323
323324🪙 The ` value ` sort refers to a value that is provided and consumed during
324325instantiation. How this works is described in the
@@ -338,14 +339,14 @@ instance, the `core export` of a core module instance and a definition of an
338339` outer ` component (containing the current component):
339340``` ebnf
340341alias ::= (alias <aliastarget> (<sort> <id>?))
341- aliastarget ::= export <instanceidx> <name >
342- | core export <core:instanceidx> <core:name >
342+ aliastarget ::= export <instanceidx> <string >
343+ | core export <core:instanceidx> <core:string >
343344 | outer <u32> <u32>
344345```
345346If present, the ` id ` of the alias is bound to the new index added by the alias
346347and can be used anywhere a normal ` id ` can be used.
347348
348- In the case of ` export ` aliases, validation ensures ` name ` is an export in the
349+ In the case of ` export ` aliases, validation ensures ` string ` is an export in the
349350target instance and has a matching sort.
350351
351352In the case of ` outer ` aliases, the ` u32 ` pair serves as a [ de Bruijn index] ,
@@ -395,7 +396,7 @@ sortidx ::= (<sort> <u32>) ;; as above
395396 | <inlinealias>
396397Xidx ::= <u32> ;; as above
397398 | <inlinealias>
398- inlinealias ::= (<sort> <u32> <name >+)
399+ inlinealias ::= (<sort> <u32> <string >+)
399400```
400401If ` <sort> ` refers to a ` <core:sort> ` , then the ` <u32> ` of ` inlinealias ` is a
401402` <core:instanceidx> ` ; otherwise it's an ` <instanceidx> ` . For example, the
@@ -493,8 +494,8 @@ core:moduledecl ::= <core:importdecl>
493494 | <core:exportdecl>
494495core:alias ::= (alias <core:aliastarget> (<core:sort> <id>?))
495496core:aliastarget ::= outer <u32> <u32>
496- core:importdecl ::= (import <core:name > <core:name > <core:importdesc>)
497- core:exportdecl ::= (export <core:name > <core:exportdesc>)
497+ core:importdecl ::= (import <core:string > <core:string > <core:importdesc>)
498+ core:exportdecl ::= (export <core:string > <core:exportdesc>)
498499core:exportdesc ::= strip-id(<core:importdesc>)
499500
500501where strip-id(X) parses '(' sort Y ')' when X parses '(' sort <id>? Y ')'
@@ -2350,7 +2351,7 @@ val ::= false | true
23502351 | <f64canon>
23512352 | nan
23522353 | '<core:stringchar>'
2353- | <core:name >
2354+ | <core:string >
23542355 | (record <val>+)
23552356 | (variant "<label>" <val>?)
23562357 | (list <val>*)
@@ -3237,7 +3238,7 @@ For some use-case-focused, worked examples, see:
32373238[ `core:i64` ] : https://webassembly.github.io/spec/core/text/values.html#text-int
32383239[ `core:f64` ] : https://webassembly.github.io/spec/core/syntax/values.html#floating-point
32393240[ `core:stringchar` ] : https://webassembly.github.io/spec/core/text/values.html#text-string
3240- [ `core:name ` ] : https://webassembly.github.io/spec/core/syntax /values.html#syntax-name
3241+ [ `core:string ` ] : https://webassembly.github.io/spec/core/text /values.html#text-string
32413242[ `core:module` ] : https://webassembly.github.io/spec/core/text/modules.html#text-module
32423243[ `core:type` ] : https://webassembly.github.io/spec/core/text/modules.html#types
32433244[ `core:importdesc` ] : https://webassembly.github.io/spec/core/text/modules.html#text-importdesc
0 commit comments