Skip to content

Commit ef441ec

Browse files
committed
added include statement
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
1 parent e97d22a commit ef441ec

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

design/mvp/WIT.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -625,21 +625,22 @@ bare as an identifier. These are used to help parse the format, and the list of
625625
keywords is still in flux at this time but the current set is:
626626

627627
```ebnf
628-
keyword ::= 'use'
629-
| 'type'
630-
| 'resource'
631-
| 'func'
632-
| 'record'
628+
keyword ::= 'default'
633629
| 'enum'
630+
| 'export'
634631
| 'flags'
635-
| 'variant'
636-
| 'union'
637-
| 'static'
632+
| 'func'
633+
| 'import'
634+
| 'include'
638635
| 'interface'
636+
| 'record'
637+
| 'resource'
638+
| 'static'
639+
| 'type'
640+
| 'union'
641+
| 'use'
642+
| 'variant'
639643
| 'world'
640-
| 'import'
641-
| 'export'
642-
| 'default'
643644
```
644645

645646
## Top-level items
@@ -662,7 +663,7 @@ Concretely, the structure of a world is:
662663
```ebnf
663664
world-item ::= 'default'? 'world' id '{' world-items* '}'
664665
665-
world-items ::= export-item | import-item | use-item | typedef-item
666+
world-items ::= export-item | import-item | use-item | typedef-item | include-item
666667
667668
export-item ::= 'export' id ':' extern-type
668669
import-item ::= 'import' id ':' extern-type
@@ -676,6 +677,25 @@ interface-type ::= 'interface' '{' interface-items* '}'
676677
Note that worlds can import types and define their own types to be exported
677678
from the root of a component and used within functions imported and exported.
678679

680+
## Item: `include`
681+
682+
A `include` statement enables union the current world with another world. The structure of an `include` statement is:
683+
684+
```wit
685+
include pkg.my-world-1 with { a as a1, b as b1 }
686+
include self.my-world-2
687+
```
688+
689+
```ebnf
690+
include-item ::= 'include' use-path
691+
| 'include' use-path 'with' '{' include-names-list '}'
692+
693+
include-names-list ::= include-names-item
694+
| include-names-item ',' include-names-item?
695+
696+
include-names-item ::= id 'as' id
697+
```
698+
679699
## Item: `interface`
680700

681701
Interfaces can be defined in a `wit` document. Interfaces have a name and a

0 commit comments

Comments
 (0)