Skip to content

Commit

Permalink
add use-path grammar (#245)
Browse files Browse the repository at this point in the history
* add use-path grammar

* re-use interface rule instead of use-path

* Rename interface production to use-path
  • Loading branch information
cardoso authored Sep 13, 2023
1 parent fb99bcb commit 080845b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions design/mvp/WIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,18 +880,18 @@ into the scope of the current file and/or rename interfaces locally for
convenience:

```ebnf
toplevel-use-item ::= 'use' interface ('as' id)?
toplevel-use-item ::= 'use' use-path ('as' id)?
interface ::= id
use-path ::= id
| id ':' id '/' id ('@' valid-semver)?
```

Here `interface` is the ID used to refer to interfaces. The bare form `id`
Here `use-path` is the ID used to refer to interfaces. The bare form `id`
refers to interfaces defined within the current package, and the full form
refers to interfaces in package dependencies.

The `as` syntax can be optionally used to specify a name that should be assigned
to the interface. Otherwise the name is inferred from `interface`.
to the interface. Otherwise the name is inferred from `use-path`.

## Item: `world`

Expand All @@ -905,9 +905,9 @@ world-item ::= 'world' id '{' world-items* '}'
world-items ::= export-item | import-item | use-item | typedef-item | include-item
export-item ::= 'export' id ':' extern-type
| 'export' interface
| 'export' use-path
import-item ::= 'import' id ':' extern-type
| 'import' interface
| 'import' use-path
extern-type ::= func-type | 'interface' '{' interface-items* '}'
```
Expand Down Expand Up @@ -988,7 +988,7 @@ use my:dependency/the-interface.{more, names as foo}
Specifically the structure of this is:

```ebnf
use-item ::= 'use' interface '.' '{' use-names-list '}'
use-item ::= 'use' use-path '.' '{' use-names-list '}'
use-names-list ::= use-names-item
| use-names-item ',' use-names-list?
Expand Down

0 comments on commit 080845b

Please sign in to comment.