Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions interpreter/text/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -1112,20 +1112,23 @@ memoryuse :
memory :
| LPAR MEMORY bindidx_opt memory_fields RPAR
{ fun c -> let x = $3 c anon_memory bind_memory @@ $sloc in
fun () -> $4 c x $sloc }
let mff = $4 c in
fun () -> mff x $sloc }

memory_fields :
| memorytype
{ fun c x loc -> [Memory ($1 c) @@ loc], [], [], [] }
{ fun c -> fun x loc -> [Memory ($1 c) @@ loc], [], [], [] }
| inline_import memorytype /* Sugar */
{ fun c x loc ->
Comment thread
bvisness marked this conversation as resolved.
{ fun c -> fun x loc ->
[], [],
[Import (fst $1, snd $1, ExternMemoryT ($2 c)) @@ loc], [] }
| inline_export memory_fields /* Sugar */
{ fun c x loc -> let mems, data, ims, exs = $2 c x loc in
{ fun c -> let mff = $2 c in
fun x loc -> let mems, data, ims, exs = mff x loc in
mems, data, ims, $1 (MemoryX x) c :: exs }
| addrtype LPAR DATA string_list RPAR /* Sugar */
{ fun c x loc ->
{ fun c -> ignore (anon_data c $sloc);
fun x loc ->
let size = Int64.(div (add (of_int (String.length $4)) 65535L) 65536L) in
let offset = [at_const $1 (0L @@ loc) @@ loc] @@ loc in
[Memory (MemoryT ($1, {min = size; max = Some size})) @@ loc],
Expand Down Expand Up @@ -1185,23 +1188,26 @@ tableuse :
table :
| LPAR TABLE bindidx_opt table_fields RPAR
{ fun c -> let x = $3 c anon_table bind_table @@ $sloc in
fun () -> $4 c x $sloc }
let tff = $4 c in
fun () -> tff x $sloc }

table_fields :
| tabletype constexpr1
{ fun c x loc -> [Table ($1 c, $2 c) @@ loc], [], [], [] }
{ fun c -> fun x loc -> [Table ($1 c, $2 c) @@ loc], [], [], [] }
| tabletype /* Sugar */
{ fun c x loc -> let TableT (_, _, (_, ht)) as tt = $1 c in
{ fun c -> fun x loc -> let TableT (_, _, (_, ht)) as tt = $1 c in
[Table (tt, [RefNull ht @@ loc] @@ loc) @@ loc], [], [], [] }
| inline_import tabletype /* Sugar */
{ fun c x loc ->
{ fun c -> fun x loc ->
Comment thread
bvisness marked this conversation as resolved.
Outdated
[], [],
[Import (fst $1, snd $1, ExternTableT ($2 c)) @@ loc], [] }
| inline_export table_fields /* Sugar */
{ fun c x loc -> let tabs, elems, ims, exs = $2 c x loc in
{ fun c -> let tff = $2 c in
fun x loc -> let tabs, elems, ims, exs = tff x loc in
tabs, elems, ims, $1 (TableX x) c :: exs }
| addrtype reftype LPAR ELEM elemexpr elemexpr_list RPAR /* Sugar */
{ fun c x loc ->
{ fun c -> ignore (anon_elem c $sloc);
fun x loc ->
let offset = [at_const $1 (0L @@ loc) @@ loc] @@ loc in
let einit = $5 c :: $6 c in
let size = Lib.List64.length einit in
Expand All @@ -1211,7 +1217,8 @@ table_fields :
[Elem (rt, einit, Active (x, offset) @@ loc) @@ loc],
[], [] }
| addrtype reftype LPAR ELEM elemidx_list RPAR /* Sugar */
{ fun c x loc ->
{ fun c -> ignore (anon_elem c $sloc);
fun x loc ->
let (_, ht) as rt = $2 c in
let tinit = [RefNull ht @@ loc] @@ loc in
let offset = [at_const $1 (0L @@ loc) @@ loc] @@ loc in
Expand Down
Loading