@@ -172,8 +172,8 @@ float: <num>.<num>?(e|E <num>)? | 0x<hexnum>.<hexnum>?(p|P <num>)?
172
172
name: $(<letter> | <digit> | _ | . | + | - | * | / | \ | ^ | ~ | = | < | > | ! | ? | @ | # | $ | % | & | | | : | ' | `)+
173
173
string: "(<char> | \n | \t | \\ | \' | \" | \<hex><hex> | \u{<hex>+})*"
174
174
175
- value: <int> | <float>
176
- var: <nat> | <name>
175
+ num: <int> | <float>
176
+ var: <nat> | <name>
177
177
178
178
unop: ctz | clz | popcnt | ...
179
179
binop: add | sub | mul | ...
@@ -183,12 +183,13 @@ offset: offset=<nat>
183
183
align: align=(1|2|4|8|...)
184
184
cvtop: trunc_s | trunc_u | extend_s | extend_u | ...
185
185
186
- val_type: i32 | i64 | f32 | f64
187
- elem_type: anyfunc
186
+ num_type: i32 | i64 | f32 | f64
187
+ ref_type: anyref | anyfunc | anyeqref
188
+ val_type: num_type | ref_type
188
189
block_type : ( result <val_type>* )*
189
190
func_type: ( type <var> )? <param>* <result>*
190
191
global_type: <val_type> | ( mut <val_type> )
191
- table_type: <nat> <nat>? <elem_type >
192
+ table_type: <nat> <nat>? <ref_type >
192
193
memory_type: <nat> <nat>?
193
194
194
195
expr:
@@ -223,16 +224,21 @@ op:
223
224
tee_local <var>
224
225
get_global <var>
225
226
set_global <var>
226
- <val_type>.load((8|16|32)_<sign>)? <offset>? <align>?
227
- <val_type>.store(8|16|32)? <offset>? <align>?
227
+ get_table <var>
228
+ set_table <var>
229
+ <num_type>.load((8|16|32)_<sign>)? <offset>? <align>?
230
+ <num_type>.store(8|16|32)? <offset>? <align>?
228
231
current_memory
229
232
grow_memory
230
- <val_type>.const <value>
231
- <val_type>.<unop>
232
- <val_type>.<binop>
233
- <val_type>.<testop>
234
- <val_type>.<relop>
235
- <val_type>.<cvtop>/<val_type>
233
+ ref.null
234
+ ref.isnull
235
+ ref.eq
236
+ <num_type>.const <num>
237
+ <num_type>.<unop>
238
+ <num_type>.<binop>
239
+ <num_type>.<testop>
240
+ <num_type>.<relop>
241
+ <num_type>.<cvtop>/<num_type>
236
242
237
243
func: ( func <name>? <func_type> <local>* <instr>* )
238
244
( func <name>? ( export <string> ) <...> ) ;; = (export <string> (func <N>)) (func <name>? <...>)
@@ -247,7 +253,7 @@ global: ( global <name>? <global_type> <instr>* )
247
253
table: ( table <name>? <table_type> )
248
254
( table <name>? ( export <string> ) <...> ) ;; = (export <string> (table <N>)) (table <name>? <...>)
249
255
( table <name>? ( import <string> <string> ) <table_type> ) ;; = (import <name>? <string> <string> (table <table_type>))
250
- ( table <name>? ( export <string> )* <elem_type > ( elem <var>* ) ) ;; = (table <name>? ( export <string> )* <size> <size> <elem_type >) (elem (i32.const 0) <var>*)
256
+ ( table <name>? ( export <string> )* <ref_type > ( elem <var>* ) ) ;; = (table <name>? ( export <string> )* <size> <size> <ref_type >) (elem (i32.const 0) <var>*)
251
257
elem: ( elem <var>? (offset <instr>* ) <var>* )
252
258
( elem <var>? <expr> <var>* ) ;; = (elem <var>? (offset <expr>) <var>*)
253
259
memory: ( memory <name>? <memory_type> )
@@ -272,9 +278,9 @@ exkind: ( func <var> )
272
278
( table <var> )
273
279
( memory <var> )
274
280
275
- module: ( module <name>? <typedef>* <func>* <import>* <export>* <table>? <memory>? <global>* <elem>* <data>* <start>? )
276
- <typedef>* <func>* <import>* <export>* <table>? <memory>? <global>* <elem>* <data>* <start>? ;; =
277
- ( module <typedef>* <func>* <import>* <export>* <table>? <memory>? <global>* <elem>* <data>* <start>? )
281
+ module: ( module <name>? <typedef>* <func>* <import>* <export>* <table>* <memory>? <global>* <elem>* <data>* <start>? )
282
+ <typedef>* <func>* <import>* <export>* <table>* <memory>? <global>* <elem>* <data>* <start>? ;; =
283
+ ( module <typedef>* <func>* <import>* <export>* <table>* <memory>? <global>* <elem>* <data>* <start>? )
278
284
```
279
285
280
286
Here, productions marked with respective comments are abbreviation forms for equivalent expansions (see the explanation of the AST below).
@@ -320,11 +326,16 @@ module:
320
326
( module <name>? quote <string>* ) ;; module quoted in text (may be malformed)
321
327
322
328
action:
323
- ( invoke <name>? <string> <expr >* ) ;; invoke function export
329
+ ( invoke <name>? <string> <const >* ) ;; invoke function export
324
330
( get <name>? <string> ) ;; get global export
325
331
332
+ const:
333
+ ( <num_type>.const <num> ) ;; number value
334
+ ( ref.null ) ;; null reference
335
+ ( ref.host <nat> ) ;; host reference
336
+
326
337
assertion:
327
- ( assert_return <action> <expr >* ) ;; assert action has expected results
338
+ ( assert_return <action> <const >* ) ;; assert action has expected results
328
339
( assert_return_canonical_nan <action> ) ;; assert action results in NaN in a canonical form
329
340
( assert_return_arithmetic_nan <action> ) ;; assert action results in NaN with 1 in MSB of fraction field
330
341
( assert_trap <action> <failure> ) ;; assert action traps with given failure string
0 commit comments