Skip to content

Commit cdae165

Browse files
authored
Add some language identifier to enable syntax highlighting (#250)
1 parent 673d5c4 commit cdae165

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

design/mvp/Binary.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ and validation will be present in the [formal specification](../../spec/).
1616
## Component Definitions
1717

1818
(See [Component Definitions](Explainer.md#component-definitions) in the explainer.)
19-
```
19+
```ebnf
2020
component ::= <preamble> s*:<section>* => (component flatten(s*))
2121
preamble ::= <magic> <version> <layer>
2222
magic ::= 0x00 0x61 0x73 0x6D
@@ -52,7 +52,7 @@ Notes:
5252
## Instance Definitions
5353

5454
(See [Instance Definitions](Explainer.md#instance-definitions) in the explainer.)
55-
```
55+
```ebnf
5656
core:instance ::= ie:<core:instanceexpr> => (instance ie)
5757
core:instanceexpr ::= 0x00 m:<moduleidx> arg*:vec(<core:instantiatearg>) => (instantiate m arg*)
5858
| 0x01 e*:vec(<core:inlineexport>) => e*
@@ -126,7 +126,7 @@ Notes:
126126
## Alias Definitions
127127

128128
(See [Alias Definitions](Explainer.md#alias-definitions) in the explainer.)
129-
```
129+
```ebnf
130130
alias ::= s:<sort> t:<aliastarget> => (alias t (s))
131131
aliastarget ::= 0x00 i:<instanceidx> n:<string> => export i n
132132
| 0x01 i:<core:instanceidx> n:<core:name> => core export i n
@@ -148,7 +148,7 @@ Notes:
148148
## Type Definitions
149149

150150
(See [Type Definitions](Explainer.md#type-definitions) in the explainer.)
151-
```
151+
```ebnf
152152
core:type ::= dt:<core:deftype> => (type dt) (GC proposal)
153153
core:deftype ::= ft:<core:functype> => ft (WebAssembly 1.0)
154154
| st:<core:structtype> => st (GC proposal)
@@ -176,7 +176,7 @@ Notes:
176176
space. Since core modules and core module types cannot nest in the MVP, this
177177
means that the maximum `ct` in an MVP `alias` declarator is `1`.
178178

179-
```
179+
```ebnf
180180
type ::= dt:<deftype> => (type dt)
181181
deftype ::= dvt:<defvaltype> => dvt
182182
| ft:<functype> => ft
@@ -277,7 +277,7 @@ Notes:
277277
## Canonical Definitions
278278

279279
(See [Canonical Definitions](Explainer.md#canonical-definitions) in the explainer.)
280-
```
280+
```ebnf
281281
canon ::= 0x00 0x00 f:<core:funcidx> opts:<opts> ft:<typeidx> => (canon lift f opts type-index-space[ft])
282282
| 0x01 0x00 f:<funcidx> opts:<opts> => (canon lower f opts (core func))
283283
| 0x02 rt:<typeidx> => (canon resource.new rt (core func))
@@ -302,7 +302,7 @@ Notes:
302302
## Start Definitions
303303

304304
(See [Start Definitions](Explainer.md#start-definitions) in the explainer.)
305-
```
305+
```ebnf
306306
start ::= f:<funcidx> arg*:vec(<valueidx>) r:<u32> => (start f (value arg)* (result (value))ʳ)
307307
```
308308
Notes:
@@ -325,7 +325,7 @@ flags are set.
325325

326326
(See [Import and Export Definitions](Explainer.md#import-and-export-definitions)
327327
in the explainer.)
328-
```
328+
```ebnf
329329
import ::= in:<importname> ed:<externdesc> => (import in ed)
330330
export ::= en:<exportname> si:<sortidx> ed?:<externdesc>? => (export en si ed?)
331331
exportname ::= 0x00 n:<name> => n
@@ -372,7 +372,7 @@ name all the declarations that can happen within a component. Similarly like its
372372
core wasm counterpart validity of this custom section is not required and
373373
engines should not reject components which have an invalid `name` section.
374374

375-
```
375+
```ebnf
376376
namesec ::= section_0(namedata)
377377
namedata ::= n:<name> (if n = 'component-name')
378378
name:<componentnamesubsec>?

design/mvp/CanonicalABI.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ cover each of these `canon` cases.
14141414
### `canon lift`
14151415

14161416
For a canonical definition:
1417-
```
1417+
```wasm
14181418
(canon lift $callee:<funcidx> $opts:<canonopt>* (func $f (type $ft)))
14191419
```
14201420
validation specifies:
@@ -1480,7 +1480,7 @@ actions after the lowering is complete.
14801480
### `canon lower`
14811481

14821482
For a canonical definition:
1483-
```
1483+
```wasm
14841484
(canon lower $callee:<funcidx> $opts:<canonopt>* (core func $f))
14851485
```
14861486
where `$callee` has type `$ft`, validation specifies:
@@ -1568,7 +1568,7 @@ the AOT compiler as requiring an intermediate copy to implement the above
15681568
### `canon resource.new`
15691569

15701570
For a canonical definition:
1571-
```
1571+
```wasm
15721572
(canon resource.new $rt (core func $f))
15731573
```
15741574
validation specifies:
@@ -1588,7 +1588,7 @@ def canon_resource_new(inst, rt, rep):
15881588
### `canon resource.drop`
15891589

15901590
For a canonical definition:
1591-
```
1591+
```wasm
15921592
(canon resource.drop $rt (core func $f))
15931593
```
15941594
validation specifies:
@@ -1618,7 +1618,7 @@ a destructor call is analogous to a call to an export.
16181618
### `canon resource.rep`
16191619

16201620
For a canonical definition:
1621-
```
1621+
```wasm
16221622
(canon resource.rep $rt (core func $f))
16231623
```
16241624
validation specifies:

design/mvp/Explainer.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ below.
5353
### Component Definitions
5454

5555
At the top-level, a `component` is a sequence of definitions of various kinds:
56-
```
56+
```ebnf
5757
component ::= (component <id>? <definition>*)
5858
definition ::= core-prefix(<core:module>)
5959
| core-prefix(<core:instance>)
@@ -130,7 +130,7 @@ then supplying a set of named *arguments* which satisfy all the named *imports*
130130
of the selected module or component.
131131

132132
The syntax for defining a core module instance is:
133-
```
133+
```ebnf
134134
core:instance ::= (instance <id>? <core:instancexpr>)
135135
core:instanceexpr ::= (instantiate <core:moduleidx> <core:instantiatearg>*)
136136
| <core:inlineexport>*
@@ -188,7 +188,7 @@ next section.
188188
The syntax for defining component instances is symmetric to core module
189189
instances, but with an expanded component-level definition of `sort` and
190190
more restricted version of `name`:
191-
```
191+
```ebnf
192192
instance ::= (instance <id>? <instanceexpr>)
193193
instanceexpr ::= (instantiate <componentidx> <instantiatearg>*)
194194
| <inlineexport>*
@@ -267,7 +267,7 @@ into the current component's index spaces. As represented in the AST below,
267267
there are three kinds of "targets" for an alias: the `export` of a component
268268
instance, the `core export` of a core module instance and a definition of an
269269
`outer` component (containing the current component):
270-
```
270+
```ebnf
271271
alias ::= (alias <aliastarget> (<sort> <id>?))
272272
aliastarget ::= export <instanceidx> <string>
273273
| core export <core:instanceidx> <core:name>
@@ -299,7 +299,7 @@ inline:
299299

300300
For `export` aliases, the inline sugar extends the definition of `sortidx`
301301
and the various sort-specific indices:
302-
```
302+
```ebnf
303303
sortidx ::= (<sort> <u32>) ;; as above
304304
| <inlinealias>
305305
Xidx ::= <u32> ;; as above
@@ -389,7 +389,7 @@ type and function definitions which are introduced in the next two sections.
389389

390390
The syntax for defining core types extends the existing core type definition
391391
syntax, adding a `module` type constructor:
392-
```
392+
```ebnf
393393
core:type ::= (type <id>? <core:deftype>) (GC proposal)
394394
core:deftype ::= <core:functype> (WebAssembly 1.0)
395395
| <core:structtype> (GC proposal)
@@ -429,7 +429,7 @@ this, module types start with an empty type index space that is populated by
429429
`type` declarators, so that, in the future, these `type` declarators can refer to
430430
type imports local to the module type itself. For example, in the future, the
431431
following module type would be expressible:
432-
```
432+
```wasm
433433
(component $C
434434
(core type $M (module
435435
(import "" "T" (type $T))
@@ -477,7 +477,7 @@ but use a completely different set of value types. Unlike [`core:valtype`]
477477
which is low-level and assumes a shared linear memory for communicating
478478
compound values, component-level value types assume no shared memory and must
479479
therefore be high-level, describing entire compound values.
480-
```
480+
```ebnf
481481
type ::= (type <id>? <deftype>)
482482
deftype ::= <defvaltype>
483483
| <resourcetype>
@@ -1063,7 +1063,7 @@ two directions:
10631063

10641064
Canonical definitions specify one of these two wrapping directions, the function
10651065
to wrap and a list of configuration options:
1066-
```
1066+
```ebnf
10671067
canon ::= (canon lift core-prefix(<core:funcidx>) <canonopt>* bind-id(<externdesc>))
10681068
| (canon lower <funcidx> <canonopt>* (core func <id>?))
10691069
canonopt ::= string-encoding=utf8
@@ -1187,7 +1187,7 @@ adapt *existing* functions, there are also a set of canonical "built-ins" that
11871187
define core functions out of nothing that can be imported by core modules to
11881188
dynamically interact with Canonical ABI entities like resources (and, when
11891189
async is added to the proposal, [tasks][Future and Stream Types]).
1190-
```
1190+
```ebnf
11911191
canon ::= ...
11921192
| (canon resource.new <typeidx> (core func <id>?))
11931193
| (canon resource.drop <typeidx> (core func <id>?))
@@ -1245,7 +1245,7 @@ Like modules, components can have start functions that are called during
12451245
instantiation. Unlike modules, components can call start functions at multiple
12461246
points during instantiation with each such call having parameters and results.
12471247
Thus, `start` definitions in components look like function calls:
1248-
```
1248+
```ebnf
12491249
start ::= (start <funcidx> (value <valueidx>)* (result (value <id>?))*)
12501250
```
12511251
The `(value <valueidx>)*` list specifies the arguments passed to `funcidx` by
@@ -1257,7 +1257,7 @@ validated to match the signature of `funcidx`.
12571257

12581258
As with all definition sorts, values may be imported and exported by
12591259
components. As an example value import:
1260-
```
1260+
```wasm
12611261
(import "env" (value $env (record (field "locale" (option string)))))
12621262
```
12631263
As this example suggests, value imports can serve as generalized [environment
@@ -1302,7 +1302,7 @@ WebAssembly, as part of the `externdesc` (e.g., `(import "x" (func $iden))`).
13021302
In the case of exports, the `<id>?` right after the `export` is bound (the
13031303
`<id>` inside the `<sortidx>` is a reference to the preceding definition being
13041304
exported). The grammar for imports and exports is:
1305-
```
1305+
```ebnf
13061306
import ::= (import <importname> bind-id(<externdesc>))
13071307
export ::= (export <id>? <exportname> <sortidx> <externdesc>?)
13081308
exportname ::= <name>
@@ -1771,7 +1771,7 @@ to be satisfied by a JavaScript module via ESM-integration:
17711771
export default () => "hi";
17721772
```
17731773
when `bar.wasm` is loaded as an ESM:
1774-
```
1774+
```html
17751775
<script src="bar.wasm" type="module"></script>
17761776
```
17771777

design/mvp/WIT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,13 +1286,13 @@ components is via transfer of unique ownership.
12861286
The resource method syntax defined above is syntactic sugar that expands into
12871287
separate function items that take a first parameter named `self` of type
12881288
`borrow`. For example, the compound definition:
1289-
```
1289+
```wit
12901290
resource file {
12911291
read: func(n: u32) -> list<u8>
12921292
}
12931293
```
12941294
is expanded into:
1295-
```
1295+
```wit
12961296
resource file
12971297
%[method]file.read: func(self: borrow<file>, n: u32) -> list<u8>
12981298
```

0 commit comments

Comments
 (0)