(typ "N" (inst (alias nat)))
(typ "M" (inst (alias nat)))
(typ "K" (inst (alias nat)))
(typ "n" (inst (alias nat)))
(typ "m" (inst (alias nat)))
(def
"min"
(exp "nat" nat)
(exp "nat" nat)
nat
(clause
(exp "i" nat)
(exp "j" nat)
(exp (var "i"))
(exp (var "j"))
(var "i")
(if (cmp le nat (var "i") (var "j")))
)
(clause
(exp "i" nat)
(exp "j" nat)
(exp (var "i"))
(exp (var "j"))
(var "j")
else
)
)
(rec
(def
"sum"
(exp "_" (iter nat list))
nat
(clause (exp (list)) (num (nat 0)))
(clause
(exp "n" (var "n"))
(exp "n'*" (iter (var "n") list))
(exp (cat (list (var "n")) (iter (var "n'") list (dom "n'" (var "n'*")))))
(bin
add
nat
(var "n")
(call "sum" (exp (iter (var "n'") list (dom "n'" (var "n'*")))))
)
)
)
)
(rec
(def
"prod"
(exp "_" (iter nat list))
nat
(clause (exp (list)) (num (nat 1)))
(clause
(exp "n" (var "n"))
(exp "n'*" (iter (var "n") list))
(exp (cat (list (var "n")) (iter (var "n'") list (dom "n'" (var "n'*")))))
(bin
mul
nat
(var "n")
(call "prod" (exp (iter (var "n'") list (dom "n'" (var "n'*")))))
)
)
)
)
(def
"opt_"
(typ "X")
(exp "_" (iter (var "X") list))
(iter (var "X") opt)
(clause (typ "X") (typ (var "X")) (exp (list)) (opt))
(clause
(typ "X")
(exp "w" (var "X"))
(typ (var "X"))
(exp (list (var "w")))
(opt (var "w"))
)
)
(rec
(def
"concat_"
(typ "X")
(exp "_" (iter (iter (var "X") list) list))
(iter (var "X") list)
(clause (typ "X") (typ (var "X")) (exp (list)) (list))
(clause
(typ "X")
(exp "w*" (iter (var "X") list))
(exp "w'**" (iter (iter (var "X") list) list))
(typ (var "X"))
(exp
(cat
(list (iter (var "w") list (dom "w" (var "w*"))))
(iter
(iter (var "w'") list (dom "w'" (var "w'*")))
list
(dom "w'*" (var "w'**"))
)
)
)
(cat
(iter (var "w") list (dom "w" (var "w*")))
(call
"concat_"
(typ (var "X"))
(exp
(iter
(iter (var "w'") list (dom "w'" (var "w'*")))
list
(dom "w'*" (var "w'**"))
)
)
)
)
)
)
)
(rec
(def
"concatn_"
(typ "X")
(exp "_" (iter (iter (var "X") list) list))
(exp "nat" nat)
(iter (var "X") list)
(clause
(typ "X")
(exp "n" (var "n"))
(typ (var "X"))
(exp (list))
(exp (var "n"))
(list)
)
(clause
(typ "X")
(exp "w*" (iter (var "X") list))
(exp "n" (var "n"))
(exp "w'**" (iter (iter (var "X") list) list))
(typ (var "X"))
(exp
(cat
(list (iter (var "w") (listn (var "n")) (dom "w" (var "w*"))))
(iter
(iter (var "w'") (listn (var "n")) (dom "w'" (var "w'*")))
list
(dom "w'*" (var "w'**"))
)
)
)
(exp (var "n"))
(cat
(iter (var "w") (listn (var "n")) (dom "w" (var "w*")))
(call
"concatn_"
(typ (var "X"))
(exp
(iter
(iter (var "w'") (listn (var "n")) (dom "w'" (var "w'*")))
list
(dom "w'*" (var "w'**"))
)
)
(exp (var "n"))
)
)
)
)
)
(def
"concatopt_"
(typ "X")
(exp "_" (iter (iter (var "X") opt) list))
(iter (var "X") list)
(clause (typ "X") (typ (var "X")) (exp (list)) (list))
(clause
(typ "X")
(exp "w?" (iter (var "X") opt))
(exp "w'?*" (iter (iter (var "X") opt) list))
(typ (var "X"))
(exp
(cat
(list (iter (var "w") opt (dom "w" (var "w?"))))
(iter
(iter (var "w'") opt (dom "w'" (var "w'?")))
list
(dom "w'?" (var "w'?*"))
)
)
)
(cat
(lift (iter (var "w") opt (dom "w" (var "w?"))))
(call
"concat_"
(typ (var "X"))
(exp
(iter
(lift (iter (var "w'") opt (dom "w'" (var "w'?"))))
list
(dom "w'?" (var "w'?*"))
)
)
)
)
)
)
(def
"inv_concat_"
(typ "X")
(exp "_" (iter (var "X") list))
(iter (iter (var "X") list) list)
)
(def
"inv_concatn_"
(typ "X")
(exp "nat" nat)
(exp "_" (iter (var "X") list))
(iter (iter (var "X") list) list)
)
(rec
(def
"disjoint_"
(typ "X")
(exp "_" (iter (var "X") list))
bool
(clause (typ "X") (typ (var "X")) (exp (list)) (bool true))
(clause
(typ "X")
(exp "w" (var "X"))
(exp "w'*" (iter (var "X") list))
(typ (var "X"))
(exp (cat (list (var "w")) (iter (var "w'") list (dom "w'" (var "w'*")))))
(bin
and
bool
(un
not
bool
(mem (var "w") (iter (var "w'") list (dom "w'" (var "w'*"))))
)
(call
"disjoint_"
(typ (var "X"))
(exp (iter (var "w'") list (dom "w'" (var "w'*"))))
)
)
)
)
)
(rec
(def
"setminus1_"
(typ "X")
(exp "X" (var "X"))
(exp "_" (iter (var "X") list))
(iter (var "X") list)
(clause
(typ "X")
(exp "w" (var "X"))
(typ (var "X"))
(exp (var "w"))
(exp (list))
(list (var "w"))
)
(clause
(typ "X")
(exp "w" (var "X"))
(exp "w_1" (var "X"))
(exp "w'*" (iter (var "X") list))
(typ (var "X"))
(exp (var "w"))
(exp
(cat (list (var "w_1")) (iter (var "w'") list (dom "w'" (var "w'*"))))
)
(list)
(if (cmp eq bool (var "w") (var "w_1")))
)
(clause
(typ "X")
(exp "w" (var "X"))
(exp "w_1" (var "X"))
(exp "w'*" (iter (var "X") list))
(typ (var "X"))
(exp (var "w"))
(exp
(cat (list (var "w_1")) (iter (var "w'") list (dom "w'" (var "w'*"))))
)
(call
"setminus1_"
(typ (var "X"))
(exp (var "w"))
(exp (iter (var "w'") list (dom "w'" (var "w'*"))))
)
else
)
)
)
(rec
(def
"setminus_"
(typ "X")
(exp "_" (iter (var "X") list))
(exp "_" (iter (var "X") list))
(iter (var "X") list)
(clause
(typ "X")
(exp "w*" (iter (var "X") list))
(typ (var "X"))
(exp (list))
(exp (iter (var "w") list (dom "w" (var "w*"))))
(list)
)
(clause
(typ "X")
(exp "w_1" (var "X"))
(exp "w'*" (iter (var "X") list))
(exp "w*" (iter (var "X") list))
(typ (var "X"))
(exp
(cat (list (var "w_1")) (iter (var "w'") list (dom "w'" (var "w'*"))))
)
(exp (iter (var "w") list (dom "w" (var "w*"))))
(cat
(call
"setminus1_"
(typ (var "X"))
(exp (var "w_1"))
(exp (iter (var "w") list (dom "w" (var "w*"))))
)
(call
"setminus_"
(typ (var "X"))
(exp (iter (var "w'") list (dom "w'" (var "w'*"))))
(exp (iter (var "w") list (dom "w" (var "w*"))))
)
)
)
)
)
(rec
(def
"setproduct2_"
(typ "X")
(exp "X" (var "X"))
(exp "_" (iter (iter (var "X") list) list))
(iter (iter (var "X") list) list)
(clause
(typ "X")
(exp "w_1" (var "X"))
(typ (var "X"))
(exp (var "w_1"))
(exp (list))
(list)
)
(clause
(typ "X")
(exp "w_1" (var "X"))
(exp "w'*" (iter (var "X") list))
(exp "w**" (iter (iter (var "X") list) list))
(typ (var "X"))
(exp (var "w_1"))
(exp
(cat
(list (iter (var "w'") list (dom "w'" (var "w'*"))))
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
)
(cat
(list
(cat (list (var "w_1")) (iter (var "w'") list (dom "w'" (var "w'*"))))
)
(call
"setproduct2_"
(typ (var "X"))
(exp (var "w_1"))
(exp
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
)
)
)
)
)
(rec
(def
"setproduct1_"
(typ "X")
(exp "_" (iter (var "X") list))
(exp "_" (iter (iter (var "X") list) list))
(iter (iter (var "X") list) list)
(clause
(typ "X")
(exp "w**" (iter (iter (var "X") list) list))
(typ (var "X"))
(exp (list))
(exp
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
(list)
)
(clause
(typ "X")
(exp "w_1" (var "X"))
(exp "w'*" (iter (var "X") list))
(exp "w**" (iter (iter (var "X") list) list))
(typ (var "X"))
(exp
(cat (list (var "w_1")) (iter (var "w'") list (dom "w'" (var "w'*"))))
)
(exp
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
(cat
(call
"setproduct2_"
(typ (var "X"))
(exp (var "w_1"))
(exp
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
)
(call
"setproduct1_"
(typ (var "X"))
(exp (iter (var "w'") list (dom "w'" (var "w'*"))))
(exp
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
)
)
)
)
)
(rec
(def
"setproduct_"
(typ "X")
(exp "_" (iter (iter (var "X") list) list))
(iter (iter (var "X") list) list)
(clause (typ "X") (typ (var "X")) (exp (list)) (list (list)))
(clause
(typ "X")
(exp "w_1*" (iter (var "X") list))
(exp "w**" (iter (iter (var "X") list) list))
(typ (var "X"))
(exp
(cat
(list (iter (var "w_1") list (dom "w_1" (var "w_1*"))))
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
)
(call
"setproduct1_"
(typ (var "X"))
(exp (iter (var "w_1") list (dom "w_1" (var "w_1*"))))
(exp
(call
"setproduct_"
(typ (var "X"))
(exp
(iter
(iter (var "w") list (dom "w" (var "w*")))
list
(dom "w*" (var "w**"))
)
)
)
)
)
)
)
)
(def "ND" bool)
(typ
"bit"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
or
bool
(cmp eq bool (var "i") (num (nat 0)))
(cmp eq bool (var "i") (num (nat 1)))
)
)
)
)
)
)
(typ
"byte"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
and
bool
(cmp ge nat (var "i") (num (nat 0)))
(cmp le nat (var "i") (num (nat 255)))
)
)
)
)
)
)
(typ
"uN"
(exp "N" (var "N"))
(inst
(exp "N" (var "N"))
(exp (var "N"))
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
and
bool
(cmp ge nat (var "i") (num (nat 0)))
(cmp
le
nat
(var "i")
(cvt
int
nat
(bin
sub
int
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
)
(typ
"sN"
(exp "N" (var "N"))
(inst
(exp "N" (var "N"))
(exp (var "N"))
(variant
(case
"%"
(exp "i" int)
(tup (bind (var "i") int))
(if
(bin
or
bool
(bin
or
bool
(bin
and
bool
(cmp
ge
int
(var "i")
(un
minus
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(cmp
le
int
(var "i")
(un minus int (cvt nat int (num (nat 1))))
)
)
(cmp eq bool (var "i") (cvt nat int (num (nat 0))))
)
(bin
and
bool
(cmp ge int (var "i") (un plus int (cvt nat int (num (nat 1)))))
(cmp
le
int
(var "i")
(bin
sub
int
(un
plus
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
)
(typ
"iN"
(exp "N" (var "N"))
(inst (exp "N" (var "N")) (exp (var "N")) (alias (var "uN" (exp (var "N")))))
)
(typ "u8" (inst (alias (var "uN" (exp (num (nat 8)))))))
(typ "u16" (inst (alias (var "uN" (exp (num (nat 16)))))))
(typ "u31" (inst (alias (var "uN" (exp (num (nat 31)))))))
(typ "u32" (inst (alias (var "uN" (exp (num (nat 32)))))))
(typ "u64" (inst (alias (var "uN" (exp (num (nat 64)))))))
(typ "u128" (inst (alias (var "uN" (exp (num (nat 128)))))))
(typ "s33" (inst (alias (var "sN" (exp (num (nat 33)))))))
(def
"signif"
(exp "N" (var "N"))
nat
(clause (exp (num (nat 32))) (num (nat 23)))
(clause (exp (num (nat 64))) (num (nat 52)))
)
(def
"expon"
(exp "N" (var "N"))
nat
(clause (exp (num (nat 32))) (num (nat 8)))
(clause (exp (num (nat 64))) (num (nat 11)))
)
(def
"M"
(exp "N" (var "N"))
nat
(clause (exp "N" (var "N")) (exp (var "N")) (call "signif" (exp (var "N"))))
)
(def
"E"
(exp "N" (var "N"))
nat
(clause (exp "N" (var "N")) (exp (var "N")) (call "expon" (exp (var "N"))))
)
(typ "exp" (inst (alias int)))
(typ
"fNmag"
(exp "N" (var "N"))
(inst
(exp "N" (var "N"))
(exp (var "N"))
(variant
(case
"NORM%%"
(exp "m" (var "m"))
(exp "exp" (var "exp"))
(tup (bind (var "m") (var "m")) (bind (var "exp") (var "exp")))
(if
(bin
and
bool
(cmp
lt
nat
(var "m")
(bin pow nat (num (nat 2)) (call "M" (exp (var "N"))))
)
(bin
and
bool
(cmp
le
int
(bin
sub
int
(cvt nat int (num (nat 2)))
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (call "E" (exp (var "N"))))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(var "exp")
)
(cmp
le
int
(var "exp")
(bin
sub
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (call "E" (exp (var "N"))))
(cvt nat int (num (nat 1)))
)
)
)
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case
"SUBNORM%"
(exp "m" (var "m"))
(exp "exp" (var "exp"))
(tup (bind (var "m") (var "m")))
(if
(bin
and
bool
(cmp
lt
nat
(var "m")
(bin pow nat (num (nat 2)) (call "M" (exp (var "N"))))
)
(cmp
eq
bool
(bin
sub
int
(cvt nat int (num (nat 2)))
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (call "E" (exp (var "N"))))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(var "exp")
)
)
)
)
(case "INF" (tup))
(case
"NAN%"
(exp "m" (var "m"))
(tup (bind (var "m") (var "m")))
(if
(bin
and
bool
(cmp le nat (num (nat 1)) (var "m"))
(cmp
lt
nat
(var "m")
(bin pow nat (num (nat 2)) (call "M" (exp (var "N"))))
)
)
)
)
)
)
)
(typ
"fN"
(exp "N" (var "N"))
(inst
(exp "N" (var "N"))
(exp (var "N"))
(variant
(case
"POS%"
(exp "fNmag" (var "fNmag" (exp (var "N"))))
(tup (bind (var "fNmag") (var "fNmag" (exp (var "N")))))
)
(case
"NEG%"
(exp "fNmag" (var "fNmag" (exp (var "N"))))
(tup (bind (var "fNmag") (var "fNmag" (exp (var "N")))))
)
)
)
)
(typ "f32" (inst (alias (var "fN" (exp (num (nat 32)))))))
(typ "f64" (inst (alias (var "fN" (exp (num (nat 64)))))))
(def
"fzero"
(exp "N" (var "N"))
(var "fN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp (var "N"))
(case "POS%" (tup (case "SUBNORM%" (tup (num (nat 0))))))
)
)
(def
"fnat"
(exp "N" (var "N"))
(exp "nat" nat)
(var "fN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "n" (var "n"))
(exp (var "N"))
(exp (var "n"))
(case
"POS%"
(tup (case "NORM%%" (tup (var "n") (cvt nat int (num (nat 0))))))
)
)
)
(def
"fone"
(exp "N" (var "N"))
(var "fN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp (var "N"))
(case
"POS%"
(tup (case "NORM%%" (tup (num (nat 1)) (cvt nat int (num (nat 0))))))
)
)
)
(def
"canon_"
(exp "N" (var "N"))
nat
(clause
(exp "N" (var "N"))
(exp (var "N"))
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (call "signif" (exp (var "N"))))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(typ
"vN"
(exp "N" (var "N"))
(inst (exp "N" (var "N")) (exp (var "N")) (alias (var "uN" (exp (var "N")))))
)
(typ "v128" (inst (alias (var "vN" (exp (num (nat 128)))))))
(typ
"list"
(typ "X")
(inst
(typ "X")
(typ (var "X"))
(variant
(case
"%"
(exp "X*" (iter (var "X") list))
(tup
(bind
(iter (var "X") list (dom "X" (var "X*")))
(iter (var "X") list)
)
)
(if
(cmp
lt
nat
(len (iter (var "X") list (dom "X" (var "X*"))))
(bin pow nat (num (nat 2)) (num (nat 32)))
)
)
)
)
)
)
(typ
"char"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
or
bool
(bin
and
bool
(cmp ge nat (var "i") (num (nat 0)))
(cmp le nat (var "i") (num (nat 55295)))
)
(bin
and
bool
(cmp ge nat (var "i") (num (nat 57344)))
(cmp le nat (var "i") (num (nat 1114111)))
)
)
)
)
)
)
)
(def
"cont"
(exp "byte" (var "byte"))
nat
(clause
(exp "b" (var "byte"))
(exp (var "b"))
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "b") "%") 0))
(cvt nat int (num (nat 128)))
)
)
(if
(bin
and
bool
(cmp lt nat (num (nat 128)) (proj (uncase (var "b") "%") 0))
(cmp lt nat (proj (uncase (var "b") "%") 0) (num (nat 192)))
)
)
)
)
(rec
(def
"utf8"
(exp "_" (iter (var "char") list))
(iter (var "byte") list)
(clause
(exp "ch*" (iter (var "char") list))
(exp (iter (var "ch") list (dom "ch" (var "ch*"))))
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "utf8" (exp (list (var "ch"))))
list
(dom "ch" (var "ch*"))
)
)
)
)
(clause
(exp "ch" (var "char"))
(exp "b" (var "byte"))
(exp (list (var "ch")))
(list (var "b"))
(if (cmp lt nat (proj (uncase (var "ch") "%") 0) (num (nat 128))))
(if
(cmp
eq
bool
(case "%" (tup (proj (uncase (var "ch") "%") 0)))
(var "b")
)
)
)
(clause
(exp "ch" (var "char"))
(exp "b_1" (var "byte"))
(exp "b_2" (var "byte"))
(exp (list (var "ch")))
(list (var "b_1") (var "b_2"))
(if
(bin
and
bool
(cmp le nat (num (nat 128)) (proj (uncase (var "ch") "%") 0))
(cmp lt nat (proj (uncase (var "ch") "%") 0) (num (nat 2048)))
)
)
(if
(cmp
eq
bool
(proj (uncase (var "ch") "%") 0)
(bin
add
nat
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 6)))
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "b_1") "%") 0))
(cvt nat int (num (nat 192)))
)
)
)
(call "cont" (exp (var "b_2")))
)
)
)
)
(clause
(exp "ch" (var "char"))
(exp "b_1" (var "byte"))
(exp "b_2" (var "byte"))
(exp "b_3" (var "byte"))
(exp (list (var "ch")))
(list (var "b_1") (var "b_2") (var "b_3"))
(if
(bin
or
bool
(bin
and
bool
(cmp le nat (num (nat 2048)) (proj (uncase (var "ch") "%") 0))
(cmp lt nat (proj (uncase (var "ch") "%") 0) (num (nat 55296)))
)
(bin
and
bool
(cmp le nat (num (nat 57344)) (proj (uncase (var "ch") "%") 0))
(cmp lt nat (proj (uncase (var "ch") "%") 0) (num (nat 65536)))
)
)
)
(if
(cmp
eq
bool
(proj (uncase (var "ch") "%") 0)
(bin
add
nat
(bin
add
nat
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 12)))
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "b_1") "%") 0))
(cvt nat int (num (nat 224)))
)
)
)
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 6)))
(call "cont" (exp (var "b_2")))
)
)
(call "cont" (exp (var "b_3")))
)
)
)
)
(clause
(exp "ch" (var "char"))
(exp "b_1" (var "byte"))
(exp "b_2" (var "byte"))
(exp "b_3" (var "byte"))
(exp "b_4" (var "byte"))
(exp (list (var "ch")))
(list (var "b_1") (var "b_2") (var "b_3") (var "b_4"))
(if
(bin
and
bool
(cmp le nat (num (nat 65536)) (proj (uncase (var "ch") "%") 0))
(cmp lt nat (proj (uncase (var "ch") "%") 0) (num (nat 69632)))
)
)
(if
(cmp
eq
bool
(proj (uncase (var "ch") "%") 0)
(bin
add
nat
(bin
add
nat
(bin
add
nat
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 18)))
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "b_1") "%") 0))
(cvt nat int (num (nat 240)))
)
)
)
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 12)))
(call "cont" (exp (var "b_2")))
)
)
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 6)))
(call "cont" (exp (var "b_3")))
)
)
(call "cont" (exp (var "b_4")))
)
)
)
)
)
)
(typ
"name"
(inst
(variant
(case
"%"
(exp "char*" (iter (var "char") list))
(tup
(bind
(iter (var "char") list (dom "char" (var "char*")))
(iter (var "char") list)
)
)
(if
(cmp
lt
nat
(len
(call
"utf8"
(exp (iter (var "char") list (dom "char" (var "char*"))))
)
)
(bin pow nat (num (nat 2)) (num (nat 32)))
)
)
)
)
)
)
(typ "idx" (inst (alias (var "u32"))))
(typ "laneidx" (inst (alias (var "u8"))))
(typ "typeidx" (inst (alias (var "idx"))))
(typ "funcidx" (inst (alias (var "idx"))))
(typ "globalidx" (inst (alias (var "idx"))))
(typ "tableidx" (inst (alias (var "idx"))))
(typ "memidx" (inst (alias (var "idx"))))
(typ "tagidx" (inst (alias (var "idx"))))
(typ "elemidx" (inst (alias (var "idx"))))
(typ "dataidx" (inst (alias (var "idx"))))
(typ "labelidx" (inst (alias (var "idx"))))
(typ "localidx" (inst (alias (var "idx"))))
(typ "fieldidx" (inst (alias (var "idx"))))
(typ
"externidx"
(inst
(variant
(case
"FUNC%"
(exp "funcidx" (var "funcidx"))
(tup (bind (var "funcidx") (var "funcidx")))
)
(case
"GLOBAL%"
(exp "globalidx" (var "globalidx"))
(tup (bind (var "globalidx") (var "globalidx")))
)
(case
"TABLE%"
(exp "tableidx" (var "tableidx"))
(tup (bind (var "tableidx") (var "tableidx")))
)
(case
"MEM%"
(exp "memidx" (var "memidx"))
(tup (bind (var "memidx") (var "memidx")))
)
(case
"TAG%"
(exp "tagidx" (var "tagidx"))
(tup (bind (var "tagidx") (var "tagidx")))
)
)
)
)
(rec
(def
"funcsxx"
(exp "_" (iter (var "externidx") list))
(iter (var "typeidx") list)
(clause (exp (list)) (list))
(clause
(exp "x" (var "idx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (case "FUNC%" (tup (var "x"))))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(cat
(list (var "x"))
(call "funcsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
)
)
(clause
(exp "externidx" (var "externidx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (var "externidx"))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(call "funcsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
else
)
)
)
(rec
(def
"globalsxx"
(exp "_" (iter (var "externidx") list))
(iter (var "globalidx") list)
(clause (exp (list)) (list))
(clause
(exp "x" (var "idx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (case "GLOBAL%" (tup (var "x"))))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(cat
(list (var "x"))
(call "globalsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
)
)
(clause
(exp "externidx" (var "externidx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (var "externidx"))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(call "globalsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
else
)
)
)
(rec
(def
"tablesxx"
(exp "_" (iter (var "externidx") list))
(iter (var "tableidx") list)
(clause (exp (list)) (list))
(clause
(exp "x" (var "idx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (case "TABLE%" (tup (var "x"))))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(cat
(list (var "x"))
(call "tablesxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
)
)
(clause
(exp "externidx" (var "externidx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (var "externidx"))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(call "tablesxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
else
)
)
)
(rec
(def
"memsxx"
(exp "_" (iter (var "externidx") list))
(iter (var "memidx") list)
(clause (exp (list)) (list))
(clause
(exp "x" (var "idx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (case "MEM%" (tup (var "x"))))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(cat
(list (var "x"))
(call "memsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
)
)
(clause
(exp "externidx" (var "externidx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (var "externidx"))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(call "memsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
else
)
)
)
(rec
(def
"tagsxx"
(exp "_" (iter (var "externidx") list))
(iter (var "tagidx") list)
(clause (exp (list)) (list))
(clause
(exp "x" (var "idx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (case "TAG%" (tup (var "x"))))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(cat
(list (var "x"))
(call "tagsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
)
)
(clause
(exp "externidx" (var "externidx"))
(exp "xx*" (iter (var "externidx") list))
(exp
(cat
(list (var "externidx"))
(iter (var "xx") list (dom "xx" (var "xx*")))
)
)
(call "tagsxx" (exp (iter (var "xx") list (dom "xx" (var "xx*")))))
else
)
)
)
(typ
"free"
(inst
(struct
(field
"TYPES"
(exp "typeidx*" (iter (var "typeidx") list))
(iter (var "typeidx") list)
)
(field
"FUNCS"
(exp "funcidx*" (iter (var "funcidx") list))
(iter (var "funcidx") list)
)
(field
"GLOBALS"
(exp "globalidx*" (iter (var "globalidx") list))
(iter (var "globalidx") list)
)
(field
"TABLES"
(exp "tableidx*" (iter (var "tableidx") list))
(iter (var "tableidx") list)
)
(field
"MEMS"
(exp "memidx*" (iter (var "memidx") list))
(iter (var "memidx") list)
)
(field
"ELEMS"
(exp "elemidx*" (iter (var "elemidx") list))
(iter (var "elemidx") list)
)
(field
"DATAS"
(exp "dataidx*" (iter (var "dataidx") list))
(iter (var "dataidx") list)
)
(field
"LOCALS"
(exp "localidx*" (iter (var "localidx") list))
(iter (var "localidx") list)
)
(field
"LABELS"
(exp "labelidx*" (iter (var "labelidx") list))
(iter (var "labelidx") list)
)
)
)
)
(def
"free_opt"
(exp "_" (iter (var "free") opt))
(var "free")
(clause
(exp (opt))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause (exp "free" (var "free")) (exp (opt (var "free"))) (var "free"))
)
(rec
(def
"free_list"
(exp "_" (iter (var "free") list))
(var "free")
(clause
(exp (list))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "free" (var "free"))
(exp "free'*" (iter (var "free") list))
(exp
(cat
(list (var "free"))
(iter (var "free'") list (dom "free'" (var "free'*")))
)
)
(comp
(var "free")
(call
"free_list"
(exp (iter (var "free'") list (dom "free'" (var "free'*"))))
)
)
)
)
)
(def
"free_typeidx"
(exp "typeidx" (var "typeidx"))
(var "free")
(clause
(exp "typeidx" (var "typeidx"))
(exp (var "typeidx"))
(struct
(field "TYPES" (list (var "typeidx")))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_funcidx"
(exp "funcidx" (var "funcidx"))
(var "free")
(clause
(exp "funcidx" (var "funcidx"))
(exp (var "funcidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list (var "funcidx")))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_globalidx"
(exp "globalidx" (var "globalidx"))
(var "free")
(clause
(exp "globalidx" (var "globalidx"))
(exp (var "globalidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list (var "globalidx")))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_tableidx"
(exp "tableidx" (var "tableidx"))
(var "free")
(clause
(exp "tableidx" (var "tableidx"))
(exp (var "tableidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list (var "tableidx")))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_memidx"
(exp "memidx" (var "memidx"))
(var "free")
(clause
(exp "memidx" (var "memidx"))
(exp (var "memidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list (var "memidx")))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_elemidx"
(exp "elemidx" (var "elemidx"))
(var "free")
(clause
(exp "elemidx" (var "elemidx"))
(exp (var "elemidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list (var "elemidx")))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_dataidx"
(exp "dataidx" (var "dataidx"))
(var "free")
(clause
(exp "dataidx" (var "dataidx"))
(exp (var "dataidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list (var "dataidx")))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_localidx"
(exp "localidx" (var "localidx"))
(var "free")
(clause
(exp "localidx" (var "localidx"))
(exp (var "localidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list (var "localidx")))
(field "LABELS" (list))
)
)
)
(def
"free_labelidx"
(exp "labelidx" (var "labelidx"))
(var "free")
(clause
(exp "labelidx" (var "labelidx"))
(exp (var "labelidx"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list (var "labelidx")))
)
)
)
(def
"free_externidx"
(exp "externidx" (var "externidx"))
(var "free")
(clause
(exp "funcidx" (var "funcidx"))
(exp (case "FUNC%" (tup (var "funcidx"))))
(call "free_funcidx" (exp (var "funcidx")))
)
(clause
(exp "globalidx" (var "globalidx"))
(exp (case "GLOBAL%" (tup (var "globalidx"))))
(call "free_globalidx" (exp (var "globalidx")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp (case "TABLE%" (tup (var "tableidx"))))
(call "free_tableidx" (exp (var "tableidx")))
)
(clause
(exp "memidx" (var "memidx"))
(exp (case "MEM%" (tup (var "memidx"))))
(call "free_memidx" (exp (var "memidx")))
)
)
(typ "null" (inst (variant (case "NULL" (tup)))))
(typ "addrtype" (inst (variant (case "I32" (tup)) (case "I64" (tup)))))
(typ
"numtype"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
)
)
)
(typ "vectype" (inst (variant (case "V128" (tup)))))
(typ
"consttype"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
(case "V128" (tup))
)
)
)
(typ
"absheaptype"
(inst
(variant
(case "ANY" (tup))
(case "EQ" (tup))
(case "I31" (tup))
(case "STRUCT" (tup))
(case "ARRAY" (tup))
(case "NONE" (tup))
(case "FUNC" (tup))
(case "NOFUNC" (tup))
(case "EXN" (tup))
(case "NOEXN" (tup))
(case "EXTERN" (tup))
(case "NOEXTERN" (tup))
(case "BOT" (tup))
)
)
)
(typ "mut" (inst (variant (case "MUT" (tup)))))
(typ "final" (inst (variant (case "FINAL" (tup)))))
(rec
(typ
"typeuse"
(inst
(variant
(case
"_IDX%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case
"_DEF%%"
(exp "rectype" (var "rectype"))
(exp "n" (var "n"))
(tup
(bind (var "rectype") (var "rectype"))
(bind (var "n") (var "n"))
)
)
(case "REC%" (exp "n" (var "n")) (tup (bind (var "n") (var "n"))))
)
)
)
(typ
"heaptype"
(inst
(variant
(case "ANY" (tup))
(case "EQ" (tup))
(case "I31" (tup))
(case "STRUCT" (tup))
(case "ARRAY" (tup))
(case "NONE" (tup))
(case "FUNC" (tup))
(case "NOFUNC" (tup))
(case "EXN" (tup))
(case "NOEXN" (tup))
(case "EXTERN" (tup))
(case "NOEXTERN" (tup))
(case "BOT" (tup))
(case
"_IDX%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case "REC%" (exp "n" (var "n")) (tup (bind (var "n") (var "n"))))
(case
"_DEF%%"
(exp "rectype" (var "rectype"))
(exp "n" (var "n"))
(tup
(bind (var "rectype") (var "rectype"))
(bind (var "n") (var "n"))
)
)
)
)
)
(typ
"valtype"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
(case "V128" (tup))
(case
"REF%%"
(exp "null?" (iter (var "null") opt))
(exp "heaptype" (var "heaptype"))
(tup
(bind
(iter (var "null") opt (dom "null" (var "null?")))
(iter (var "null") opt)
)
(bind (var "heaptype") (var "heaptype"))
)
)
(case "BOT" (tup))
)
)
)
(typ
"storagetype"
(inst
(variant
(case "BOT" (tup))
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
(case "V128" (tup))
(case
"REF%%"
(exp "null?" (iter (var "null") opt))
(exp "heaptype" (var "heaptype"))
(tup
(bind
(iter (var "null") opt (dom "null" (var "null?")))
(iter (var "null") opt)
)
(bind (var "heaptype") (var "heaptype"))
)
)
(case "I8" (tup))
(case "I16" (tup))
)
)
)
(typ "resulttype" (inst (alias (var "list" (typ (var "valtype"))))))
(typ
"fieldtype"
(inst
(variant
(case
"%%"
(exp "mut?" (iter (var "mut") opt))
(exp "storagetype" (var "storagetype"))
(tup
(bind
(iter (var "mut") opt (dom "mut" (var "mut?")))
(iter (var "mut") opt)
)
(bind (var "storagetype") (var "storagetype"))
)
)
)
)
)
(typ
"comptype"
(inst
(variant
(case
"STRUCT%"
(exp "list" (var "list" (typ (var "fieldtype"))))
(tup (bind (var "list") (var "list" (typ (var "fieldtype")))))
)
(case
"ARRAY%"
(exp "fieldtype" (var "fieldtype"))
(tup (bind (var "fieldtype") (var "fieldtype")))
)
(case
"FUNC%->%"
(exp "resulttype" (var "resulttype"))
(tup
(bind (var "resulttype") (var "resulttype"))
(bind (var "_") (var "resulttype"))
)
)
)
)
)
(typ
"subtype"
(inst
(variant
(case
"SUB%%%"
(exp "final?" (iter (var "final") opt))
(exp "typeuse*" (iter (var "typeuse") list))
(exp "comptype" (var "comptype"))
(tup
(bind
(iter (var "final") opt (dom "final" (var "final?")))
(iter (var "final") opt)
)
(bind
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(iter (var "typeuse") list)
)
(bind (var "comptype") (var "comptype"))
)
)
)
)
)
(typ
"rectype"
(inst
(variant
(case
"REC%"
(exp "list" (var "list" (typ (var "subtype"))))
(tup (bind (var "list") (var "list" (typ (var "subtype")))))
)
)
)
)
)
(typ
"deftype"
(inst
(variant
(case
"_DEF%%"
(exp "rectype" (var "rectype"))
(exp "n" (var "n"))
(tup (bind (var "rectype") (var "rectype")) (bind (var "n") (var "n")))
)
)
)
)
(typ
"typevar"
(inst
(variant
(case
"_IDX%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case "REC%" (exp "n" (var "n")) (tup (bind (var "n") (var "n"))))
)
)
)
(typ
"reftype"
(inst
(variant
(case
"REF%%"
(exp "null?" (iter (var "null") opt))
(exp "heaptype" (var "heaptype"))
(tup
(bind
(iter (var "null") opt (dom "null" (var "null?")))
(iter (var "null") opt)
)
(bind (var "heaptype") (var "heaptype"))
)
)
)
)
)
(typ "Inn" (inst (variant (case "I32" (tup)) (case "I64" (tup)))))
(typ "Fnn" (inst (variant (case "F32" (tup)) (case "F64" (tup)))))
(typ "Vnn" (inst (variant (case "V128" (tup)))))
(typ
"Cnn"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
(case "V128" (tup))
)
)
)
(def
"ANYREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "ANY" (tup)))))
)
(def
"EQREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "EQ" (tup)))))
)
(def
"I31REF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "I31" (tup)))))
)
(def
"STRUCTREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "STRUCT" (tup)))))
)
(def
"ARRAYREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "ARRAY" (tup)))))
)
(def
"FUNCREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "FUNC" (tup)))))
)
(def
"EXNREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "EXN" (tup)))))
)
(def
"EXTERNREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "EXTERN" (tup)))))
)
(def
"NULLREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "NONE" (tup)))))
)
(def
"NULLFUNCREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "NOFUNC" (tup)))))
)
(def
"NULLEXNREF"
(var "reftype")
(clause (case "REF%%" (tup (opt (case "NULL" (tup))) (case "NOEXN" (tup)))))
)
(def
"NULLEXTERNREF"
(var "reftype")
(clause
(case "REF%%" (tup (opt (case "NULL" (tup))) (case "NOEXTERN" (tup))))
)
)
(typ "packtype" (inst (variant (case "I8" (tup)) (case "I16" (tup)))))
(typ
"lanetype"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
(case "I8" (tup))
(case "I16" (tup))
)
)
)
(typ "Pnn" (inst (alias (var "packtype"))))
(typ
"Jnn"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "I8" (tup))
(case "I16" (tup))
)
)
)
(typ
"Lnn"
(inst
(variant
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
(case "I8" (tup))
(case "I16" (tup))
)
)
)
(typ
"limits"
(inst
(variant
(case
"[%..%]"
(exp "u64" (var "u64"))
(tup
(bind (var "u64") (var "u64"))
(bind (var "_") (iter (var "u64") opt))
)
)
)
)
)
(typ "tagtype" (inst (alias (var "typeuse"))))
(typ
"globaltype"
(inst
(variant
(case
"%%"
(exp "mut?" (iter (var "mut") opt))
(exp "valtype" (var "valtype"))
(tup
(bind
(iter (var "mut") opt (dom "mut" (var "mut?")))
(iter (var "mut") opt)
)
(bind (var "valtype") (var "valtype"))
)
)
)
)
)
(typ
"memtype"
(inst
(variant
(case
"%%PAGE"
(exp "addrtype" (var "addrtype"))
(exp "limits" (var "limits"))
(tup
(bind (var "addrtype") (var "addrtype"))
(bind (var "limits") (var "limits"))
)
)
)
)
)
(typ
"tabletype"
(inst
(variant
(case
"%%%"
(exp "addrtype" (var "addrtype"))
(exp "limits" (var "limits"))
(exp "reftype" (var "reftype"))
(tup
(bind (var "addrtype") (var "addrtype"))
(bind (var "limits") (var "limits"))
(bind (var "reftype") (var "reftype"))
)
)
)
)
)
(typ "datatype" (inst (variant (case "OK" (tup)))))
(typ "elemtype" (inst (alias (var "reftype"))))
(typ
"externtype"
(inst
(variant
(case
"TAG%"
(exp "tagtype" (var "tagtype"))
(tup (bind (var "tagtype") (var "tagtype")))
)
(case
"GLOBAL%"
(exp "globaltype" (var "globaltype"))
(tup (bind (var "globaltype") (var "globaltype")))
)
(case
"MEM%"
(exp "memtype" (var "memtype"))
(tup (bind (var "memtype") (var "memtype")))
)
(case
"TABLE%"
(exp "tabletype" (var "tabletype"))
(tup (bind (var "tabletype") (var "tabletype")))
)
(case
"FUNC%"
(exp "typeuse" (var "typeuse"))
(tup (bind (var "typeuse") (var "typeuse")))
)
)
)
)
(typ
"moduletype"
(inst
(variant
(case
"%->%"
(exp "externtype*" (iter (var "externtype") list))
(tup
(bind
(iter
(var "externtype")
list
(dom "externtype" (var "externtype*"))
)
(iter (var "externtype") list)
)
(bind (var "_") (iter (var "externtype") list))
)
)
)
)
)
(def
"IN"
(exp "N" (var "N"))
(var "Inn")
(clause (exp (num (nat 32))) (case "I32" (tup)))
(clause (exp (num (nat 64))) (case "I64" (tup)))
)
(def
"FN"
(exp "N" (var "N"))
(var "Fnn")
(clause (exp (num (nat 32))) (case "F32" (tup)))
(clause (exp (num (nat 64))) (case "F64" (tup)))
)
(def
"JN"
(exp "N" (var "N"))
(var "Jnn")
(clause (exp (num (nat 8))) (case "I8" (tup)))
(clause (exp (num (nat 16))) (case "I16" (tup)))
(clause (exp (num (nat 32))) (case "I32" (tup)))
(clause (exp (num (nat 64))) (case "I64" (tup)))
)
(def
"size"
(exp "numtype" (var "numtype"))
nat
(clause (exp (case "I32" (tup))) (num (nat 32)))
(clause (exp (case "I64" (tup))) (num (nat 64)))
(clause (exp (case "F32" (tup))) (num (nat 32)))
(clause (exp (case "F64" (tup))) (num (nat 64)))
)
(def
"vsize"
(exp "vectype" (var "vectype"))
nat
(clause (exp (case "V128" (tup))) (num (nat 128)))
)
(def
"psize"
(exp "packtype" (var "packtype"))
nat
(clause (exp (case "I8" (tup))) (num (nat 8)))
(clause (exp (case "I16" (tup))) (num (nat 16)))
)
(def
"lsize"
(exp "lanetype" (var "lanetype"))
nat
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
(call "size" (exp (var "numtype")))
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
(call "psize" (exp (var "packtype")))
)
)
(def
"zsize"
(exp "storagetype" (var "storagetype"))
nat
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "storagetype") (var "numtype")))
(call "size" (exp (var "numtype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp (sub (var "vectype") (var "storagetype") (var "vectype")))
(call "vsize" (exp (var "vectype")))
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(call "psize" (exp (var "packtype")))
)
)
(def
"isize"
(exp "Inn" (var "Inn"))
nat
(clause
(exp "Inn" (var "Inn"))
(exp (var "Inn"))
(call "size" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
)
(def
"jsize"
(exp "Jnn" (var "Jnn"))
nat
(clause
(exp "Jnn" (var "Jnn"))
(exp (var "Jnn"))
(call "lsize" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
)
)
(def
"fsize"
(exp "Fnn" (var "Fnn"))
nat
(clause
(exp "Fnn" (var "Fnn"))
(exp (var "Fnn"))
(call "size" (exp (sub (var "Fnn") (var "numtype") (var "Fnn"))))
)
)
(def
"inv_isize"
(exp "nat" nat)
(var "Inn")
(clause (exp (num (nat 32))) (case "I32" (tup)))
(clause (exp (num (nat 64))) (case "I64" (tup)))
)
(def
"inv_jsize"
(exp "nat" nat)
(var "Jnn")
(clause (exp (num (nat 8))) (case "I8" (tup)))
(clause (exp (num (nat 16))) (case "I16" (tup)))
(clause
(exp "n" (var "n"))
(exp (var "n"))
(sub (var "Inn") (var "Jnn") (call "inv_isize" (exp (var "n"))))
)
)
(def
"inv_fsize"
(exp "nat" nat)
(var "Fnn")
(clause (exp (num (nat 32))) (case "F32" (tup)))
(clause (exp (num (nat 64))) (case "F64" (tup)))
)
(def
"sizenn"
(exp "numtype" (var "numtype"))
nat
(clause
(exp "nt" (var "numtype"))
(exp (var "nt"))
(call "size" (exp (var "nt")))
)
)
(def
"sizenn1"
(exp "numtype" (var "numtype"))
nat
(clause
(exp "nt" (var "numtype"))
(exp (var "nt"))
(call "size" (exp (var "nt")))
)
)
(def
"sizenn2"
(exp "numtype" (var "numtype"))
nat
(clause
(exp "nt" (var "numtype"))
(exp (var "nt"))
(call "size" (exp (var "nt")))
)
)
(def
"vsizenn"
(exp "vectype" (var "vectype"))
nat
(clause
(exp "vt" (var "vectype"))
(exp (var "vt"))
(call "vsize" (exp (var "vt")))
)
)
(def
"psizenn"
(exp "packtype" (var "packtype"))
nat
(clause
(exp "pt" (var "packtype"))
(exp (var "pt"))
(call "psize" (exp (var "pt")))
)
)
(def
"lsizenn"
(exp "lanetype" (var "lanetype"))
nat
(clause
(exp "lt" (var "lanetype"))
(exp (var "lt"))
(call "lsize" (exp (var "lt")))
)
)
(def
"lsizenn1"
(exp "lanetype" (var "lanetype"))
nat
(clause
(exp "lt" (var "lanetype"))
(exp (var "lt"))
(call "lsize" (exp (var "lt")))
)
)
(def
"lsizenn2"
(exp "lanetype" (var "lanetype"))
nat
(clause
(exp "lt" (var "lanetype"))
(exp (var "lt"))
(call "lsize" (exp (var "lt")))
)
)
(def
"jsizenn"
(exp "Jnn" (var "Jnn"))
nat
(clause
(exp "Jnn" (var "Jnn"))
(exp (var "Jnn"))
(call "lsize" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
)
)
(def
"inv_jsizenn"
(exp "nat" nat)
(var "Jnn")
(clause
(exp "n" (var "n"))
(exp (var "n"))
(call "inv_jsize" (exp (var "n")))
)
)
(def
"lunpack"
(exp "lanetype" (var "lanetype"))
(var "numtype")
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
(var "numtype")
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
(case "I32" (tup))
)
)
(def
"unpack"
(exp "storagetype" (var "storagetype"))
(var "valtype")
(clause
(exp "valtype" (var "valtype"))
(exp (sub (var "valtype") (var "storagetype") (var "valtype")))
(var "valtype")
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(case "I32" (tup))
)
)
(def
"nunpack"
(exp "storagetype" (var "storagetype"))
(var "numtype")
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "storagetype") (var "numtype")))
(var "numtype")
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(case "I32" (tup))
)
)
(def
"vunpack"
(exp "storagetype" (var "storagetype"))
(var "vectype")
(clause
(exp "vectype" (var "vectype"))
(exp (sub (var "vectype") (var "storagetype") (var "vectype")))
(var "vectype")
)
)
(def
"cunpack"
(exp "storagetype" (var "storagetype"))
(var "consttype")
(clause
(exp "consttype" (var "consttype"))
(exp (sub (var "consttype") (var "storagetype") (var "consttype")))
(var "consttype")
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(case "I32" (tup))
)
(clause
(exp "lanetype" (var "lanetype"))
(exp (sub (var "lanetype") (var "storagetype") (var "lanetype")))
(sub
(var "numtype")
(var "consttype")
(call "lunpack" (exp (var "lanetype")))
)
)
)
(def
"minat"
(exp "addrtype" (var "addrtype"))
(exp "addrtype" (var "addrtype"))
(var "addrtype")
(clause
(exp "at_1" (var "addrtype"))
(exp "at_2" (var "addrtype"))
(exp (var "at_1"))
(exp (var "at_2"))
(var "at_1")
(if
(cmp
le
nat
(call "size" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
(call "size" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
)
)
(clause
(exp "at_1" (var "addrtype"))
(exp "at_2" (var "addrtype"))
(exp (var "at_1"))
(exp (var "at_2"))
(var "at_2")
else
)
)
(def
"diffrt"
(exp "reftype" (var "reftype"))
(exp "reftype" (var "reftype"))
(var "reftype")
(clause
(exp "null_1?" (iter (var "null") opt))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
(exp
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(var "ht_1")
)
)
)
(exp (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht_2"))))
(case "REF%%" (tup (opt) (var "ht_1")))
)
(clause
(exp "null_1?" (iter (var "null") opt))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
(exp
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(var "ht_1")
)
)
)
(exp (case "REF%%" (tup (opt) (var "ht_2"))))
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(var "ht_1")
)
)
)
)
(def
"as_deftype"
(exp "typeuse" (var "typeuse"))
(var "deftype")
(clause
(exp "dt" (var "deftype"))
(exp (sub (var "deftype") (var "typeuse") (var "dt")))
(var "dt")
)
)
(rec
(def
"tagsxt"
(exp "_" (iter (var "externtype") list))
(iter (var "tagtype") list)
(clause (exp (list)) (list))
(clause
(exp "jt" (var "tagtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (case "TAG%" (tup (var "jt"))))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(cat
(list (var "jt"))
(call "tagsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
)
)
(clause
(exp "externtype" (var "externtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (var "externtype"))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(call "tagsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
else
)
)
)
(rec
(def
"globalsxt"
(exp "_" (iter (var "externtype") list))
(iter (var "globaltype") list)
(clause (exp (list)) (list))
(clause
(exp "gt" (var "globaltype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (case "GLOBAL%" (tup (var "gt"))))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(cat
(list (var "gt"))
(call "globalsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
)
)
(clause
(exp "externtype" (var "externtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (var "externtype"))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(call "globalsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
else
)
)
)
(rec
(def
"memsxt"
(exp "_" (iter (var "externtype") list))
(iter (var "memtype") list)
(clause (exp (list)) (list))
(clause
(exp "mt" (var "memtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (case "MEM%" (tup (var "mt"))))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(cat
(list (var "mt"))
(call "memsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
)
)
(clause
(exp "externtype" (var "externtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (var "externtype"))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(call "memsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
else
)
)
)
(rec
(def
"tablesxt"
(exp "_" (iter (var "externtype") list))
(iter (var "tabletype") list)
(clause (exp (list)) (list))
(clause
(exp "tt" (var "tabletype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (case "TABLE%" (tup (var "tt"))))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(cat
(list (var "tt"))
(call "tablesxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
)
)
(clause
(exp "externtype" (var "externtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (var "externtype"))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(call "tablesxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
else
)
)
)
(rec
(def
"funcsxt"
(exp "_" (iter (var "externtype") list))
(iter (var "deftype") list)
(clause (exp (list)) (list))
(clause
(exp "dt" (var "deftype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list
(case
"FUNC%"
(tup (sub (var "deftype") (var "typeuse") (var "dt")))
)
)
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(cat
(list (var "dt"))
(call "funcsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
)
)
(clause
(exp "externtype" (var "externtype"))
(exp "xt*" (iter (var "externtype") list))
(exp
(cat
(list (var "externtype"))
(iter (var "xt") list (dom "xt" (var "xt*")))
)
)
(call "funcsxt" (exp (iter (var "xt") list (dom "xt" (var "xt*")))))
else
)
)
)
(rec
(def
"subst_typevar"
(exp "typevar" (var "typevar"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "typeuse")
(clause
(exp "tv" (var "typevar"))
(exp (var "tv"))
(exp (list))
(exp (list))
(sub (var "typevar") (var "typeuse") (var "tv"))
)
(clause
(exp "tv" (var "typevar"))
(exp "tv_1" (var "typevar"))
(exp "tv'*" (iter (var "typevar") list))
(exp "tu_1" (var "typeuse"))
(exp "tu'*" (iter (var "typeuse") list))
(exp (var "tv"))
(exp
(cat
(list (var "tv_1"))
(iter (var "tv'") list (dom "tv'" (var "tv'*")))
)
)
(exp
(cat
(list (var "tu_1"))
(iter (var "tu'") list (dom "tu'" (var "tu'*")))
)
)
(var "tu_1")
(if (cmp eq bool (var "tv") (var "tv_1")))
)
(clause
(exp "tv" (var "typevar"))
(exp "tv_1" (var "typevar"))
(exp "tv'*" (iter (var "typevar") list))
(exp "tu_1" (var "typeuse"))
(exp "tu'*" (iter (var "typeuse") list))
(exp (var "tv"))
(exp
(cat
(list (var "tv_1"))
(iter (var "tv'") list (dom "tv'" (var "tv'*")))
)
)
(exp
(cat
(list (var "tu_1"))
(iter (var "tu'") list (dom "tu'" (var "tu'*")))
)
)
(call
"subst_typevar"
(exp (var "tv"))
(exp (iter (var "tv'") list (dom "tv'" (var "tv'*"))))
(exp (iter (var "tu'") list (dom "tu'" (var "tu'*"))))
)
else
)
)
)
(rec
(def
"minus_recs"
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(tup
(bind (var "_") (iter (var "typevar") list))
(bind (var "_") (iter (var "typeuse") list))
)
(clause (exp (list)) (exp (list)) (tup (list) (list)))
(clause
(exp "n" (var "n"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu_1" (var "typeuse"))
(exp "tu*" (iter (var "typeuse") list))
(exp
(cat
(list (case "REC%" (tup (var "n"))))
(iter (var "tv") list (dom "tv" (var "tv*")))
)
)
(exp
(cat (list (var "tu_1")) (iter (var "tu") list (dom "tu" (var "tu*"))))
)
(call
"minus_recs"
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
(clause
(exp "x" (var "idx"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu_1" (var "typeuse"))
(exp "tu*" (iter (var "typeuse") list))
(exp "tv'*" (iter (var "typevar") list))
(exp "tu'*" (iter (var "typeuse") list))
(exp
(cat
(list (case "_IDX%" (tup (var "x"))))
(iter (var "tv") list (dom "tv" (var "tv*")))
)
)
(exp
(cat (list (var "tu_1")) (iter (var "tu") list (dom "tu" (var "tu*"))))
)
(tup
(cat
(list (case "_IDX%" (tup (var "x"))))
(iter (var "tv'") list (dom "tv'" (var "tv'*")))
)
(cat
(list (var "tu_1"))
(iter (var "tu'") list (dom "tu'" (var "tu'*")))
)
)
(if
(cmp
eq
bool
(tup
(iter (var "tv'") list (dom "tv'" (var "tv'*")))
(iter (var "tu'") list (dom "tu'" (var "tu'*")))
)
(call
"minus_recs"
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
)
(def
"subst_packtype"
(exp "packtype" (var "packtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "packtype")
(clause
(exp "pt" (var "packtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (var "pt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(var "pt")
)
)
(def
"subst_numtype"
(exp "numtype" (var "numtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "numtype")
(clause
(exp "nt" (var "numtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (var "nt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(var "nt")
)
)
(def
"subst_vectype"
(exp "vectype" (var "vectype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "vectype")
(clause
(exp "vt" (var "vectype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (var "vt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(var "vt")
)
)
(rec
(def
"subst_typeuse"
(exp "typeuse" (var "typeuse"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "typeuse")
(clause
(exp "tv'" (var "typevar"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "typevar") (var "typeuse") (var "tv'")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(call
"subst_typevar"
(exp (var "tv'"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
(clause
(exp "dt" (var "deftype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "deftype") (var "typeuse") (var "dt")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "deftype")
(var "typeuse")
(call
"subst_deftype"
(exp (var "dt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(def
"subst_heaptype"
(exp "heaptype" (var "heaptype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "heaptype")
(clause
(exp "tv'" (var "typevar"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "typevar") (var "heaptype") (var "tv'")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "typeuse")
(var "heaptype")
(call
"subst_typevar"
(exp (var "tv'"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(clause
(exp "dt" (var "deftype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "deftype") (var "heaptype") (var "dt")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "deftype")
(var "heaptype")
(call
"subst_deftype"
(exp (var "dt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(clause
(exp "ht" (var "heaptype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (var "ht"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(var "ht")
else
)
)
(def
"subst_reftype"
(exp "reftype" (var "reftype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "reftype")
(clause
(exp "null?" (iter (var "null") opt))
(exp "ht" (var "heaptype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"REF%%"
(tup (iter (var "null") opt (dom "null" (var "null?"))) (var "ht"))
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"REF%%"
(tup
(iter (var "null") opt (dom "null" (var "null?")))
(call
"subst_heaptype"
(exp (var "ht"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"subst_valtype"
(exp "valtype" (var "valtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "valtype")
(clause
(exp "nt" (var "numtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "numtype") (var "valtype") (var "nt")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "numtype")
(var "valtype")
(call
"subst_numtype"
(exp (var "nt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(clause
(exp "vt" (var "vectype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "vectype") (var "valtype") (var "vt")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "vectype")
(var "valtype")
(call
"subst_vectype"
(exp (var "vt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(clause
(exp "rt" (var "reftype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "reftype") (var "valtype") (var "rt")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "reftype")
(var "valtype")
(call
"subst_reftype"
(exp (var "rt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(clause
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "BOT" (tup)))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case "BOT" (tup))
)
)
(def
"subst_storagetype"
(exp "storagetype" (var "storagetype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "storagetype")
(clause
(exp "t" (var "valtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "valtype") (var "storagetype") (var "t")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "valtype")
(var "storagetype")
(call
"subst_valtype"
(exp (var "t"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(clause
(exp "pt" (var "packtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (sub (var "packtype") (var "storagetype") (var "pt")))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(sub
(var "packtype")
(var "storagetype")
(call
"subst_packtype"
(exp (var "pt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(def
"subst_fieldtype"
(exp "fieldtype" (var "fieldtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "fieldtype")
(clause
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(call
"subst_storagetype"
(exp (var "zt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"subst_comptype"
(exp "comptype" (var "comptype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "comptype")
(clause
(exp "ft*" (iter (var "fieldtype") list))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"STRUCT%"
(tup (case "%" (tup (iter (var "ft") list (dom "ft" (var "ft*"))))))
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(call
"subst_fieldtype"
(exp (var "ft"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
list
(dom "ft" (var "ft*"))
)
)
)
)
)
)
(clause
(exp "ft" (var "fieldtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "ARRAY%" (tup (var "ft"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"ARRAY%"
(tup
(call
"subst_fieldtype"
(exp (var "ft"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(clause
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"FUNC%->%"
(tup
(case
"%"
(tup
(iter
(call
"subst_valtype"
(exp (var "t_1"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
list
(dom "t_1" (var "t_1*"))
)
)
)
(case
"%"
(tup
(iter
(call
"subst_valtype"
(exp (var "t_2"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
list
(dom "t_2" (var "t_2*"))
)
)
)
)
)
)
)
(def
"subst_subtype"
(exp "subtype" (var "subtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "subtype")
(clause
(exp "final?" (iter (var "final") opt))
(exp "tu'*" (iter (var "typeuse") list))
(exp "ct" (var "comptype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"SUB%%%"
(tup
(iter (var "final") opt (dom "final" (var "final?")))
(iter (var "tu'") list (dom "tu'" (var "tu'*")))
(var "ct")
)
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"SUB%%%"
(tup
(iter (var "final") opt (dom "final" (var "final?")))
(iter
(call
"subst_typeuse"
(exp (var "tu'"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
list
(dom "tu'" (var "tu'*"))
)
(call
"subst_comptype"
(exp (var "ct"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"subst_rectype"
(exp "rectype" (var "rectype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "rectype")
(clause
(exp "st*" (iter (var "subtype") list))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp "tv'*" (iter (var "typevar") list))
(exp "tu'*" (iter (var "typeuse") list))
(exp
(case
"REC%"
(tup (case "%" (tup (iter (var "st") list (dom "st" (var "st*"))))))
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(call
"subst_subtype"
(exp (var "st"))
(exp (iter (var "tv'") list (dom "tv'" (var "tv'*"))))
(exp (iter (var "tu'") list (dom "tu'" (var "tu'*"))))
)
list
(dom "st" (var "st*"))
)
)
)
)
)
(if
(cmp
eq
bool
(tup
(iter (var "tv'") list (dom "tv'" (var "tv'*")))
(iter (var "tu'") list (dom "tu'" (var "tu'*")))
)
(call
"minus_recs"
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"subst_deftype"
(exp "deftype" (var "deftype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "deftype")
(clause
(exp "qt" (var "rectype"))
(exp "i" (var "n"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "_DEF%%" (tup (var "qt") (var "i"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"_DEF%%"
(tup
(call
"subst_rectype"
(exp (var "qt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
(var "i")
)
)
)
)
)
(def
"subst_addrtype"
(exp "addrtype" (var "addrtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "addrtype")
(clause
(exp "at" (var "addrtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (var "at"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(var "at")
)
)
(def
"subst_tagtype"
(exp "tagtype" (var "tagtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "tagtype")
(clause
(exp "tu'" (var "typeuse"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (var "tu'"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(call
"subst_typeuse"
(exp (var "tu'"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_globaltype"
(exp "globaltype" (var "globaltype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "globaltype")
(clause
(exp "mut?" (iter (var "mut") opt))
(exp "t" (var "valtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "t"))
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(call
"subst_valtype"
(exp (var "t"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"subst_memtype"
(exp "memtype" (var "memtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "memtype")
(clause
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "%%PAGE" (tup (var "at") (var "lim"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(def
"subst_tabletype"
(exp "tabletype" (var "tabletype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "tabletype")
(clause
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "%%%" (tup (var "at") (var "lim") (var "rt"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"%%%"
(tup
(var "at")
(var "lim")
(call
"subst_reftype"
(exp (var "rt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"subst_externtype"
(exp "externtype" (var "externtype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "externtype")
(clause
(exp "jt" (var "tagtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "TAG%" (tup (var "jt"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"TAG%"
(tup
(call
"subst_tagtype"
(exp (var "jt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(clause
(exp "gt" (var "globaltype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "GLOBAL%" (tup (var "gt"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"GLOBAL%"
(tup
(call
"subst_globaltype"
(exp (var "gt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(clause
(exp "tt" (var "tabletype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "TABLE%" (tup (var "tt"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"TABLE%"
(tup
(call
"subst_tabletype"
(exp (var "tt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(clause
(exp "mt" (var "memtype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "MEM%" (tup (var "mt"))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"MEM%"
(tup
(call
"subst_memtype"
(exp (var "mt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
(clause
(exp "dt" (var "deftype"))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp (case "FUNC%" (tup (sub (var "deftype") (var "typeuse") (var "dt")))))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"FUNC%"
(tup
(sub
(var "deftype")
(var "typeuse")
(call
"subst_deftype"
(exp (var "dt"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
)
(def
"subst_moduletype"
(exp "moduletype" (var "moduletype"))
(exp "_" (iter (var "typevar") list))
(exp "_" (iter (var "typeuse") list))
(var "moduletype")
(clause
(exp "xt_1*" (iter (var "externtype") list))
(exp "xt_2*" (iter (var "externtype") list))
(exp "tv*" (iter (var "typevar") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(case
"%->%"
(tup
(iter (var "xt_1") list (dom "xt_1" (var "xt_1*")))
(iter (var "xt_2") list (dom "xt_2" (var "xt_2*")))
)
)
)
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(case
"%->%"
(tup
(iter
(call
"subst_externtype"
(exp (var "xt_1"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
list
(dom "xt_1" (var "xt_1*"))
)
(iter
(call
"subst_externtype"
(exp (var "xt_2"))
(exp (iter (var "tv") list (dom "tv" (var "tv*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
list
(dom "xt_2" (var "xt_2*"))
)
)
)
)
)
(def
"subst_all_valtype"
(exp "valtype" (var "valtype"))
(exp "_" (iter (var "typeuse") list))
(var "valtype")
(clause
(exp "t" (var "valtype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "t"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_valtype"
(exp (var "t"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_reftype"
(exp "reftype" (var "reftype"))
(exp "_" (iter (var "typeuse") list))
(var "reftype")
(clause
(exp "rt" (var "reftype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "rt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_reftype"
(exp (var "rt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_deftype"
(exp "deftype" (var "deftype"))
(exp "_" (iter (var "typeuse") list))
(var "deftype")
(clause
(exp "dt" (var "deftype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "dt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_deftype"
(exp (var "dt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_tagtype"
(exp "tagtype" (var "tagtype"))
(exp "_" (iter (var "typeuse") list))
(var "tagtype")
(clause
(exp "jt" (var "tagtype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "jt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_tagtype"
(exp (var "jt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_globaltype"
(exp "globaltype" (var "globaltype"))
(exp "_" (iter (var "typeuse") list))
(var "globaltype")
(clause
(exp "gt" (var "globaltype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "gt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_globaltype"
(exp (var "gt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_memtype"
(exp "memtype" (var "memtype"))
(exp "_" (iter (var "typeuse") list))
(var "memtype")
(clause
(exp "mt" (var "memtype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "mt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_memtype"
(exp (var "mt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_tabletype"
(exp "tabletype" (var "tabletype"))
(exp "_" (iter (var "typeuse") list))
(var "tabletype")
(clause
(exp "tt" (var "tabletype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "tt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_tabletype"
(exp (var "tt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_externtype"
(exp "externtype" (var "externtype"))
(exp "_" (iter (var "typeuse") list))
(var "externtype")
(clause
(exp "xt" (var "externtype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "xt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_externtype"
(exp (var "xt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(def
"subst_all_moduletype"
(exp "moduletype" (var "moduletype"))
(exp "_" (iter (var "typeuse") list))
(var "moduletype")
(clause
(exp "mmt" (var "moduletype"))
(exp "tu*" (iter (var "typeuse") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "mmt"))
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
(call
"subst_moduletype"
(exp (var "mmt"))
(exp
(iter
(case "_IDX%" (tup (case "%" (tup (var "i")))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp (iter (var "tu") (listn (var "n")) (dom "tu" (var "tu*"))))
)
)
)
(rec
(def
"subst_all_deftypes"
(exp "_" (iter (var "deftype") list))
(exp "_" (iter (var "typeuse") list))
(iter (var "deftype") list)
(clause
(exp "tu*" (iter (var "typeuse") list))
(exp (list))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(list)
)
(clause
(exp "dt_1" (var "deftype"))
(exp "dt*" (iter (var "deftype") list))
(exp "tu*" (iter (var "typeuse") list))
(exp
(cat (list (var "dt_1")) (iter (var "dt") list (dom "dt" (var "dt*"))))
)
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
(cat
(list
(call
"subst_all_deftype"
(exp (var "dt_1"))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
(call
"subst_all_deftypes"
(exp (iter (var "dt") list (dom "dt" (var "dt*"))))
(exp (iter (var "tu") list (dom "tu" (var "tu*"))))
)
)
)
)
)
(def
"rollrt"
(exp "typeidx" (var "typeidx"))
(exp "rectype" (var "rectype"))
(var "rectype")
(clause
(exp "x" (var "idx"))
(exp "rectype" (var "rectype"))
(exp "subtype*" (iter (var "subtype") list))
(exp "i*" (iter nat list))
(exp "n" (var "n"))
(exp (var "x"))
(exp (var "rectype"))
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(call
"subst_subtype"
(exp (var "subtype"))
(exp
(iter
(case
"_IDX%"
(tup
(case
"%"
(tup
(bin
add
nat
(proj (uncase (var "x") "%") 0)
(var "i")
)
)
)
)
)
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp
(iter
(case "REC%" (tup (var "i")))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
)
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
(if
(cmp
eq
bool
(var "rectype")
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(var "subtype")
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
)
)
)
)
(def
"unrollrt"
(exp "rectype" (var "rectype"))
(var "rectype")
(clause
(exp "rectype" (var "rectype"))
(exp "subtype*" (iter (var "subtype") list))
(exp "i*" (iter nat list))
(exp "n" (var "n"))
(exp (var "rectype"))
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(call
"subst_subtype"
(exp (var "subtype"))
(exp
(iter
(case "REC%" (tup (var "i")))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
(exp
(iter
(case "_DEF%%" (tup (var "rectype") (var "i")))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
)
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
(if
(cmp
eq
bool
(var "rectype")
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(var "subtype")
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
)
)
)
)
(def
"rolldt"
(exp "typeidx" (var "typeidx"))
(exp "rectype" (var "rectype"))
(iter (var "deftype") list)
(clause
(exp "x" (var "idx"))
(exp "rectype" (var "rectype"))
(exp "subtype*" (iter (var "subtype") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(exp (var "x"))
(exp (var "rectype"))
(iter
(case
"_DEF%%"
(tup
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(var "subtype")
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
(var "i")
)
)
(listn (var "n") "i")
(dom "i" (var "i*"))
)
(if
(cmp
eq
bool
(call "rollrt" (exp (var "x")) (exp (var "rectype")))
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(var "subtype")
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
)
)
)
)
(def
"unrolldt"
(exp "deftype" (var "deftype"))
(var "subtype")
(clause
(exp "rectype" (var "rectype"))
(exp "i" (var "n"))
(exp "subtype*" (iter (var "subtype") list))
(exp (case "_DEF%%" (tup (var "rectype") (var "i"))))
(idx (iter (var "subtype") list (dom "subtype" (var "subtype*"))) (var "i"))
(if
(cmp
eq
bool
(call "unrollrt" (exp (var "rectype")))
(case
"REC%"
(tup
(case
"%"
(tup (iter (var "subtype") list (dom "subtype" (var "subtype*"))))
)
)
)
)
)
)
)
(def
"expanddt"
(exp "deftype" (var "deftype"))
(var "comptype")
(clause
(exp "deftype" (var "deftype"))
(exp "comptype" (var "comptype"))
(exp "final?" (iter (var "final") opt))
(exp "typeuse*" (iter (var "typeuse") list))
(exp (var "deftype"))
(var "comptype")
(if
(cmp
eq
bool
(call "unrolldt" (exp (var "deftype")))
(case
"SUB%%%"
(tup
(iter (var "final") opt (dom "final" (var "final?")))
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "comptype")
)
)
)
)
)
)
(def
"free_addrtype"
(exp "numtype" (var "numtype"))
(var "free")
(clause
(exp "addrtype" (var "addrtype"))
(exp (sub (var "addrtype") (var "numtype") (var "addrtype")))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_numtype"
(exp "numtype" (var "numtype"))
(var "free")
(clause
(exp "numtype" (var "numtype"))
(exp (var "numtype"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_packtype"
(exp "packtype" (var "packtype"))
(var "free")
(clause
(exp "packtype" (var "packtype"))
(exp (var "packtype"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_lanetype"
(exp "lanetype" (var "lanetype"))
(var "free")
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
(call "free_packtype" (exp (var "packtype")))
)
)
(def
"free_vectype"
(exp "vectype" (var "vectype"))
(var "free")
(clause
(exp "vectype" (var "vectype"))
(exp (var "vectype"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_consttype"
(exp "consttype" (var "consttype"))
(var "free")
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "consttype") (var "numtype")))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp (sub (var "vectype") (var "consttype") (var "vectype")))
(call "free_vectype" (exp (var "vectype")))
)
)
(def
"free_absheaptype"
(exp "absheaptype" (var "absheaptype"))
(var "free")
(clause
(exp "absheaptype" (var "absheaptype"))
(exp (var "absheaptype"))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_typevar"
(exp "typevar" (var "typevar"))
(var "free")
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "_IDX%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "n" (var "n"))
(exp (case "REC%" (tup (var "n"))))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(rec
(def
"free_heaptype"
(exp "heaptype" (var "heaptype"))
(var "free")
(clause
(exp "absheaptype" (var "absheaptype"))
(exp (sub (var "absheaptype") (var "heaptype") (var "absheaptype")))
(call "free_absheaptype" (exp (var "absheaptype")))
)
(clause
(exp "typeuse" (var "typeuse"))
(exp (sub (var "typeuse") (var "heaptype") (var "typeuse")))
(call "free_typeuse" (exp (var "typeuse")))
)
)
(def
"free_reftype"
(exp "reftype" (var "reftype"))
(var "free")
(clause
(exp "null?" (iter (var "null") opt))
(exp "heaptype" (var "heaptype"))
(exp
(case
"REF%%"
(tup
(iter (var "null") opt (dom "null" (var "null?")))
(var "heaptype")
)
)
)
(call "free_heaptype" (exp (var "heaptype")))
)
)
(def
"free_typeuse"
(exp "typeuse" (var "typeuse"))
(var "free")
(clause
(exp "typevar" (var "typevar"))
(exp (sub (var "typevar") (var "typeuse") (var "typevar")))
(call "free_typevar" (exp (var "typevar")))
)
(clause
(exp "deftype" (var "deftype"))
(exp (sub (var "deftype") (var "typeuse") (var "deftype")))
(call "free_deftype" (exp (var "deftype")))
)
)
(def
"free_valtype"
(exp "valtype" (var "valtype"))
(var "free")
(clause
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "valtype") (var "numtype")))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp (sub (var "vectype") (var "valtype") (var "vectype")))
(call "free_vectype" (exp (var "vectype")))
)
(clause
(exp "reftype" (var "reftype"))
(exp (sub (var "reftype") (var "valtype") (var "reftype")))
(call "free_reftype" (exp (var "reftype")))
)
(clause
(exp (case "BOT" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_resulttype"
(exp "resulttype" (var "resulttype"))
(var "free")
(clause
(exp "valtype*" (iter (var "valtype") list))
(exp
(case
"%"
(tup (iter (var "valtype") list (dom "valtype" (var "valtype*"))))
)
)
(call
"free_list"
(exp
(iter
(call "free_valtype" (exp (var "valtype")))
list
(dom "valtype" (var "valtype*"))
)
)
)
)
)
(def
"free_storagetype"
(exp "storagetype" (var "storagetype"))
(var "free")
(clause
(exp "valtype" (var "valtype"))
(exp (sub (var "valtype") (var "storagetype") (var "valtype")))
(call "free_valtype" (exp (var "valtype")))
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(call "free_packtype" (exp (var "packtype")))
)
)
(def
"free_fieldtype"
(exp "fieldtype" (var "fieldtype"))
(var "free")
(clause
(exp "mut?" (iter (var "mut") opt))
(exp "storagetype" (var "storagetype"))
(exp
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "storagetype")
)
)
)
(call "free_storagetype" (exp (var "storagetype")))
)
)
(def
"free_comptype"
(exp "comptype" (var "comptype"))
(var "free")
(clause
(exp "fieldtype*" (iter (var "fieldtype") list))
(exp
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(var "fieldtype")
list
(dom "fieldtype" (var "fieldtype*"))
)
)
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_fieldtype" (exp (var "fieldtype")))
list
(dom "fieldtype" (var "fieldtype*"))
)
)
)
)
(clause
(exp "fieldtype" (var "fieldtype"))
(exp (case "ARRAY%" (tup (var "fieldtype"))))
(call "free_fieldtype" (exp (var "fieldtype")))
)
(clause
(exp "resulttype_1" (var "resulttype"))
(exp "resulttype_2" (var "resulttype"))
(exp (case "FUNC%->%" (tup (var "resulttype_1") (var "resulttype_2"))))
(comp
(call "free_resulttype" (exp (var "resulttype_1")))
(call "free_resulttype" (exp (var "resulttype_2")))
)
)
)
(def
"free_subtype"
(exp "subtype" (var "subtype"))
(var "free")
(clause
(exp "final?" (iter (var "final") opt))
(exp "typeuse*" (iter (var "typeuse") list))
(exp "comptype" (var "comptype"))
(exp
(case
"SUB%%%"
(tup
(iter (var "final") opt (dom "final" (var "final?")))
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "comptype")
)
)
)
(comp
(call
"free_list"
(exp
(iter
(call "free_typeuse" (exp (var "typeuse")))
list
(dom "typeuse" (var "typeuse*"))
)
)
)
(call "free_comptype" (exp (var "comptype")))
)
)
)
(def
"free_rectype"
(exp "rectype" (var "rectype"))
(var "free")
(clause
(exp "subtype*" (iter (var "subtype") list))
(exp
(case
"REC%"
(tup
(case
"%"
(tup (iter (var "subtype") list (dom "subtype" (var "subtype*"))))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_subtype" (exp (var "subtype")))
list
(dom "subtype" (var "subtype*"))
)
)
)
)
)
(def
"free_deftype"
(exp "deftype" (var "deftype"))
(var "free")
(clause
(exp "rectype" (var "rectype"))
(exp "n" (var "n"))
(exp (case "_DEF%%" (tup (var "rectype") (var "n"))))
(call "free_rectype" (exp (var "rectype")))
)
)
)
(def
"free_tagtype"
(exp "tagtype" (var "tagtype"))
(var "free")
(clause
(exp "deftype" (var "deftype"))
(exp (sub (var "deftype") (var "typeuse") (var "deftype")))
(call "free_deftype" (exp (var "deftype")))
)
)
(def
"free_globaltype"
(exp "globaltype" (var "globaltype"))
(var "free")
(clause
(exp "mut?" (iter (var "mut") opt))
(exp "valtype" (var "valtype"))
(exp
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "valtype"))
)
)
(call "free_valtype" (exp (var "valtype")))
)
)
(def
"free_memtype"
(exp "memtype" (var "memtype"))
(var "free")
(clause
(exp "addrtype" (var "addrtype"))
(exp "limits" (var "limits"))
(exp (case "%%PAGE" (tup (var "addrtype") (var "limits"))))
(call
"free_addrtype"
(exp (sub (var "addrtype") (var "numtype") (var "addrtype")))
)
)
)
(def
"free_tabletype"
(exp "tabletype" (var "tabletype"))
(var "free")
(clause
(exp "addrtype" (var "addrtype"))
(exp "limits" (var "limits"))
(exp "reftype" (var "reftype"))
(exp (case "%%%" (tup (var "addrtype") (var "limits") (var "reftype"))))
(comp
(call
"free_addrtype"
(exp (sub (var "addrtype") (var "numtype") (var "addrtype")))
)
(call "free_reftype" (exp (var "reftype")))
)
)
)
(def
"free_datatype"
(exp "datatype" (var "datatype"))
(var "free")
(clause
(exp (case "OK" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_elemtype"
(exp "elemtype" (var "elemtype"))
(var "free")
(clause
(exp "reftype" (var "reftype"))
(exp (var "reftype"))
(call "free_reftype" (exp (var "reftype")))
)
)
(def
"free_externtype"
(exp "externtype" (var "externtype"))
(var "free")
(clause
(exp "tagtype" (var "tagtype"))
(exp (case "TAG%" (tup (var "tagtype"))))
(call "free_tagtype" (exp (var "tagtype")))
)
(clause
(exp "globaltype" (var "globaltype"))
(exp (case "GLOBAL%" (tup (var "globaltype"))))
(call "free_globaltype" (exp (var "globaltype")))
)
(clause
(exp "memtype" (var "memtype"))
(exp (case "MEM%" (tup (var "memtype"))))
(call "free_memtype" (exp (var "memtype")))
)
(clause
(exp "tabletype" (var "tabletype"))
(exp (case "TABLE%" (tup (var "tabletype"))))
(call "free_tabletype" (exp (var "tabletype")))
)
(clause
(exp "typeuse" (var "typeuse"))
(exp (case "FUNC%" (tup (var "typeuse"))))
(call "free_typeuse" (exp (var "typeuse")))
)
)
(def
"free_moduletype"
(exp "moduletype" (var "moduletype"))
(var "free")
(clause
(exp "externtype_1*" (iter (var "externtype") list))
(exp "externtype_2*" (iter (var "externtype") list))
(exp
(case
"%->%"
(tup
(iter
(var "externtype_1")
list
(dom "externtype_1" (var "externtype_1*"))
)
(iter
(var "externtype_2")
list
(dom "externtype_2" (var "externtype_2*"))
)
)
)
)
(comp
(call
"free_list"
(exp
(iter
(call "free_externtype" (exp (var "externtype_1")))
list
(dom "externtype_1" (var "externtype_1*"))
)
)
)
(call
"free_list"
(exp
(iter
(call "free_externtype" (exp (var "externtype_2")))
list
(dom "externtype_2" (var "externtype_2*"))
)
)
)
)
)
)
(typ
"num_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(alias
(var
"iN"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
)
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(alias
(var
"fN"
(exp
(call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn"))))
)
)
)
)
)
(typ
"pack_"
(exp "Pnn" (var "Pnn"))
(inst
(exp "Pnn" (var "Pnn"))
(exp (var "Pnn"))
(alias (var "iN" (exp (call "psizenn" (exp (var "Pnn"))))))
)
)
(typ
"lane_"
(exp "lanetype" (var "lanetype"))
(inst
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
(alias (var "num_" (exp (var "numtype"))))
)
(inst
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
(alias (var "pack_" (exp (var "packtype"))))
)
(inst
(exp "Jnn" (var "Jnn"))
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
(alias
(var
"iN"
(exp
(call "lsize" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
)
)
)
)
)
(typ
"vec_"
(exp "Vnn" (var "Vnn"))
(inst
(exp "Vnn" (var "Vnn"))
(exp (var "Vnn"))
(alias (var "vN" (exp (call "vsize" (exp (var "Vnn"))))))
)
)
(typ
"lit_"
(exp "storagetype" (var "storagetype"))
(inst
(exp "numtype" (var "numtype"))
(exp (sub (var "numtype") (var "storagetype") (var "numtype")))
(alias (var "num_" (exp (var "numtype"))))
)
(inst
(exp "vectype" (var "vectype"))
(exp (sub (var "vectype") (var "storagetype") (var "vectype")))
(alias (var "vec_" (exp (var "vectype"))))
)
(inst
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(alias (var "pack_" (exp (var "packtype"))))
)
)
(typ
"sz"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
or
bool
(bin
or
bool
(bin
or
bool
(cmp eq bool (var "i") (num (nat 8)))
(cmp eq bool (var "i") (num (nat 16)))
)
(cmp eq bool (var "i") (num (nat 32)))
)
(cmp eq bool (var "i") (num (nat 64)))
)
)
)
)
)
)
(typ "sx" (inst (variant (case "U" (tup)) (case "S" (tup)))))
(typ
"unop_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(variant
(case "CLZ" (tup))
(case "CTZ" (tup))
(case "POPCNT" (tup))
(case
"EXTEND%"
(exp "sz" (var "sz"))
(tup (bind (var "sz") (var "sz")))
(if
(cmp
lt
nat
(proj (uncase (var "sz") "%") 0)
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
)
)
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(variant
(case "ABS" (tup))
(case "NEG" (tup))
(case "SQRT" (tup))
(case "CEIL" (tup))
(case "FLOOR" (tup))
(case "TRUNC" (tup))
(case "NEAREST" (tup))
)
)
)
(typ
"binop_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(variant
(case "ADD" (tup))
(case "SUB" (tup))
(case "MUL" (tup))
(case "DIV%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case "REM%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case "AND" (tup))
(case "OR" (tup))
(case "XOR" (tup))
(case "SHL" (tup))
(case "SHR%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case "ROTL" (tup))
(case "ROTR" (tup))
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(variant
(case "ADD" (tup))
(case "SUB" (tup))
(case "MUL" (tup))
(case "DIV" (tup))
(case "MIN" (tup))
(case "MAX" (tup))
(case "COPYSIGN" (tup))
)
)
)
(typ
"testop_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(variant (case "EQZ" (tup)))
)
)
(typ
"relop_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(variant
(case "EQ" (tup))
(case "NE" (tup))
(case "LT%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case "GT%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case "LE%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case "GE%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(variant
(case "EQ" (tup))
(case "NE" (tup))
(case "LT" (tup))
(case "GT" (tup))
(case "LE" (tup))
(case "GE" (tup))
)
)
)
(typ
"cvtop__"
(exp "numtype_1" (var "numtype"))
(exp "numtype_2" (var "numtype"))
(inst
(exp "Inn_1" (var "Inn"))
(exp "Inn_2" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(variant
(case
"EXTEND%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(cmp
lt
nat
(call
"sizenn1"
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
)
(call
"sizenn2"
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
)
)
)
)
(case
"WRAP"
(tup)
(if
(cmp
gt
nat
(call
"sizenn1"
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
)
(call
"sizenn2"
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
)
)
)
)
)
)
(inst
(exp "Inn_1" (var "Inn"))
(exp "Fnn_2" (var "Fnn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(variant
(case "CONVERT%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case
"REINTERPRET"
(tup)
(if
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
)
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
)
)
)
)
)
(inst
(exp "Fnn_1" (var "Fnn"))
(exp "Inn_2" (var "Inn"))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(variant
(case "TRUNC%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
(case
"TRUNC_SAT%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
)
(case
"REINTERPRET"
(tup)
(if
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(call
"sizenn2"
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
)
)
)
)
)
)
(inst
(exp "Fnn_1" (var "Fnn"))
(exp "Fnn_2" (var "Fnn"))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(variant
(case
"PROMOTE"
(tup)
(if
(cmp
lt
nat
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
)
)
)
(case
"DEMOTE"
(tup)
(if
(cmp
gt
nat
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
)
)
)
)
)
)
(typ
"dim"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
or
bool
(bin
or
bool
(bin
or
bool
(bin
or
bool
(cmp eq bool (var "i") (num (nat 1)))
(cmp eq bool (var "i") (num (nat 2)))
)
(cmp eq bool (var "i") (num (nat 4)))
)
(cmp eq bool (var "i") (num (nat 8)))
)
(cmp eq bool (var "i") (num (nat 16)))
)
)
)
)
)
)
(typ
"shape"
(inst
(variant
(case
"%X%"
(exp "lanetype" (var "lanetype"))
(exp "dim" (var "dim"))
(tup
(bind (var "lanetype") (var "lanetype"))
(bind (var "dim") (var "dim"))
)
(if
(cmp
eq
bool
(bin
mul
nat
(call "lsize" (exp (var "lanetype")))
(proj (uncase (var "dim") "%") 0)
)
(num (nat 128))
)
)
)
)
)
)
(def
"dim"
(exp "shape" (var "shape"))
(var "dim")
(clause
(exp "Lnn" (var "Lnn"))
(exp "N" (var "N"))
(exp (case "%X%" (tup (var "Lnn") (case "%" (tup (var "N"))))))
(case "%" (tup (var "N")))
)
)
(def
"lanetype"
(exp "shape" (var "shape"))
(var "lanetype")
(clause
(exp "Lnn" (var "Lnn"))
(exp "N" (var "N"))
(exp (case "%X%" (tup (var "Lnn") (case "%" (tup (var "N"))))))
(var "Lnn")
)
)
(def
"unpackshape"
(exp "shape" (var "shape"))
(var "numtype")
(clause
(exp "Lnn" (var "Lnn"))
(exp "N" (var "N"))
(exp (case "%X%" (tup (var "Lnn") (case "%" (tup (var "N"))))))
(call "lunpack" (exp (var "Lnn")))
)
)
(typ
"ishape"
(inst
(variant
(case
"%"
(exp "shape" (var "shape"))
(exp "Jnn" (var "Jnn"))
(tup (bind (var "shape") (var "shape")))
(if
(cmp
eq
bool
(call "lanetype" (exp (var "shape")))
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
)
)
)
)
)
)
(typ
"bshape"
(inst
(variant
(case
"%"
(exp "shape" (var "shape"))
(tup (bind (var "shape") (var "shape")))
(if
(cmp eq bool (call "lanetype" (exp (var "shape"))) (case "I8" (tup)))
)
)
)
)
)
(typ "zero" (inst (variant (case "ZERO" (tup)))))
(typ "half" (inst (variant (case "LOW" (tup)) (case "HIGH" (tup)))))
(typ "vvunop" (inst (variant (case "NOT" (tup)))))
(typ
"vvbinop"
(inst
(variant
(case "AND" (tup))
(case "ANDNOT" (tup))
(case "OR" (tup))
(case "XOR" (tup))
)
)
)
(typ "vvternop" (inst (variant (case "BITSELECT" (tup)))))
(typ "vvtestop" (inst (variant (case "ANY_TRUE" (tup)))))
(typ
"vunop_"
(exp "shape" (var "shape"))
(inst
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(variant
(case "ABS" (tup))
(case "NEG" (tup))
(case
"POPCNT"
(tup)
(if
(cmp
eq
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 8))
)
)
)
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(variant
(case "ABS" (tup))
(case "NEG" (tup))
(case "SQRT" (tup))
(case "CEIL" (tup))
(case "FLOOR" (tup))
(case "TRUNC" (tup))
(case "NEAREST" (tup))
)
)
)
(typ
"vbinop_"
(exp "shape" (var "shape"))
(inst
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(variant
(case "ADD" (tup))
(case "SUB" (tup))
(case
"ADD_SAT%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(cmp
le
nat
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 16))
)
)
)
(case
"SUB_SAT%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(cmp
le
nat
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 16))
)
)
)
(case
"MUL"
(tup)
(if
(cmp
ge
nat
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 16))
)
)
)
(case
"AVGRU"
(tup)
(if
(cmp
le
nat
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 16))
)
)
)
(case
"Q15MULR_SATS"
(tup)
(if
(cmp
eq
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 16))
)
)
)
(case
"RELAXED_Q15MULRS"
(tup)
(if
(cmp
eq
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 16))
)
)
)
(case
"MIN%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(cmp
le
nat
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 32))
)
)
)
(case
"MAX%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(cmp
le
nat
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 32))
)
)
)
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(variant
(case "ADD" (tup))
(case "SUB" (tup))
(case "MUL" (tup))
(case "DIV" (tup))
(case "MIN" (tup))
(case "MAX" (tup))
(case "PMIN" (tup))
(case "PMAX" (tup))
(case "RELAXED_MIN" (tup))
(case "RELAXED_MAX" (tup))
)
)
)
(typ
"vternop_"
(exp "shape" (var "shape"))
(inst
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(variant (case "RELAXED_LANESELECT" (tup)))
)
(inst
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(variant (case "RELAXED_MADD" (tup)) (case "RELAXED_NMADD" (tup)))
)
)
(typ
"vtestop_"
(exp "shape" (var "shape"))
(inst
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(variant (case "ALL_TRUE" (tup)))
)
)
(typ
"vrelop_"
(exp "shape" (var "shape"))
(inst
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(variant
(case "EQ" (tup))
(case "NE" (tup))
(case
"LT%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(bin
or
bool
(cmp
ne
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 64))
)
(cmp eq bool (var "sx") (case "S" (tup)))
)
)
)
(case
"GT%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(bin
or
bool
(cmp
ne
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 64))
)
(cmp eq bool (var "sx") (case "S" (tup)))
)
)
)
(case
"LE%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(bin
or
bool
(cmp
ne
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 64))
)
(cmp eq bool (var "sx") (case "S" (tup)))
)
)
)
(case
"GE%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(bin
or
bool
(cmp
ne
bool
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
(num (nat 64))
)
(cmp eq bool (var "sx") (case "S" (tup)))
)
)
)
)
)
(inst
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(variant
(case "EQ" (tup))
(case "NE" (tup))
(case "LT" (tup))
(case "GT" (tup))
(case "LE" (tup))
(case "GE" (tup))
)
)
)
(typ
"vshiftop_"
(exp "ishape" (var "ishape"))
(inst
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
(variant
(case "SHL" (tup))
(case "SHR%" (exp "sx" (var "sx")) (tup (bind (var "sx") (var "sx"))))
)
)
)
(typ
"vswizzlop_"
(exp "bshape" (var "bshape"))
(inst
(exp "M" (var "M"))
(exp
(case
"%"
(tup (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
)
)
(variant (case "SWIZZLE" (tup)) (case "RELAXED_SWIZZLE" (tup)))
)
)
(typ
"vextunop__"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(inst
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(variant
(case
"EXTADD_PAIRWISE%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
(if
(bin
and
bool
(cmp
le
nat
(num (nat 16))
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
)
(bin
and
bool
(cmp
eq
bool
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
le
nat
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 32))
)
)
)
)
)
)
)
)
(typ
"vextbinop__"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(inst
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(variant
(case
"EXTMUL%%"
(exp "half" (var "half"))
(exp "sx" (var "sx"))
(tup (bind (var "half") (var "half")) (bind (var "sx") (var "sx")))
(if
(bin
and
bool
(cmp
eq
bool
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
ge
nat
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 16))
)
)
)
)
(case
"DOTS"
(tup)
(if
(bin
and
bool
(cmp
eq
bool
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
eq
bool
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 32))
)
)
)
)
(case
"RELAXED_DOTS"
(tup)
(if
(bin
and
bool
(cmp
eq
bool
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
eq
bool
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 16))
)
)
)
)
)
)
)
(typ
"vextternop__"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(inst
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(variant
(case
"RELAXED_DOT_ADDS"
(tup)
(if
(bin
and
bool
(cmp
eq
bool
(bin
mul
nat
(num (nat 4))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
eq
bool
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 32))
)
)
)
)
)
)
)
(typ
"vcvtop__"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(inst
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(variant
(case
"EXTEND%%"
(exp "half" (var "half"))
(exp "sx" (var "sx"))
(tup (bind (var "half") (var "half")) (bind (var "sx") (var "sx")))
(if
(cmp
eq
bool
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
)
)
)
)
)
(inst
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(variant
(case
"CONVERT%%"
(exp "half?" (iter (var "half") opt))
(exp "sx" (var "sx"))
(tup
(bind
(iter (var "half") opt (dom "half" (var "half?")))
(iter (var "half") opt)
)
(bind (var "sx") (var "sx"))
)
(if
(bin
or
bool
(bin
and
bool
(bin
and
bool
(cmp
eq
bool
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(cmp
eq
bool
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
(num (nat 32))
)
)
(cmp
eq
bool
(iter (var "half") opt (dom "half" (var "half?")))
(opt)
)
)
(bin
and
bool
(cmp
eq
bool
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
)
(cmp
eq
bool
(iter (var "half") opt (dom "half" (var "half?")))
(opt (case "LOW" (tup)))
)
)
)
)
)
)
)
(inst
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(variant
(case
"TRUNC_SAT%%"
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(tup
(bind (var "sx") (var "sx"))
(bind
(iter (var "zero") opt (dom "zero" (var "zero?")))
(iter (var "zero") opt)
)
)
(if
(bin
or
bool
(bin
and
bool
(bin
and
bool
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
eq
bool
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 32))
)
)
(cmp
eq
bool
(iter (var "zero") opt (dom "zero" (var "zero?")))
(opt)
)
)
(bin
and
bool
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(bin
mul
nat
(num (nat 2))
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
(cmp
eq
bool
(iter (var "zero") opt (dom "zero" (var "zero?")))
(opt (case "ZERO" (tup)))
)
)
)
)
)
(case
"RELAXED_TRUNC%%"
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(tup
(bind (var "sx") (var "sx"))
(bind
(iter (var "zero") opt (dom "zero" (var "zero?")))
(iter (var "zero") opt)
)
)
(if
(bin
or
bool
(bin
and
bool
(bin
and
bool
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(cmp
eq
bool
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
(num (nat 32))
)
)
(cmp
eq
bool
(iter (var "zero") opt (dom "zero" (var "zero?")))
(opt)
)
)
(bin
and
bool
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(bin
mul
nat
(num (nat 2))
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
(cmp
eq
bool
(iter (var "zero") opt (dom "zero" (var "zero?")))
(opt (case "ZERO" (tup)))
)
)
)
)
)
)
)
(inst
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(variant
(case
"DEMOTE%"
(exp "zero" (var "zero"))
(tup (bind (var "zero") (var "zero")))
(if
(cmp
eq
bool
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
(bin
mul
nat
(num (nat 2))
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
)
)
)
)
(case
"PROMOTELOW"
(tup)
(if
(cmp
eq
bool
(bin
mul
nat
(num (nat 2))
(call
"sizenn1"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
)
)
(call
"sizenn2"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
)
)
)
)
)
)
)
(typ
"memarg"
(inst
(struct
(field "ALIGN" (exp "u32" (var "u32")) (var "u32"))
(field "OFFSET" (exp "u64" (var "u64")) (var "u64"))
)
)
)
(typ
"loadop_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(variant
(case
"%_%"
(exp "sz" (var "sz"))
(exp "sx" (var "sx"))
(tup (bind (var "sz") (var "sz")) (bind (var "sx") (var "sx")))
(if
(cmp
lt
nat
(proj (uncase (var "sz") "%") 0)
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
)
)
)
)
)
(typ
"storeop_"
(exp "numtype" (var "numtype"))
(inst
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(variant
(case
"%"
(exp "sz" (var "sz"))
(tup (bind (var "sz") (var "sz")))
(if
(cmp
lt
nat
(proj (uncase (var "sz") "%") 0)
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
)
)
)
)
)
(typ
"vloadop_"
(exp "vectype" (var "vectype"))
(inst
(exp "vectype" (var "vectype"))
(exp (var "vectype"))
(variant
(case
"SHAPE%X%_%"
(exp "sz" (var "sz"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(tup
(bind (var "sz") (var "sz"))
(bind (var "M") (var "M"))
(bind (var "sx") (var "sx"))
)
(if
(cmp
eq
bool
(cvt
nat
rat
(bin mul nat (proj (uncase (var "sz") "%") 0) (var "M"))
)
(bin
div
rat
(cvt nat rat (call "vsize" (exp (var "vectype"))))
(cvt nat rat (num (nat 2)))
)
)
)
)
(case "SPLAT%" (exp "sz" (var "sz")) (tup (bind (var "sz") (var "sz"))))
(case
"ZERO%"
(exp "sz" (var "sz"))
(tup (bind (var "sz") (var "sz")))
(if (cmp ge nat (proj (uncase (var "sz") "%") 0) (num (nat 32))))
)
)
)
)
(typ
"blocktype"
(inst
(variant
(case
"_RESULT%"
(exp "valtype?" (iter (var "valtype") opt))
(tup
(bind
(iter (var "valtype") opt (dom "valtype" (var "valtype?")))
(iter (var "valtype") opt)
)
)
)
(case
"_IDX%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
)
)
)
(typ "addr" (inst (alias nat)))
(typ "arrayaddr" (inst (alias (var "addr"))))
(typ "exnaddr" (inst (alias (var "addr"))))
(typ "funcaddr" (inst (alias (var "addr"))))
(typ "hostaddr" (inst (alias (var "addr"))))
(typ "structaddr" (inst (alias (var "addr"))))
(rec
(typ
"addrref"
(inst
(variant
(case
"REF.I31_NUM%"
(exp "u31" (var "u31"))
(tup (bind (var "u31") (var "u31")))
)
(case
"REF.STRUCT_ADDR%"
(exp "structaddr" (var "structaddr"))
(tup (bind (var "structaddr") (var "structaddr")))
)
(case
"REF.ARRAY_ADDR%"
(exp "arrayaddr" (var "arrayaddr"))
(tup (bind (var "arrayaddr") (var "arrayaddr")))
)
(case
"REF.FUNC_ADDR%"
(exp "funcaddr" (var "funcaddr"))
(tup (bind (var "funcaddr") (var "funcaddr")))
)
(case
"REF.EXN_ADDR%"
(exp "exnaddr" (var "exnaddr"))
(tup (bind (var "exnaddr") (var "exnaddr")))
)
(case
"REF.HOST_ADDR%"
(exp "hostaddr" (var "hostaddr"))
(tup (bind (var "hostaddr") (var "hostaddr")))
)
(case
"REF.EXTERN%"
(exp "addrref" (var "addrref"))
(tup (bind (var "addrref") (var "addrref")))
)
)
)
)
)
(typ
"catch"
(inst
(variant
(case
"CATCH%%"
(exp "tagidx" (var "tagidx"))
(exp "labelidx" (var "labelidx"))
(tup
(bind (var "tagidx") (var "tagidx"))
(bind (var "labelidx") (var "labelidx"))
)
)
(case
"CATCH_REF%%"
(exp "tagidx" (var "tagidx"))
(exp "labelidx" (var "labelidx"))
(tup
(bind (var "tagidx") (var "tagidx"))
(bind (var "labelidx") (var "labelidx"))
)
)
(case
"CATCH_ALL%"
(exp "labelidx" (var "labelidx"))
(tup (bind (var "labelidx") (var "labelidx")))
)
(case
"CATCH_ALL_REF%"
(exp "labelidx" (var "labelidx"))
(tup (bind (var "labelidx") (var "labelidx")))
)
)
)
)
(typ "dataaddr" (inst (alias (var "addr"))))
(typ "elemaddr" (inst (alias (var "addr"))))
(typ "globaladdr" (inst (alias (var "addr"))))
(typ "memaddr" (inst (alias (var "addr"))))
(typ "tableaddr" (inst (alias (var "addr"))))
(typ "tagaddr" (inst (alias (var "addr"))))
(typ
"externaddr"
(inst
(variant
(case
"TAG%"
(exp "tagaddr" (var "tagaddr"))
(tup (bind (var "tagaddr") (var "tagaddr")))
)
(case
"GLOBAL%"
(exp "globaladdr" (var "globaladdr"))
(tup (bind (var "globaladdr") (var "globaladdr")))
)
(case
"MEM%"
(exp "memaddr" (var "memaddr"))
(tup (bind (var "memaddr") (var "memaddr")))
)
(case
"TABLE%"
(exp "tableaddr" (var "tableaddr"))
(tup (bind (var "tableaddr") (var "tableaddr")))
)
(case
"FUNC%"
(exp "funcaddr" (var "funcaddr"))
(tup (bind (var "funcaddr") (var "funcaddr")))
)
)
)
)
(typ
"exportinst"
(inst
(struct
(field "NAME" (exp "name" (var "name")) (var "name"))
(field "ADDR" (exp "externaddr" (var "externaddr")) (var "externaddr"))
)
)
)
(typ
"moduleinst"
(inst
(struct
(field
"TYPES"
(exp "deftype*" (iter (var "deftype") list))
(iter (var "deftype") list)
)
(field
"TAGS"
(exp "tagaddr*" (iter (var "tagaddr") list))
(iter (var "tagaddr") list)
)
(field
"GLOBALS"
(exp "globaladdr*" (iter (var "globaladdr") list))
(iter (var "globaladdr") list)
)
(field
"MEMS"
(exp "memaddr*" (iter (var "memaddr") list))
(iter (var "memaddr") list)
)
(field
"TABLES"
(exp "tableaddr*" (iter (var "tableaddr") list))
(iter (var "tableaddr") list)
)
(field
"FUNCS"
(exp "funcaddr*" (iter (var "funcaddr") list))
(iter (var "funcaddr") list)
)
(field
"DATAS"
(exp "dataaddr*" (iter (var "dataaddr") list))
(iter (var "dataaddr") list)
)
(field
"ELEMS"
(exp "elemaddr*" (iter (var "elemaddr") list))
(iter (var "elemaddr") list)
)
(field
"EXPORTS"
(exp "exportinst*" (iter (var "exportinst") list))
(iter (var "exportinst") list)
)
)
)
)
(typ
"val"
(inst
(variant
(case
"CONST%%"
(exp "numtype" (var "numtype"))
(exp "num_" (var "num_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "num_") (var "num_" (exp (var "numtype"))))
)
)
(case
"VCONST%%"
(exp "vectype" (var "vectype"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vec_") (var "vec_" (exp (var "vectype"))))
)
)
(case
"REF.NULL%"
(exp "heaptype" (var "heaptype"))
(tup (bind (var "heaptype") (var "heaptype")))
)
(case
"REF.I31_NUM%"
(exp "u31" (var "u31"))
(tup (bind (var "u31") (var "u31")))
)
(case
"REF.STRUCT_ADDR%"
(exp "structaddr" (var "structaddr"))
(tup (bind (var "structaddr") (var "structaddr")))
)
(case
"REF.ARRAY_ADDR%"
(exp "arrayaddr" (var "arrayaddr"))
(tup (bind (var "arrayaddr") (var "arrayaddr")))
)
(case
"REF.FUNC_ADDR%"
(exp "funcaddr" (var "funcaddr"))
(tup (bind (var "funcaddr") (var "funcaddr")))
)
(case
"REF.EXN_ADDR%"
(exp "exnaddr" (var "exnaddr"))
(tup (bind (var "exnaddr") (var "exnaddr")))
)
(case
"REF.HOST_ADDR%"
(exp "hostaddr" (var "hostaddr"))
(tup (bind (var "hostaddr") (var "hostaddr")))
)
(case
"REF.EXTERN%"
(exp "addrref" (var "addrref"))
(tup (bind (var "addrref") (var "addrref")))
)
)
)
)
(typ
"frame"
(inst
(struct
(field
"LOCALS"
(exp "val?*" (iter (iter (var "val") opt) list))
(iter (iter (var "val") opt) list)
)
(field "MODULE" (exp "moduleinst" (var "moduleinst")) (var "moduleinst"))
)
)
)
(rec
(typ
"instr"
(inst
(variant
(case "NOP" (tup))
(case "UNREACHABLE" (tup))
(case "DROP" (tup))
(case
"SELECT%"
(exp "valtype*?" (iter (iter (var "valtype") list) opt))
(tup
(bind
(iter
(iter (var "valtype") list (dom "valtype" (var "valtype*")))
opt
(dom "valtype*" (var "valtype*?"))
)
(iter (iter (var "valtype") list) opt)
)
)
)
(case
"BLOCK%%"
(exp "blocktype" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "blocktype") (var "blocktype"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
(case
"LOOP%%"
(exp "blocktype" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "blocktype") (var "blocktype"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
(case
"IF%%ELSE%"
(exp "blocktype" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "blocktype") (var "blocktype"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
(bind (var "_") (iter (var "instr") list))
)
)
(case
"BR%"
(exp "labelidx" (var "labelidx"))
(tup (bind (var "labelidx") (var "labelidx")))
)
(case
"BR_IF%"
(exp "labelidx" (var "labelidx"))
(tup (bind (var "labelidx") (var "labelidx")))
)
(case
"BR_TABLE%%"
(exp "labelidx*" (iter (var "labelidx") list))
(tup
(bind
(iter (var "labelidx") list (dom "labelidx" (var "labelidx*")))
(iter (var "labelidx") list)
)
(bind (var "_") (var "labelidx"))
)
)
(case
"BR_ON_NULL%"
(exp "labelidx" (var "labelidx"))
(tup (bind (var "labelidx") (var "labelidx")))
)
(case
"BR_ON_NON_NULL%"
(exp "labelidx" (var "labelidx"))
(tup (bind (var "labelidx") (var "labelidx")))
)
(case
"BR_ON_CAST%%%"
(exp "labelidx" (var "labelidx"))
(exp "reftype" (var "reftype"))
(tup
(bind (var "labelidx") (var "labelidx"))
(bind (var "reftype") (var "reftype"))
(bind (var "_") (var "reftype"))
)
)
(case
"BR_ON_CAST_FAIL%%%"
(exp "labelidx" (var "labelidx"))
(exp "reftype" (var "reftype"))
(tup
(bind (var "labelidx") (var "labelidx"))
(bind (var "reftype") (var "reftype"))
(bind (var "_") (var "reftype"))
)
)
(case
"CALL%"
(exp "funcidx" (var "funcidx"))
(tup (bind (var "funcidx") (var "funcidx")))
)
(case
"CALL_REF%"
(exp "typeuse" (var "typeuse"))
(tup (bind (var "typeuse") (var "typeuse")))
)
(case
"CALL_INDIRECT%%"
(exp "tableidx" (var "tableidx"))
(exp "typeuse" (var "typeuse"))
(tup
(bind (var "tableidx") (var "tableidx"))
(bind (var "typeuse") (var "typeuse"))
)
)
(case "RETURN" (tup))
(case
"RETURN_CALL%"
(exp "funcidx" (var "funcidx"))
(tup (bind (var "funcidx") (var "funcidx")))
)
(case
"RETURN_CALL_REF%"
(exp "typeuse" (var "typeuse"))
(tup (bind (var "typeuse") (var "typeuse")))
)
(case
"RETURN_CALL_INDIRECT%%"
(exp "tableidx" (var "tableidx"))
(exp "typeuse" (var "typeuse"))
(tup
(bind (var "tableidx") (var "tableidx"))
(bind (var "typeuse") (var "typeuse"))
)
)
(case
"THROW%"
(exp "tagidx" (var "tagidx"))
(tup (bind (var "tagidx") (var "tagidx")))
)
(case "THROW_REF" (tup))
(case
"TRY_TABLE%%%"
(exp "blocktype" (var "blocktype"))
(exp "list" (var "list" (typ (var "catch"))))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "blocktype") (var "blocktype"))
(bind (var "list") (var "list" (typ (var "catch"))))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
(case
"LOCAL.GET%"
(exp "localidx" (var "localidx"))
(tup (bind (var "localidx") (var "localidx")))
)
(case
"LOCAL.SET%"
(exp "localidx" (var "localidx"))
(tup (bind (var "localidx") (var "localidx")))
)
(case
"LOCAL.TEE%"
(exp "localidx" (var "localidx"))
(tup (bind (var "localidx") (var "localidx")))
)
(case
"GLOBAL.GET%"
(exp "globalidx" (var "globalidx"))
(tup (bind (var "globalidx") (var "globalidx")))
)
(case
"GLOBAL.SET%"
(exp "globalidx" (var "globalidx"))
(tup (bind (var "globalidx") (var "globalidx")))
)
(case
"TABLE.GET%"
(exp "tableidx" (var "tableidx"))
(tup (bind (var "tableidx") (var "tableidx")))
)
(case
"TABLE.SET%"
(exp "tableidx" (var "tableidx"))
(tup (bind (var "tableidx") (var "tableidx")))
)
(case
"TABLE.SIZE%"
(exp "tableidx" (var "tableidx"))
(tup (bind (var "tableidx") (var "tableidx")))
)
(case
"TABLE.GROW%"
(exp "tableidx" (var "tableidx"))
(tup (bind (var "tableidx") (var "tableidx")))
)
(case
"TABLE.FILL%"
(exp "tableidx" (var "tableidx"))
(tup (bind (var "tableidx") (var "tableidx")))
)
(case
"TABLE.COPY%%"
(exp "tableidx" (var "tableidx"))
(tup
(bind (var "tableidx") (var "tableidx"))
(bind (var "_") (var "tableidx"))
)
)
(case
"TABLE.INIT%%"
(exp "tableidx" (var "tableidx"))
(exp "elemidx" (var "elemidx"))
(tup
(bind (var "tableidx") (var "tableidx"))
(bind (var "elemidx") (var "elemidx"))
)
)
(case
"ELEM.DROP%"
(exp "elemidx" (var "elemidx"))
(tup (bind (var "elemidx") (var "elemidx")))
)
(case
"LOAD%%%%"
(exp "numtype" (var "numtype"))
(exp "loadop_?" (iter (var "loadop_" (exp (var "numtype"))) opt))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(tup
(bind (var "numtype") (var "numtype"))
(bind
(iter (var "loadop_") opt (dom "loadop_" (var "loadop_?")))
(iter (var "loadop_" (exp (var "numtype"))) opt)
)
(bind (var "memidx") (var "memidx"))
(bind (var "memarg") (var "memarg"))
)
)
(case
"STORE%%%%"
(exp "numtype" (var "numtype"))
(exp "storeop_?" (iter (var "storeop_" (exp (var "numtype"))) opt))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(tup
(bind (var "numtype") (var "numtype"))
(bind
(iter (var "storeop_") opt (dom "storeop_" (var "storeop_?")))
(iter (var "storeop_" (exp (var "numtype"))) opt)
)
(bind (var "memidx") (var "memidx"))
(bind (var "memarg") (var "memarg"))
)
)
(case
"VLOAD%%%%"
(exp "vectype" (var "vectype"))
(exp "vloadop_?" (iter (var "vloadop_" (exp (var "vectype"))) opt))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(tup
(bind (var "vectype") (var "vectype"))
(bind
(iter (var "vloadop_") opt (dom "vloadop_" (var "vloadop_?")))
(iter (var "vloadop_" (exp (var "vectype"))) opt)
)
(bind (var "memidx") (var "memidx"))
(bind (var "memarg") (var "memarg"))
)
)
(case
"VLOAD_LANE%%%%%"
(exp "vectype" (var "vectype"))
(exp "sz" (var "sz"))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp "laneidx" (var "laneidx"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "sz") (var "sz"))
(bind (var "memidx") (var "memidx"))
(bind (var "memarg") (var "memarg"))
(bind (var "laneidx") (var "laneidx"))
)
)
(case
"VSTORE%%%"
(exp "vectype" (var "vectype"))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "memidx") (var "memidx"))
(bind (var "memarg") (var "memarg"))
)
)
(case
"VSTORE_LANE%%%%%"
(exp "vectype" (var "vectype"))
(exp "sz" (var "sz"))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp "laneidx" (var "laneidx"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "sz") (var "sz"))
(bind (var "memidx") (var "memidx"))
(bind (var "memarg") (var "memarg"))
(bind (var "laneidx") (var "laneidx"))
)
)
(case
"MEMORY.SIZE%"
(exp "memidx" (var "memidx"))
(tup (bind (var "memidx") (var "memidx")))
)
(case
"MEMORY.GROW%"
(exp "memidx" (var "memidx"))
(tup (bind (var "memidx") (var "memidx")))
)
(case
"MEMORY.FILL%"
(exp "memidx" (var "memidx"))
(tup (bind (var "memidx") (var "memidx")))
)
(case
"MEMORY.COPY%%"
(exp "memidx" (var "memidx"))
(tup
(bind (var "memidx") (var "memidx"))
(bind (var "_") (var "memidx"))
)
)
(case
"MEMORY.INIT%%"
(exp "memidx" (var "memidx"))
(exp "dataidx" (var "dataidx"))
(tup
(bind (var "memidx") (var "memidx"))
(bind (var "dataidx") (var "dataidx"))
)
)
(case
"DATA.DROP%"
(exp "dataidx" (var "dataidx"))
(tup (bind (var "dataidx") (var "dataidx")))
)
(case
"REF.NULL%"
(exp "heaptype" (var "heaptype"))
(tup (bind (var "heaptype") (var "heaptype")))
)
(case "REF.IS_NULL" (tup))
(case "REF.AS_NON_NULL" (tup))
(case "REF.EQ" (tup))
(case
"REF.TEST%"
(exp "reftype" (var "reftype"))
(tup (bind (var "reftype") (var "reftype")))
)
(case
"REF.CAST%"
(exp "reftype" (var "reftype"))
(tup (bind (var "reftype") (var "reftype")))
)
(case
"REF.FUNC%"
(exp "funcidx" (var "funcidx"))
(tup (bind (var "funcidx") (var "funcidx")))
)
(case "REF.I31" (tup))
(case
"I31.GET%"
(exp "sx" (var "sx"))
(tup (bind (var "sx") (var "sx")))
)
(case
"STRUCT.NEW%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case
"STRUCT.NEW_DEFAULT%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case
"STRUCT.GET%%%"
(exp "sx?" (iter (var "sx") opt))
(exp "typeidx" (var "typeidx"))
(exp "u32" (var "u32"))
(tup
(bind
(iter (var "sx") opt (dom "sx" (var "sx?")))
(iter (var "sx") opt)
)
(bind (var "typeidx") (var "typeidx"))
(bind (var "u32") (var "u32"))
)
)
(case
"STRUCT.SET%%"
(exp "typeidx" (var "typeidx"))
(exp "u32" (var "u32"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "u32") (var "u32"))
)
)
(case
"ARRAY.NEW%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case
"ARRAY.NEW_DEFAULT%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case
"ARRAY.NEW_FIXED%%"
(exp "typeidx" (var "typeidx"))
(exp "u32" (var "u32"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "u32") (var "u32"))
)
)
(case
"ARRAY.NEW_DATA%%"
(exp "typeidx" (var "typeidx"))
(exp "dataidx" (var "dataidx"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "dataidx") (var "dataidx"))
)
)
(case
"ARRAY.NEW_ELEM%%"
(exp "typeidx" (var "typeidx"))
(exp "elemidx" (var "elemidx"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "elemidx") (var "elemidx"))
)
)
(case
"ARRAY.GET%%"
(exp "sx?" (iter (var "sx") opt))
(exp "typeidx" (var "typeidx"))
(tup
(bind
(iter (var "sx") opt (dom "sx" (var "sx?")))
(iter (var "sx") opt)
)
(bind (var "typeidx") (var "typeidx"))
)
)
(case
"ARRAY.SET%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case "ARRAY.LEN" (tup))
(case
"ARRAY.FILL%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
(case
"ARRAY.COPY%%"
(exp "typeidx" (var "typeidx"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "_") (var "typeidx"))
)
)
(case
"ARRAY.INIT_DATA%%"
(exp "typeidx" (var "typeidx"))
(exp "dataidx" (var "dataidx"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "dataidx") (var "dataidx"))
)
)
(case
"ARRAY.INIT_ELEM%%"
(exp "typeidx" (var "typeidx"))
(exp "elemidx" (var "elemidx"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind (var "elemidx") (var "elemidx"))
)
)
(case "EXTERN.CONVERT_ANY" (tup))
(case "ANY.CONVERT_EXTERN" (tup))
(case
"CONST%%"
(exp "numtype" (var "numtype"))
(exp "num_" (var "num_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "num_") (var "num_" (exp (var "numtype"))))
)
)
(case
"UNOP%%"
(exp "numtype" (var "numtype"))
(exp "unop_" (var "unop_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "unop_") (var "unop_" (exp (var "numtype"))))
)
)
(case
"BINOP%%"
(exp "numtype" (var "numtype"))
(exp "binop_" (var "binop_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "binop_") (var "binop_" (exp (var "numtype"))))
)
)
(case
"TESTOP%%"
(exp "numtype" (var "numtype"))
(exp "testop_" (var "testop_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "testop_") (var "testop_" (exp (var "numtype"))))
)
)
(case
"RELOP%%"
(exp "numtype" (var "numtype"))
(exp "relop_" (var "relop_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "relop_") (var "relop_" (exp (var "numtype"))))
)
)
(case
"CVTOP%%%"
(exp "numtype_1" (var "numtype"))
(exp "numtype_2" (var "numtype"))
(exp
"cvtop__"
(var "cvtop__" (exp (var "numtype_2")) (exp (var "numtype_1")))
)
(tup
(bind (var "numtype_1") (var "numtype"))
(bind (var "numtype_2") (var "numtype"))
(bind
(var "cvtop__")
(var "cvtop__" (exp (var "numtype_2")) (exp (var "numtype_1")))
)
)
)
(case
"VCONST%%"
(exp "vectype" (var "vectype"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vec_") (var "vec_" (exp (var "vectype"))))
)
)
(case
"VVUNOP%%"
(exp "vectype" (var "vectype"))
(exp "vvunop" (var "vvunop"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vvunop") (var "vvunop"))
)
)
(case
"VVBINOP%%"
(exp "vectype" (var "vectype"))
(exp "vvbinop" (var "vvbinop"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vvbinop") (var "vvbinop"))
)
)
(case
"VVTERNOP%%"
(exp "vectype" (var "vectype"))
(exp "vvternop" (var "vvternop"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vvternop") (var "vvternop"))
)
)
(case
"VVTESTOP%%"
(exp "vectype" (var "vectype"))
(exp "vvtestop" (var "vvtestop"))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vvtestop") (var "vvtestop"))
)
)
(case
"VUNOP%%"
(exp "shape" (var "shape"))
(exp "vunop_" (var "vunop_" (exp (var "shape"))))
(tup
(bind (var "shape") (var "shape"))
(bind (var "vunop_") (var "vunop_" (exp (var "shape"))))
)
)
(case
"VBINOP%%"
(exp "shape" (var "shape"))
(exp "vbinop_" (var "vbinop_" (exp (var "shape"))))
(tup
(bind (var "shape") (var "shape"))
(bind (var "vbinop_") (var "vbinop_" (exp (var "shape"))))
)
)
(case
"VTERNOP%%"
(exp "shape" (var "shape"))
(exp "vternop_" (var "vternop_" (exp (var "shape"))))
(tup
(bind (var "shape") (var "shape"))
(bind (var "vternop_") (var "vternop_" (exp (var "shape"))))
)
)
(case
"VTESTOP%%"
(exp "shape" (var "shape"))
(exp "vtestop_" (var "vtestop_" (exp (var "shape"))))
(tup
(bind (var "shape") (var "shape"))
(bind (var "vtestop_") (var "vtestop_" (exp (var "shape"))))
)
)
(case
"VRELOP%%"
(exp "shape" (var "shape"))
(exp "vrelop_" (var "vrelop_" (exp (var "shape"))))
(tup
(bind (var "shape") (var "shape"))
(bind (var "vrelop_") (var "vrelop_" (exp (var "shape"))))
)
)
(case
"VSHIFTOP%%"
(exp "ishape" (var "ishape"))
(exp "vshiftop_" (var "vshiftop_" (exp (var "ishape"))))
(tup
(bind (var "ishape") (var "ishape"))
(bind (var "vshiftop_") (var "vshiftop_" (exp (var "ishape"))))
)
)
(case
"VBITMASK%"
(exp "ishape" (var "ishape"))
(tup (bind (var "ishape") (var "ishape")))
)
(case
"VSWIZZLOP%%"
(exp "bshape" (var "bshape"))
(exp "vswizzlop_" (var "vswizzlop_" (exp (var "bshape"))))
(tup
(bind (var "bshape") (var "bshape"))
(bind (var "vswizzlop_") (var "vswizzlop_" (exp (var "bshape"))))
)
)
(case
"VSHUFFLE%%"
(exp "bshape" (var "bshape"))
(exp "laneidx*" (iter (var "laneidx") list))
(tup
(bind (var "bshape") (var "bshape"))
(bind
(iter (var "laneidx") list (dom "laneidx" (var "laneidx*")))
(iter (var "laneidx") list)
)
)
(if
(cmp
eq
bool
(case
"%"
(tup
(len
(iter (var "laneidx") list (dom "laneidx" (var "laneidx*")))
)
)
)
(call "dim" (exp (proj (uncase (var "bshape") "%") 0)))
)
)
)
(case
"VEXTUNOP%%%"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextunop__"
(var "vextunop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
(tup
(bind (var "ishape_1") (var "ishape"))
(bind (var "ishape_2") (var "ishape"))
(bind
(var "vextunop__")
(var "vextunop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
)
)
(case
"VEXTBINOP%%%"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextbinop__"
(var "vextbinop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
(tup
(bind (var "ishape_1") (var "ishape"))
(bind (var "ishape_2") (var "ishape"))
(bind
(var "vextbinop__")
(var "vextbinop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
)
)
(case
"VEXTTERNOP%%%"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextternop__"
(var "vextternop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
(tup
(bind (var "ishape_1") (var "ishape"))
(bind (var "ishape_2") (var "ishape"))
(bind
(var "vextternop__")
(var "vextternop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
)
)
(case
"VNARROW%%%"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp "sx" (var "sx"))
(tup
(bind (var "ishape_1") (var "ishape"))
(bind (var "ishape_2") (var "ishape"))
(bind (var "sx") (var "sx"))
)
(if
(bin
and
bool
(cmp
eq
bool
(call
"lsize"
(exp
(call
"lanetype"
(exp (proj (uncase (var "ishape_2") "%") 0))
)
)
)
(bin
mul
nat
(num (nat 2))
(call
"lsize"
(exp
(call
"lanetype"
(exp (proj (uncase (var "ishape_1") "%") 0))
)
)
)
)
)
(cmp
le
nat
(bin
mul
nat
(num (nat 2))
(call
"lsize"
(exp
(call
"lanetype"
(exp (proj (uncase (var "ishape_1") "%") 0))
)
)
)
)
(num (nat 32))
)
)
)
)
(case
"VCVTOP%%%"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp
"vcvtop__"
(var "vcvtop__" (exp (var "shape_2")) (exp (var "shape_1")))
)
(tup
(bind (var "shape_1") (var "shape"))
(bind (var "shape_2") (var "shape"))
(bind
(var "vcvtop__")
(var "vcvtop__" (exp (var "shape_2")) (exp (var "shape_1")))
)
)
)
(case
"VSPLAT%"
(exp "shape" (var "shape"))
(tup (bind (var "shape") (var "shape")))
)
(case
"VEXTRACT_LANE%%%"
(exp "shape" (var "shape"))
(exp "sx?" (iter (var "sx") opt))
(exp "laneidx" (var "laneidx"))
(tup
(bind (var "shape") (var "shape"))
(bind
(iter (var "sx") opt (dom "sx" (var "sx?")))
(iter (var "sx") opt)
)
(bind (var "laneidx") (var "laneidx"))
)
(if
(bin
equiv
bool
(cmp eq bool (iter (var "sx") opt (dom "sx" (var "sx?"))) (opt))
(mem
(call "lanetype" (exp (var "shape")))
(list
(case "I32" (tup))
(case "I64" (tup))
(case "F32" (tup))
(case "F64" (tup))
)
)
)
)
)
(case
"VREPLACE_LANE%%"
(exp "shape" (var "shape"))
(exp "laneidx" (var "laneidx"))
(tup
(bind (var "shape") (var "shape"))
(bind (var "laneidx") (var "laneidx"))
)
)
(case
"REF.I31_NUM%"
(exp "u31" (var "u31"))
(tup (bind (var "u31") (var "u31")))
)
(case
"REF.STRUCT_ADDR%"
(exp "structaddr" (var "structaddr"))
(tup (bind (var "structaddr") (var "structaddr")))
)
(case
"REF.ARRAY_ADDR%"
(exp "arrayaddr" (var "arrayaddr"))
(tup (bind (var "arrayaddr") (var "arrayaddr")))
)
(case
"REF.FUNC_ADDR%"
(exp "funcaddr" (var "funcaddr"))
(tup (bind (var "funcaddr") (var "funcaddr")))
)
(case
"REF.EXN_ADDR%"
(exp "exnaddr" (var "exnaddr"))
(tup (bind (var "exnaddr") (var "exnaddr")))
)
(case
"REF.HOST_ADDR%"
(exp "hostaddr" (var "hostaddr"))
(tup (bind (var "hostaddr") (var "hostaddr")))
)
(case
"REF.EXTERN%"
(exp "addrref" (var "addrref"))
(tup (bind (var "addrref") (var "addrref")))
)
(case
"LABEL_%{%}%"
(exp "n" (var "n"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "n") (var "n"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
(bind (var "_") (iter (var "instr") list))
)
)
(case
"FRAME_%{%}%"
(exp "n" (var "n"))
(exp "frame" (var "frame"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "n") (var "n"))
(bind (var "frame") (var "frame"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
(case
"HANDLER_%{%}%"
(exp "n" (var "n"))
(exp "catch*" (iter (var "catch") list))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "n") (var "n"))
(bind
(iter (var "catch") list (dom "catch" (var "catch*")))
(iter (var "catch") list)
)
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
(case "TRAP" (tup))
)
)
)
)
(typ "expr" (inst (alias (iter (var "instr") list))))
(def
"memarg0"
(var "memarg")
(clause
(struct
(field "ALIGN" (case "%" (tup (num (nat 0)))))
(field "OFFSET" (case "%" (tup (num (nat 0)))))
)
)
)
(def
"const"
(exp "consttype" (var "consttype"))
(exp
"lit_"
(var
"lit_"
(exp (sub (var "consttype") (var "storagetype") (var "consttype")))
)
)
(var "instr")
(clause
(exp "numtype" (var "numtype"))
(exp
"c"
(var
"lit_"
(exp (sub (var "numtype") (var "storagetype") (var "numtype")))
)
)
(exp (sub (var "numtype") (var "consttype") (var "numtype")))
(exp (var "c"))
(case "CONST%%" (tup (var "numtype") (var "c")))
)
(clause
(exp "vectype" (var "vectype"))
(exp
"c"
(var
"lit_"
(exp (sub (var "vectype") (var "storagetype") (var "vectype")))
)
)
(exp (sub (var "vectype") (var "consttype") (var "vectype")))
(exp (var "c"))
(case "VCONST%%" (tup (var "vectype") (var "c")))
)
)
(def
"free_shape"
(exp "shape" (var "shape"))
(var "free")
(clause
(exp "lanetype" (var "lanetype"))
(exp "dim" (var "dim"))
(exp (case "%X%" (tup (var "lanetype") (var "dim"))))
(call "free_lanetype" (exp (var "lanetype")))
)
)
(def
"free_blocktype"
(exp "blocktype" (var "blocktype"))
(var "free")
(clause
(exp "valtype?" (iter (var "valtype") opt))
(exp
(case
"_RESULT%"
(tup (iter (var "valtype") opt (dom "valtype" (var "valtype?"))))
)
)
(call
"free_opt"
(exp
(iter
(call "free_valtype" (exp (var "valtype")))
opt
(dom "valtype" (var "valtype?"))
)
)
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "_IDX%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
)
(rec
(def
"shift_labelidxs"
(exp "_" (iter (var "labelidx") list))
(iter (var "labelidx") list)
(clause (exp (list)) (list))
(clause
(exp "labelidx'*" (iter (var "labelidx") list))
(exp
(cat
(list (case "%" (tup (num (nat 0)))))
(iter (var "labelidx'") list (dom "labelidx'" (var "labelidx'*")))
)
)
(call
"shift_labelidxs"
(exp (iter (var "labelidx'") list (dom "labelidx'" (var "labelidx'*"))))
)
)
(clause
(exp "labelidx" (var "labelidx"))
(exp "labelidx'*" (iter (var "labelidx") list))
(exp
(cat
(list (var "labelidx"))
(iter (var "labelidx'") list (dom "labelidx'" (var "labelidx'*")))
)
)
(cat
(list
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "labelidx") "%") 0))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(call
"shift_labelidxs"
(exp
(iter (var "labelidx'") list (dom "labelidx'" (var "labelidx'*")))
)
)
)
)
)
)
(rec
(def
"free_instr"
(exp "instr" (var "instr"))
(var "free")
(clause
(exp (case "NOP" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp (case "UNREACHABLE" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp (case "DROP" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "valtype*?" (iter (iter (var "valtype") list) opt))
(exp
(case
"SELECT%"
(tup
(iter
(iter (var "valtype") list (dom "valtype" (var "valtype*")))
opt
(dom "valtype*" (var "valtype*?"))
)
)
)
)
(call
"free_opt"
(exp
(iter
(call
"free_list"
(exp
(iter
(call "free_valtype" (exp (var "valtype")))
list
(dom "valtype" (var "valtype*"))
)
)
)
opt
(dom "valtype*" (var "valtype*?"))
)
)
)
)
(clause
(exp "blocktype" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp
(case
"BLOCK%%"
(tup
(var "blocktype")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
(comp
(call "free_blocktype" (exp (var "blocktype")))
(call
"free_block"
(exp (iter (var "instr") list (dom "instr" (var "instr*"))))
)
)
)
(clause
(exp "blocktype" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp
(case
"LOOP%%"
(tup
(var "blocktype")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
(comp
(call "free_blocktype" (exp (var "blocktype")))
(call
"free_block"
(exp (iter (var "instr") list (dom "instr" (var "instr*"))))
)
)
)
(clause
(exp "blocktype" (var "blocktype"))
(exp "instr_1*" (iter (var "instr") list))
(exp "instr_2*" (iter (var "instr") list))
(exp
(case
"IF%%ELSE%"
(tup
(var "blocktype")
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
)
)
)
(comp
(comp
(call "free_blocktype" (exp (var "blocktype")))
(call
"free_block"
(exp (iter (var "instr_1") list (dom "instr_1" (var "instr_1*"))))
)
)
(call
"free_block"
(exp (iter (var "instr_2") list (dom "instr_2" (var "instr_2*"))))
)
)
)
(clause
(exp "labelidx" (var "labelidx"))
(exp (case "BR%" (tup (var "labelidx"))))
(call "free_labelidx" (exp (var "labelidx")))
)
(clause
(exp "labelidx" (var "labelidx"))
(exp (case "BR_IF%" (tup (var "labelidx"))))
(call "free_labelidx" (exp (var "labelidx")))
)
(clause
(exp "labelidx*" (iter (var "labelidx") list))
(exp "labelidx'" (var "labelidx"))
(exp
(case
"BR_TABLE%%"
(tup
(iter (var "labelidx") list (dom "labelidx" (var "labelidx*")))
(var "labelidx'")
)
)
)
(comp
(call
"free_list"
(exp
(iter
(call "free_labelidx" (exp (var "labelidx")))
list
(dom "labelidx" (var "labelidx*"))
)
)
)
(call "free_labelidx" (exp (var "labelidx'")))
)
)
(clause
(exp "labelidx" (var "labelidx"))
(exp (case "BR_ON_NULL%" (tup (var "labelidx"))))
(call "free_labelidx" (exp (var "labelidx")))
)
(clause
(exp "labelidx" (var "labelidx"))
(exp (case "BR_ON_NON_NULL%" (tup (var "labelidx"))))
(call "free_labelidx" (exp (var "labelidx")))
)
(clause
(exp "labelidx" (var "labelidx"))
(exp "reftype_1" (var "reftype"))
(exp "reftype_2" (var "reftype"))
(exp
(case
"BR_ON_CAST%%%"
(tup (var "labelidx") (var "reftype_1") (var "reftype_2"))
)
)
(comp
(comp
(call "free_labelidx" (exp (var "labelidx")))
(call "free_reftype" (exp (var "reftype_1")))
)
(call "free_reftype" (exp (var "reftype_2")))
)
)
(clause
(exp "labelidx" (var "labelidx"))
(exp "reftype_1" (var "reftype"))
(exp "reftype_2" (var "reftype"))
(exp
(case
"BR_ON_CAST_FAIL%%%"
(tup (var "labelidx") (var "reftype_1") (var "reftype_2"))
)
)
(comp
(comp
(call "free_labelidx" (exp (var "labelidx")))
(call "free_reftype" (exp (var "reftype_1")))
)
(call "free_reftype" (exp (var "reftype_2")))
)
)
(clause
(exp "funcidx" (var "funcidx"))
(exp (case "CALL%" (tup (var "funcidx"))))
(call "free_funcidx" (exp (var "funcidx")))
)
(clause
(exp "typeuse" (var "typeuse"))
(exp (case "CALL_REF%" (tup (var "typeuse"))))
(call "free_typeuse" (exp (var "typeuse")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp "typeuse" (var "typeuse"))
(exp (case "CALL_INDIRECT%%" (tup (var "tableidx") (var "typeuse"))))
(comp
(call "free_tableidx" (exp (var "tableidx")))
(call "free_typeuse" (exp (var "typeuse")))
)
)
(clause
(exp (case "RETURN" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "funcidx" (var "funcidx"))
(exp (case "RETURN_CALL%" (tup (var "funcidx"))))
(call "free_funcidx" (exp (var "funcidx")))
)
(clause
(exp "typeuse" (var "typeuse"))
(exp (case "RETURN_CALL_REF%" (tup (var "typeuse"))))
(call "free_typeuse" (exp (var "typeuse")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp "typeuse" (var "typeuse"))
(exp
(case "RETURN_CALL_INDIRECT%%" (tup (var "tableidx") (var "typeuse")))
)
(comp
(call "free_tableidx" (exp (var "tableidx")))
(call "free_typeuse" (exp (var "typeuse")))
)
)
(clause
(exp "numtype" (var "numtype"))
(exp "numlit" (var "num_" (exp (var "numtype"))))
(exp (case "CONST%%" (tup (var "numtype") (var "numlit"))))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "numtype" (var "numtype"))
(exp "unop" (var "unop_" (exp (var "numtype"))))
(exp (case "UNOP%%" (tup (var "numtype") (var "unop"))))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "numtype" (var "numtype"))
(exp "binop" (var "binop_" (exp (var "numtype"))))
(exp (case "BINOP%%" (tup (var "numtype") (var "binop"))))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "numtype" (var "numtype"))
(exp "testop" (var "testop_" (exp (var "numtype"))))
(exp (case "TESTOP%%" (tup (var "numtype") (var "testop"))))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "numtype" (var "numtype"))
(exp "relop" (var "relop_" (exp (var "numtype"))))
(exp (case "RELOP%%" (tup (var "numtype") (var "relop"))))
(call "free_numtype" (exp (var "numtype")))
)
(clause
(exp "numtype_1" (var "numtype"))
(exp "numtype_2" (var "numtype"))
(exp
"cvtop"
(var "cvtop__" (exp (var "numtype_2")) (exp (var "numtype_1")))
)
(exp
(case
"CVTOP%%%"
(tup (var "numtype_1") (var "numtype_2") (var "cvtop"))
)
)
(comp
(call "free_numtype" (exp (var "numtype_1")))
(call "free_numtype" (exp (var "numtype_2")))
)
)
(clause
(exp "vectype" (var "vectype"))
(exp "veclit" (var "vec_" (exp (var "vectype"))))
(exp (case "VCONST%%" (tup (var "vectype") (var "veclit"))))
(call "free_vectype" (exp (var "vectype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp "vvunop" (var "vvunop"))
(exp (case "VVUNOP%%" (tup (var "vectype") (var "vvunop"))))
(call "free_vectype" (exp (var "vectype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp "vvbinop" (var "vvbinop"))
(exp (case "VVBINOP%%" (tup (var "vectype") (var "vvbinop"))))
(call "free_vectype" (exp (var "vectype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp "vvternop" (var "vvternop"))
(exp (case "VVTERNOP%%" (tup (var "vectype") (var "vvternop"))))
(call "free_vectype" (exp (var "vectype")))
)
(clause
(exp "vectype" (var "vectype"))
(exp "vvtestop" (var "vvtestop"))
(exp (case "VVTESTOP%%" (tup (var "vectype") (var "vvtestop"))))
(call "free_vectype" (exp (var "vectype")))
)
(clause
(exp "shape" (var "shape"))
(exp "vunop" (var "vunop_" (exp (var "shape"))))
(exp (case "VUNOP%%" (tup (var "shape") (var "vunop"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "shape" (var "shape"))
(exp "vbinop" (var "vbinop_" (exp (var "shape"))))
(exp (case "VBINOP%%" (tup (var "shape") (var "vbinop"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "shape" (var "shape"))
(exp "vternop" (var "vternop_" (exp (var "shape"))))
(exp (case "VTERNOP%%" (tup (var "shape") (var "vternop"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "shape" (var "shape"))
(exp "vtestop" (var "vtestop_" (exp (var "shape"))))
(exp (case "VTESTOP%%" (tup (var "shape") (var "vtestop"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "shape" (var "shape"))
(exp "vrelop" (var "vrelop_" (exp (var "shape"))))
(exp (case "VRELOP%%" (tup (var "shape") (var "vrelop"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "ishape" (var "ishape"))
(exp "vshiftop" (var "vshiftop_" (exp (var "ishape"))))
(exp (case "VSHIFTOP%%" (tup (var "ishape") (var "vshiftop"))))
(call "free_shape" (exp (proj (uncase (var "ishape") "%") 0)))
)
(clause
(exp "ishape" (var "ishape"))
(exp (case "VBITMASK%" (tup (var "ishape"))))
(call "free_shape" (exp (proj (uncase (var "ishape") "%") 0)))
)
(clause
(exp "bshape" (var "bshape"))
(exp "vswizzlop" (var "vswizzlop_" (exp (var "bshape"))))
(exp (case "VSWIZZLOP%%" (tup (var "bshape") (var "vswizzlop"))))
(call "free_shape" (exp (proj (uncase (var "bshape") "%") 0)))
)
(clause
(exp "bshape" (var "bshape"))
(exp "laneidx*" (iter (var "laneidx") list))
(exp
(case
"VSHUFFLE%%"
(tup
(var "bshape")
(iter (var "laneidx") list (dom "laneidx" (var "laneidx*")))
)
)
)
(call "free_shape" (exp (proj (uncase (var "bshape") "%") 0)))
)
(clause
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextunop"
(var "vextunop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
(exp
(case
"VEXTUNOP%%%"
(tup (var "ishape_1") (var "ishape_2") (var "vextunop"))
)
)
(comp
(call "free_shape" (exp (proj (uncase (var "ishape_1") "%") 0)))
(call "free_shape" (exp (proj (uncase (var "ishape_2") "%") 0)))
)
)
(clause
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextbinop"
(var "vextbinop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
(exp
(case
"VEXTBINOP%%%"
(tup (var "ishape_1") (var "ishape_2") (var "vextbinop"))
)
)
(comp
(call "free_shape" (exp (proj (uncase (var "ishape_1") "%") 0)))
(call "free_shape" (exp (proj (uncase (var "ishape_2") "%") 0)))
)
)
(clause
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextternop"
(var "vextternop__" (exp (var "ishape_2")) (exp (var "ishape_1")))
)
(exp
(case
"VEXTTERNOP%%%"
(tup (var "ishape_1") (var "ishape_2") (var "vextternop"))
)
)
(comp
(call "free_shape" (exp (proj (uncase (var "ishape_1") "%") 0)))
(call "free_shape" (exp (proj (uncase (var "ishape_2") "%") 0)))
)
)
(clause
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp "sx" (var "sx"))
(exp
(case "VNARROW%%%" (tup (var "ishape_1") (var "ishape_2") (var "sx")))
)
(comp
(call "free_shape" (exp (proj (uncase (var "ishape_1") "%") 0)))
(call "free_shape" (exp (proj (uncase (var "ishape_2") "%") 0)))
)
)
(clause
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp
"vcvtop"
(var "vcvtop__" (exp (var "shape_2")) (exp (var "shape_1")))
)
(exp
(case "VCVTOP%%%" (tup (var "shape_1") (var "shape_2") (var "vcvtop")))
)
(comp
(call "free_shape" (exp (var "shape_1")))
(call "free_shape" (exp (var "shape_2")))
)
)
(clause
(exp "shape" (var "shape"))
(exp (case "VSPLAT%" (tup (var "shape"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "shape" (var "shape"))
(exp "sx?" (iter (var "sx") opt))
(exp "laneidx" (var "laneidx"))
(exp
(case
"VEXTRACT_LANE%%%"
(tup
(var "shape")
(iter (var "sx") opt (dom "sx" (var "sx?")))
(var "laneidx")
)
)
)
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "shape" (var "shape"))
(exp "laneidx" (var "laneidx"))
(exp (case "VREPLACE_LANE%%" (tup (var "shape") (var "laneidx"))))
(call "free_shape" (exp (var "shape")))
)
(clause
(exp "heaptype" (var "heaptype"))
(exp (case "REF.NULL%" (tup (var "heaptype"))))
(call "free_heaptype" (exp (var "heaptype")))
)
(clause
(exp (case "REF.IS_NULL" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp (case "REF.AS_NON_NULL" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp (case "REF.EQ" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "reftype" (var "reftype"))
(exp (case "REF.TEST%" (tup (var "reftype"))))
(call "free_reftype" (exp (var "reftype")))
)
(clause
(exp "reftype" (var "reftype"))
(exp (case "REF.CAST%" (tup (var "reftype"))))
(call "free_reftype" (exp (var "reftype")))
)
(clause
(exp "funcidx" (var "funcidx"))
(exp (case "REF.FUNC%" (tup (var "funcidx"))))
(call "free_funcidx" (exp (var "funcidx")))
)
(clause
(exp (case "REF.I31" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "sx" (var "sx"))
(exp (case "I31.GET%" (tup (var "sx"))))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "STRUCT.NEW%" (tup (var "typeidx"))))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "STRUCT.NEW_DEFAULT%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "sx?" (iter (var "sx") opt))
(exp "typeidx" (var "typeidx"))
(exp "u32" (var "u32"))
(exp
(case
"STRUCT.GET%%%"
(tup
(iter (var "sx") opt (dom "sx" (var "sx?")))
(var "typeidx")
(var "u32")
)
)
)
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "u32" (var "u32"))
(exp (case "STRUCT.SET%%" (tup (var "typeidx") (var "u32"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "ARRAY.NEW%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "ARRAY.NEW_DEFAULT%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "u32" (var "u32"))
(exp (case "ARRAY.NEW_FIXED%%" (tup (var "typeidx") (var "u32"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "dataidx" (var "dataidx"))
(exp (case "ARRAY.NEW_DATA%%" (tup (var "typeidx") (var "dataidx"))))
(comp
(call "free_typeidx" (exp (var "typeidx")))
(call "free_dataidx" (exp (var "dataidx")))
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "elemidx" (var "elemidx"))
(exp (case "ARRAY.NEW_ELEM%%" (tup (var "typeidx") (var "elemidx"))))
(comp
(call "free_typeidx" (exp (var "typeidx")))
(call "free_elemidx" (exp (var "elemidx")))
)
)
(clause
(exp "sx?" (iter (var "sx") opt))
(exp "typeidx" (var "typeidx"))
(exp
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "typeidx"))
)
)
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "ARRAY.SET%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp (case "ARRAY.LEN" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp (case "ARRAY.FILL%" (tup (var "typeidx"))))
(call "free_typeidx" (exp (var "typeidx")))
)
(clause
(exp "typeidx_1" (var "typeidx"))
(exp "typeidx_2" (var "typeidx"))
(exp (case "ARRAY.COPY%%" (tup (var "typeidx_1") (var "typeidx_2"))))
(comp
(call "free_typeidx" (exp (var "typeidx_1")))
(call "free_typeidx" (exp (var "typeidx_2")))
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "dataidx" (var "dataidx"))
(exp (case "ARRAY.INIT_DATA%%" (tup (var "typeidx") (var "dataidx"))))
(comp
(call "free_typeidx" (exp (var "typeidx")))
(call "free_dataidx" (exp (var "dataidx")))
)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "elemidx" (var "elemidx"))
(exp (case "ARRAY.INIT_ELEM%%" (tup (var "typeidx") (var "elemidx"))))
(comp
(call "free_typeidx" (exp (var "typeidx")))
(call "free_elemidx" (exp (var "elemidx")))
)
)
(clause
(exp (case "EXTERN.CONVERT_ANY" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp (case "ANY.CONVERT_EXTERN" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp "localidx" (var "localidx"))
(exp (case "LOCAL.GET%" (tup (var "localidx"))))
(call "free_localidx" (exp (var "localidx")))
)
(clause
(exp "localidx" (var "localidx"))
(exp (case "LOCAL.SET%" (tup (var "localidx"))))
(call "free_localidx" (exp (var "localidx")))
)
(clause
(exp "localidx" (var "localidx"))
(exp (case "LOCAL.TEE%" (tup (var "localidx"))))
(call "free_localidx" (exp (var "localidx")))
)
(clause
(exp "globalidx" (var "globalidx"))
(exp (case "GLOBAL.GET%" (tup (var "globalidx"))))
(call "free_globalidx" (exp (var "globalidx")))
)
(clause
(exp "globalidx" (var "globalidx"))
(exp (case "GLOBAL.SET%" (tup (var "globalidx"))))
(call "free_globalidx" (exp (var "globalidx")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp (case "TABLE.GET%" (tup (var "tableidx"))))
(call "free_tableidx" (exp (var "tableidx")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp (case "TABLE.SET%" (tup (var "tableidx"))))
(call "free_tableidx" (exp (var "tableidx")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp (case "TABLE.SIZE%" (tup (var "tableidx"))))
(call "free_tableidx" (exp (var "tableidx")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp (case "TABLE.GROW%" (tup (var "tableidx"))))
(call "free_tableidx" (exp (var "tableidx")))
)
(clause
(exp "tableidx" (var "tableidx"))
(exp (case "TABLE.FILL%" (tup (var "tableidx"))))
(call "free_tableidx" (exp (var "tableidx")))
)
(clause
(exp "tableidx_1" (var "tableidx"))
(exp "tableidx_2" (var "tableidx"))
(exp (case "TABLE.COPY%%" (tup (var "tableidx_1") (var "tableidx_2"))))
(comp
(call "free_tableidx" (exp (var "tableidx_1")))
(call "free_tableidx" (exp (var "tableidx_2")))
)
)
(clause
(exp "tableidx" (var "tableidx"))
(exp "elemidx" (var "elemidx"))
(exp (case "TABLE.INIT%%" (tup (var "tableidx") (var "elemidx"))))
(comp
(call "free_tableidx" (exp (var "tableidx")))
(call "free_elemidx" (exp (var "elemidx")))
)
)
(clause
(exp "elemidx" (var "elemidx"))
(exp (case "ELEM.DROP%" (tup (var "elemidx"))))
(call "free_elemidx" (exp (var "elemidx")))
)
(clause
(exp "numtype" (var "numtype"))
(exp "loadop?" (iter (var "loadop_" (exp (var "numtype"))) opt))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp
(case
"LOAD%%%%"
(tup
(var "numtype")
(iter (var "loadop") opt (dom "loadop" (var "loadop?")))
(var "memidx")
(var "memarg")
)
)
)
(comp
(call "free_numtype" (exp (var "numtype")))
(call "free_memidx" (exp (var "memidx")))
)
)
(clause
(exp "numtype" (var "numtype"))
(exp "storeop?" (iter (var "storeop_" (exp (var "numtype"))) opt))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp
(case
"STORE%%%%"
(tup
(var "numtype")
(iter (var "storeop") opt (dom "storeop" (var "storeop?")))
(var "memidx")
(var "memarg")
)
)
)
(comp
(call "free_numtype" (exp (var "numtype")))
(call "free_memidx" (exp (var "memidx")))
)
)
(clause
(exp "vectype" (var "vectype"))
(exp "vloadop?" (iter (var "vloadop_" (exp (var "vectype"))) opt))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp
(case
"VLOAD%%%%"
(tup
(var "vectype")
(iter (var "vloadop") opt (dom "vloadop" (var "vloadop?")))
(var "memidx")
(var "memarg")
)
)
)
(comp
(call "free_vectype" (exp (var "vectype")))
(call "free_memidx" (exp (var "memidx")))
)
)
(clause
(exp "vectype" (var "vectype"))
(exp "sz" (var "sz"))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp "laneidx" (var "laneidx"))
(exp
(case
"VLOAD_LANE%%%%%"
(tup
(var "vectype")
(var "sz")
(var "memidx")
(var "memarg")
(var "laneidx")
)
)
)
(comp
(call "free_vectype" (exp (var "vectype")))
(call "free_memidx" (exp (var "memidx")))
)
)
(clause
(exp "vectype" (var "vectype"))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp
(case "VSTORE%%%" (tup (var "vectype") (var "memidx") (var "memarg")))
)
(comp
(call "free_vectype" (exp (var "vectype")))
(call "free_memidx" (exp (var "memidx")))
)
)
(clause
(exp "vectype" (var "vectype"))
(exp "sz" (var "sz"))
(exp "memidx" (var "memidx"))
(exp "memarg" (var "memarg"))
(exp "laneidx" (var "laneidx"))
(exp
(case
"VSTORE_LANE%%%%%"
(tup
(var "vectype")
(var "sz")
(var "memidx")
(var "memarg")
(var "laneidx")
)
)
)
(comp
(call "free_vectype" (exp (var "vectype")))
(call "free_memidx" (exp (var "memidx")))
)
)
(clause
(exp "memidx" (var "memidx"))
(exp (case "MEMORY.SIZE%" (tup (var "memidx"))))
(call "free_memidx" (exp (var "memidx")))
)
(clause
(exp "memidx" (var "memidx"))
(exp (case "MEMORY.GROW%" (tup (var "memidx"))))
(call "free_memidx" (exp (var "memidx")))
)
(clause
(exp "memidx" (var "memidx"))
(exp (case "MEMORY.FILL%" (tup (var "memidx"))))
(call "free_memidx" (exp (var "memidx")))
)
(clause
(exp "memidx_1" (var "memidx"))
(exp "memidx_2" (var "memidx"))
(exp (case "MEMORY.COPY%%" (tup (var "memidx_1") (var "memidx_2"))))
(comp
(call "free_memidx" (exp (var "memidx_1")))
(call "free_memidx" (exp (var "memidx_2")))
)
)
(clause
(exp "memidx" (var "memidx"))
(exp "dataidx" (var "dataidx"))
(exp (case "MEMORY.INIT%%" (tup (var "memidx") (var "dataidx"))))
(comp
(call "free_memidx" (exp (var "memidx")))
(call "free_dataidx" (exp (var "dataidx")))
)
)
(clause
(exp "dataidx" (var "dataidx"))
(exp (case "DATA.DROP%" (tup (var "dataidx"))))
(call "free_dataidx" (exp (var "dataidx")))
)
)
(def
"free_block"
(exp "_" (iter (var "instr") list))
(var "free")
(clause
(exp "instr*" (iter (var "instr") list))
(exp "free" (var "free"))
(exp (iter (var "instr") list (dom "instr" (var "instr*"))))
(upd
(var "free")
(dot root "LABELS")
(call "shift_labelidxs" (exp (dot (var "free") "LABELS")))
)
(if
(cmp
eq
bool
(var "free")
(call
"free_list"
(exp
(iter
(call "free_instr" (exp (var "instr")))
list
(dom "instr" (var "instr*"))
)
)
)
)
)
)
)
)
(def
"free_expr"
(exp "expr" (var "expr"))
(var "free")
(clause
(exp "instr*" (iter (var "instr") list))
(exp (iter (var "instr") list (dom "instr" (var "instr*"))))
(call
"free_list"
(exp
(iter
(call "free_instr" (exp (var "instr")))
list
(dom "instr" (var "instr*"))
)
)
)
)
)
(typ
"elemmode"
(inst
(variant
(case
"ACTIVE%%"
(exp "tableidx" (var "tableidx"))
(exp "expr" (var "expr"))
(tup
(bind (var "tableidx") (var "tableidx"))
(bind (var "expr") (var "expr"))
)
)
(case "PASSIVE" (tup))
(case "DECLARE" (tup))
)
)
)
(typ
"datamode"
(inst
(variant
(case
"ACTIVE%%"
(exp "memidx" (var "memidx"))
(exp "expr" (var "expr"))
(tup
(bind (var "memidx") (var "memidx"))
(bind (var "expr") (var "expr"))
)
)
(case "PASSIVE" (tup))
)
)
)
(typ
"type"
(inst
(variant
(case
"TYPE%"
(exp "rectype" (var "rectype"))
(tup (bind (var "rectype") (var "rectype")))
)
)
)
)
(typ
"tag"
(inst
(variant
(case
"TAG%"
(exp "tagtype" (var "tagtype"))
(tup (bind (var "tagtype") (var "tagtype")))
)
)
)
)
(typ
"global"
(inst
(variant
(case
"GLOBAL%%"
(exp "globaltype" (var "globaltype"))
(exp "expr" (var "expr"))
(tup
(bind (var "globaltype") (var "globaltype"))
(bind (var "expr") (var "expr"))
)
)
)
)
)
(typ
"mem"
(inst
(variant
(case
"MEMORY%"
(exp "memtype" (var "memtype"))
(tup (bind (var "memtype") (var "memtype")))
)
)
)
)
(typ
"table"
(inst
(variant
(case
"TABLE%%"
(exp "tabletype" (var "tabletype"))
(exp "expr" (var "expr"))
(tup
(bind (var "tabletype") (var "tabletype"))
(bind (var "expr") (var "expr"))
)
)
)
)
)
(typ
"data"
(inst
(variant
(case
"DATA%%"
(exp "byte*" (iter (var "byte") list))
(exp "datamode" (var "datamode"))
(tup
(bind
(iter (var "byte") list (dom "byte" (var "byte*")))
(iter (var "byte") list)
)
(bind (var "datamode") (var "datamode"))
)
)
)
)
)
(typ
"local"
(inst
(variant
(case
"LOCAL%"
(exp "valtype" (var "valtype"))
(tup (bind (var "valtype") (var "valtype")))
)
)
)
)
(typ
"func"
(inst
(variant
(case
"FUNC%%%"
(exp "typeidx" (var "typeidx"))
(exp "local*" (iter (var "local") list))
(exp "expr" (var "expr"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind
(iter (var "local") list (dom "local" (var "local*")))
(iter (var "local") list)
)
(bind (var "expr") (var "expr"))
)
)
)
)
)
(typ
"elem"
(inst
(variant
(case
"ELEM%%%"
(exp "reftype" (var "reftype"))
(exp "expr*" (iter (var "expr") list))
(exp "elemmode" (var "elemmode"))
(tup
(bind (var "reftype") (var "reftype"))
(bind
(iter (var "expr") list (dom "expr" (var "expr*")))
(iter (var "expr") list)
)
(bind (var "elemmode") (var "elemmode"))
)
)
)
)
)
(typ
"start"
(inst
(variant
(case
"START%"
(exp "funcidx" (var "funcidx"))
(tup (bind (var "funcidx") (var "funcidx")))
)
)
)
)
(typ
"import"
(inst
(variant
(case
"IMPORT%%%"
(exp "name" (var "name"))
(exp "externtype" (var "externtype"))
(tup
(bind (var "name") (var "name"))
(bind (var "_") (var "name"))
(bind (var "externtype") (var "externtype"))
)
)
)
)
)
(typ
"export"
(inst
(variant
(case
"EXPORT%%"
(exp "name" (var "name"))
(exp "externidx" (var "externidx"))
(tup
(bind (var "name") (var "name"))
(bind (var "externidx") (var "externidx"))
)
)
)
)
)
(typ
"module"
(inst
(variant
(case
"MODULE%%%%%%%%%%%"
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "func*" (iter (var "func") list))
(exp "data*" (iter (var "data") list))
(exp "elem*" (iter (var "elem") list))
(exp "start?" (iter (var "start") opt))
(exp "export*" (iter (var "export") list))
(tup
(bind
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "type") list)
)
(bind
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "import") list)
)
(bind
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "tag") list)
)
(bind
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "global") list)
)
(bind
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "mem") list)
)
(bind
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "table") list)
)
(bind
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "func") list)
)
(bind
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "data") list)
)
(bind
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "elem") list)
)
(bind
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "start") opt)
)
(bind
(iter (var "export") list (dom "export" (var "export*")))
(iter (var "export") list)
)
)
)
)
)
)
(def
"free_type"
(exp "type" (var "type"))
(var "free")
(clause
(exp "rectype" (var "rectype"))
(exp (case "TYPE%" (tup (var "rectype"))))
(call "free_rectype" (exp (var "rectype")))
)
)
(def
"free_tag"
(exp "tag" (var "tag"))
(var "free")
(clause
(exp "tagtype" (var "tagtype"))
(exp (case "TAG%" (tup (var "tagtype"))))
(call "free_tagtype" (exp (var "tagtype")))
)
)
(def
"free_global"
(exp "global" (var "global"))
(var "free")
(clause
(exp "globaltype" (var "globaltype"))
(exp "expr" (var "expr"))
(exp (case "GLOBAL%%" (tup (var "globaltype") (var "expr"))))
(comp
(call "free_globaltype" (exp (var "globaltype")))
(call "free_expr" (exp (var "expr")))
)
)
)
(def
"free_mem"
(exp "mem" (var "mem"))
(var "free")
(clause
(exp "memtype" (var "memtype"))
(exp (case "MEMORY%" (tup (var "memtype"))))
(call "free_memtype" (exp (var "memtype")))
)
)
(def
"free_table"
(exp "table" (var "table"))
(var "free")
(clause
(exp "tabletype" (var "tabletype"))
(exp "expr" (var "expr"))
(exp (case "TABLE%%" (tup (var "tabletype") (var "expr"))))
(comp
(call "free_tabletype" (exp (var "tabletype")))
(call "free_expr" (exp (var "expr")))
)
)
)
(def
"free_local"
(exp "local" (var "local"))
(var "free")
(clause
(exp "t" (var "valtype"))
(exp (case "LOCAL%" (tup (var "t"))))
(call "free_valtype" (exp (var "t")))
)
)
(def
"free_func"
(exp "func" (var "func"))
(var "free")
(clause
(exp "typeidx" (var "typeidx"))
(exp "local*" (iter (var "local") list))
(exp "expr" (var "expr"))
(exp
(case
"FUNC%%%"
(tup
(var "typeidx")
(iter (var "local") list (dom "local" (var "local*")))
(var "expr")
)
)
)
(comp
(comp
(call "free_typeidx" (exp (var "typeidx")))
(call
"free_list"
(exp
(iter
(call "free_local" (exp (var "local")))
list
(dom "local" (var "local*"))
)
)
)
)
(upd (call "free_block" (exp (var "expr"))) (dot root "LOCALS") (list))
)
)
)
(def
"free_datamode"
(exp "datamode" (var "datamode"))
(var "free")
(clause
(exp "memidx" (var "memidx"))
(exp "expr" (var "expr"))
(exp (case "ACTIVE%%" (tup (var "memidx") (var "expr"))))
(comp
(call "free_memidx" (exp (var "memidx")))
(call "free_expr" (exp (var "expr")))
)
)
(clause
(exp (case "PASSIVE" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_data"
(exp "data" (var "data"))
(var "free")
(clause
(exp "byte*" (iter (var "byte") list))
(exp "datamode" (var "datamode"))
(exp
(case
"DATA%%"
(tup
(iter (var "byte") list (dom "byte" (var "byte*")))
(var "datamode")
)
)
)
(call "free_datamode" (exp (var "datamode")))
)
)
(def
"free_elemmode"
(exp "elemmode" (var "elemmode"))
(var "free")
(clause
(exp "tableidx" (var "tableidx"))
(exp "expr" (var "expr"))
(exp (case "ACTIVE%%" (tup (var "tableidx") (var "expr"))))
(comp
(call "free_tableidx" (exp (var "tableidx")))
(call "free_expr" (exp (var "expr")))
)
)
(clause
(exp (case "PASSIVE" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
(clause
(exp (case "DECLARE" (tup)))
(struct
(field "TYPES" (list))
(field "FUNCS" (list))
(field "GLOBALS" (list))
(field "TABLES" (list))
(field "MEMS" (list))
(field "ELEMS" (list))
(field "DATAS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
)
)
)
(def
"free_elem"
(exp "elem" (var "elem"))
(var "free")
(clause
(exp "reftype" (var "reftype"))
(exp "expr*" (iter (var "expr") list))
(exp "elemmode" (var "elemmode"))
(exp
(case
"ELEM%%%"
(tup
(var "reftype")
(iter (var "expr") list (dom "expr" (var "expr*")))
(var "elemmode")
)
)
)
(comp
(comp
(call "free_reftype" (exp (var "reftype")))
(call
"free_list"
(exp
(iter
(call "free_expr" (exp (var "expr")))
list
(dom "expr" (var "expr*"))
)
)
)
)
(call "free_elemmode" (exp (var "elemmode")))
)
)
)
(def
"free_start"
(exp "start" (var "start"))
(var "free")
(clause
(exp "funcidx" (var "funcidx"))
(exp (case "START%" (tup (var "funcidx"))))
(call "free_funcidx" (exp (var "funcidx")))
)
)
(def
"free_import"
(exp "import" (var "import"))
(var "free")
(clause
(exp "name_1" (var "name"))
(exp "name_2" (var "name"))
(exp "externtype" (var "externtype"))
(exp
(case "IMPORT%%%" (tup (var "name_1") (var "name_2") (var "externtype")))
)
(call "free_externtype" (exp (var "externtype")))
)
)
(def
"free_export"
(exp "export" (var "export"))
(var "free")
(clause
(exp "name" (var "name"))
(exp "externidx" (var "externidx"))
(exp (case "EXPORT%%" (tup (var "name") (var "externidx"))))
(call "free_externidx" (exp (var "externidx")))
)
)
(def
"free_module"
(exp "module" (var "module"))
(var "free")
(clause
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "func*" (iter (var "func") list))
(exp "data*" (iter (var "data") list))
(exp "elem*" (iter (var "elem") list))
(exp "start?" (iter (var "start") opt))
(exp "export*" (iter (var "export") list))
(exp
(case
"MODULE%%%%%%%%%%%"
(tup
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "export") list (dom "export" (var "export*")))
)
)
)
(comp
(comp
(comp
(comp
(comp
(comp
(comp
(comp
(comp
(comp
(call
"free_list"
(exp
(iter
(call "free_type" (exp (var "type")))
list
(dom "type" (var "type*"))
)
)
)
(call
"free_list"
(exp
(iter
(call "free_tag" (exp (var "tag")))
list
(dom "tag" (var "tag*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_global" (exp (var "global")))
list
(dom "global" (var "global*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_mem" (exp (var "mem")))
list
(dom "mem" (var "mem*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_table" (exp (var "table")))
list
(dom "table" (var "table*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_func" (exp (var "func")))
list
(dom "func" (var "func*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_data" (exp (var "data")))
list
(dom "data" (var "data*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_elem" (exp (var "elem")))
list
(dom "elem" (var "elem*"))
)
)
)
)
(call
"free_opt"
(exp
(iter
(call "free_start" (exp (var "start")))
opt
(dom "start" (var "start?"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_import" (exp (var "import")))
list
(dom "import" (var "import*"))
)
)
)
)
(call
"free_list"
(exp
(iter
(call "free_export" (exp (var "export")))
list
(dom "export" (var "export*"))
)
)
)
)
)
)
(def
"funcidx_module"
(exp "module" (var "module"))
(iter (var "funcidx") list)
(clause
(exp "module" (var "module"))
(exp (var "module"))
(dot (call "free_module" (exp (var "module"))) "FUNCS")
)
)
(def
"dataidx_funcs"
(exp "_" (iter (var "func") list))
(iter (var "dataidx") list)
(clause
(exp "func*" (iter (var "func") list))
(exp (iter (var "func") list (dom "func" (var "func*"))))
(dot
(call
"free_list"
(exp
(iter
(call "free_func" (exp (var "func")))
list
(dom "func" (var "func*"))
)
)
)
"DATAS"
)
)
)
(typ "init" (inst (variant (case "SET" (tup)) (case "UNSET" (tup)))))
(typ
"localtype"
(inst
(variant
(case
"%%"
(exp "init" (var "init"))
(exp "valtype" (var "valtype"))
(tup
(bind (var "init") (var "init"))
(bind (var "valtype") (var "valtype"))
)
)
)
)
)
(typ
"instrtype"
(inst
(variant
(case
"%->_%%"
(exp "resulttype" (var "resulttype"))
(exp "localidx*" (iter (var "localidx") list))
(tup
(bind (var "resulttype") (var "resulttype"))
(bind
(iter (var "localidx") list (dom "localidx" (var "localidx*")))
(iter (var "localidx") list)
)
(bind (var "_") (var "resulttype"))
)
)
)
)
)
(typ
"context"
(inst
(struct
(field
"TYPES"
(exp "deftype*" (iter (var "deftype") list))
(iter (var "deftype") list)
)
(field
"RECS"
(exp "subtype*" (iter (var "subtype") list))
(iter (var "subtype") list)
)
(field
"TAGS"
(exp "tagtype*" (iter (var "tagtype") list))
(iter (var "tagtype") list)
)
(field
"GLOBALS"
(exp "globaltype*" (iter (var "globaltype") list))
(iter (var "globaltype") list)
)
(field
"MEMS"
(exp "memtype*" (iter (var "memtype") list))
(iter (var "memtype") list)
)
(field
"TABLES"
(exp "tabletype*" (iter (var "tabletype") list))
(iter (var "tabletype") list)
)
(field
"FUNCS"
(exp "deftype*" (iter (var "deftype") list))
(iter (var "deftype") list)
)
(field
"DATAS"
(exp "datatype*" (iter (var "datatype") list))
(iter (var "datatype") list)
)
(field
"ELEMS"
(exp "elemtype*" (iter (var "elemtype") list))
(iter (var "elemtype") list)
)
(field
"LOCALS"
(exp "localtype*" (iter (var "localtype") list))
(iter (var "localtype") list)
)
(field
"LABELS"
(exp "resulttype*" (iter (var "resulttype") list))
(iter (var "resulttype") list)
)
(field
"RETURN"
(exp "resulttype?" (iter (var "resulttype") opt))
(iter (var "resulttype") opt)
)
(field
"REFS"
(exp "funcidx*" (iter (var "funcidx") list))
(iter (var "funcidx") list)
)
)
)
)
(rec
(def
"with_locals"
(exp "context" (var "context"))
(exp "_" (iter (var "localidx") list))
(exp "_" (iter (var "localtype") list))
(var "context")
(clause
(exp "C" (var "context"))
(exp (var "C"))
(exp (list))
(exp (list))
(var "C")
)
(clause
(exp "C" (var "context"))
(exp "x_1" (var "idx"))
(exp "x*" (iter (var "idx") list))
(exp "lct_1" (var "localtype"))
(exp "lct*" (iter (var "localtype") list))
(exp (var "C"))
(exp (cat (list (var "x_1")) (iter (var "x") list (dom "x" (var "x*")))))
(exp
(cat
(list (var "lct_1"))
(iter (var "lct") list (dom "lct" (var "lct*")))
)
)
(call
"with_locals"
(exp
(upd
(var "C")
(idx (dot root "LOCALS") (proj (uncase (var "x_1") "%") 0))
(var "lct_1")
)
)
(exp (iter (var "x") list (dom "x" (var "x*"))))
(exp (iter (var "lct") list (dom "lct" (var "lct*"))))
)
)
)
)
(rec
(def
"clos_deftypes"
(exp "_" (iter (var "deftype") list))
(iter (var "deftype") list)
(clause (exp (list)) (list))
(clause
(exp "dt*" (iter (var "deftype") list))
(exp "dt_n" (var "deftype"))
(exp "dt'*" (iter (var "deftype") list))
(exp
(cat (iter (var "dt") list (dom "dt" (var "dt*"))) (list (var "dt_n")))
)
(cat
(iter (var "dt'") list (dom "dt'" (var "dt'*")))
(list
(call
"subst_all_deftype"
(exp (var "dt_n"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt'"))
list
(dom "dt'" (var "dt'*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "dt'") list (dom "dt'" (var "dt'*")))
(call
"clos_deftypes"
(exp (iter (var "dt") list (dom "dt" (var "dt*"))))
)
)
)
)
)
)
(def
"clos_valtype"
(exp "context" (var "context"))
(exp "valtype" (var "valtype"))
(var "valtype")
(clause
(exp "C" (var "context"))
(exp "t" (var "valtype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "C"))
(exp (var "t"))
(call
"subst_all_valtype"
(exp (var "t"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(call "clos_deftypes" (exp (dot (var "C") "TYPES")))
)
)
)
)
(def
"clos_deftype"
(exp "context" (var "context"))
(exp "deftype" (var "deftype"))
(var "deftype")
(clause
(exp "C" (var "context"))
(exp "dt" (var "deftype"))
(exp "dt'*" (iter (var "deftype") list))
(exp (var "C"))
(exp (var "dt"))
(call
"subst_all_deftype"
(exp (var "dt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt'"))
list
(dom "dt'" (var "dt'*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt'") list (dom "dt'" (var "dt'*")))
(call "clos_deftypes" (exp (dot (var "C") "TYPES")))
)
)
)
)
(def
"clos_tagtype"
(exp "context" (var "context"))
(exp "tagtype" (var "tagtype"))
(var "tagtype")
(clause
(exp "C" (var "context"))
(exp "jt" (var "tagtype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "C"))
(exp (var "jt"))
(call
"subst_all_tagtype"
(exp (var "jt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(call "clos_deftypes" (exp (dot (var "C") "TYPES")))
)
)
)
)
(def
"clos_externtype"
(exp "context" (var "context"))
(exp "externtype" (var "externtype"))
(var "externtype")
(clause
(exp "C" (var "context"))
(exp "xt" (var "externtype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "C"))
(exp (var "xt"))
(call
"subst_all_externtype"
(exp (var "xt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(call "clos_deftypes" (exp (dot (var "C") "TYPES")))
)
)
)
)
(def
"clos_moduletype"
(exp "context" (var "context"))
(exp "moduletype" (var "moduletype"))
(var "moduletype")
(clause
(exp "C" (var "context"))
(exp "mmt" (var "moduletype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "C"))
(exp (var "mmt"))
(call
"subst_all_moduletype"
(exp (var "mmt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(call "clos_deftypes" (exp (dot (var "C") "TYPES")))
)
)
)
)
(rel
"Numtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "numtype")))
(rule
""
(exp "C" (var "context"))
(exp "numtype" (var "numtype"))
"%|-%:OK"
(tup (var "C") (var "numtype"))
)
)
(rel
"Vectype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "vectype")))
(rule
""
(exp "C" (var "context"))
(exp "vectype" (var "vectype"))
"%|-%:OK"
(tup (var "C") (var "vectype"))
)
)
(typ
"oktypeidx"
(inst
(variant
(case
"OK%"
(exp "typeidx" (var "typeidx"))
(tup (bind (var "typeidx") (var "typeidx")))
)
)
)
)
(typ
"oktypeidxnat"
(inst
(variant
(case
"OK%%"
(exp "typeidx" (var "typeidx"))
(exp "nat" nat)
(tup (bind (var "typeidx") (var "typeidx")) (bind (var "nat") nat))
)
)
)
)
(rel
"Packtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "packtype")))
(rule
""
(exp "C" (var "context"))
(exp "packtype" (var "packtype"))
"%|-%:OK"
(tup (var "C") (var "packtype"))
)
)
(rel
"Packtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "packtype"))
(bind (var "_") (var "packtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "packtype" (var "packtype"))
"%|-%<:%"
(tup (var "C") (var "packtype") (var "packtype"))
)
)
(rel
"Numtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "numtype"))
(bind (var "_") (var "numtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "numtype" (var "numtype"))
"%|-%<:%"
(tup (var "C") (var "numtype") (var "numtype"))
)
)
(rel
"Expand"
"%~~%"
(tup (bind (var "_") (var "deftype")) (bind (var "_") (var "comptype")))
(rule
""
(exp "deftype" (var "deftype"))
(exp "comptype" (var "comptype"))
"%~~%"
(tup (var "deftype") (var "comptype"))
(if (cmp eq bool (call "expanddt" (exp (var "deftype"))) (var "comptype")))
)
)
(rel
"Vectype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "vectype"))
(bind (var "_") (var "vectype"))
)
(rule
""
(exp "C" (var "context"))
(exp "vectype" (var "vectype"))
"%|-%<:%"
(tup (var "C") (var "vectype") (var "vectype"))
)
)
(def
"before"
(exp "typeuse" (var "typeuse"))
(exp "typeidx" (var "typeidx"))
(exp "nat" nat)
bool
(clause
(exp "deftype" (var "deftype"))
(exp "x" (var "idx"))
(exp "i" nat)
(exp (sub (var "deftype") (var "typeuse") (var "deftype")))
(exp (var "x"))
(exp (var "i"))
(bool true)
)
(clause
(exp "typeidx" (var "typeidx"))
(exp "x" (var "idx"))
(exp "i" nat)
(exp (case "_IDX%" (tup (var "typeidx"))))
(exp (var "x"))
(exp (var "i"))
(cmp
lt
nat
(proj (uncase (var "typeidx") "%") 0)
(proj (uncase (var "x") "%") 0)
)
)
(clause
(exp "j" (var "n"))
(exp "x" (var "idx"))
(exp "i" nat)
(exp (case "REC%" (tup (var "j"))))
(exp (var "x"))
(exp (var "i"))
(cmp lt nat (var "j") (var "i"))
)
)
(def
"unrollht"
(exp "context" (var "context"))
(exp "heaptype" (var "heaptype"))
(var "subtype")
(clause
(exp "C" (var "context"))
(exp "deftype" (var "deftype"))
(exp (var "C"))
(exp (sub (var "deftype") (var "heaptype") (var "deftype")))
(call "unrolldt" (exp (var "deftype")))
)
(clause
(exp "C" (var "context"))
(exp "typeidx" (var "typeidx"))
(exp (var "C"))
(exp (case "_IDX%" (tup (var "typeidx"))))
(call
"unrolldt"
(exp (idx (dot (var "C") "TYPES") (proj (uncase (var "typeidx") "%") 0)))
)
)
(clause
(exp "C" (var "context"))
(exp "i" (var "n"))
(exp (var "C"))
(exp (case "REC%" (tup (var "i"))))
(idx (dot (var "C") "RECS") (var "i"))
)
)
(rec
(rel
"Heaptype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "heaptype")))
(rule
"abs"
(exp "C" (var "context"))
(exp "absheaptype" (var "absheaptype"))
"%|-%:OK"
(tup
(var "C")
(sub (var "absheaptype") (var "heaptype") (var "absheaptype"))
)
)
(rule
"typeuse"
(exp "C" (var "context"))
(exp "typeuse" (var "typeuse"))
"%|-%:OK"
(tup (var "C") (sub (var "typeuse") (var "heaptype") (var "typeuse")))
(rule "Typeuse_ok" "%|-%:OK" (tup (var "C") (var "typeuse")))
)
)
(rel
"Reftype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "reftype")))
(rule
""
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%:OK"
(tup
(var "C")
(case "REF%%" (tup (iter (case "NULL" (tup)) opt) (var "heaptype")))
)
(rule "Heaptype_ok" "%|-%:OK" (tup (var "C") (var "heaptype")))
)
)
(rel
"Valtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "valtype")))
(rule
"num"
(exp "C" (var "context"))
(exp "numtype" (var "numtype"))
"%|-%:OK"
(tup (var "C") (sub (var "numtype") (var "valtype") (var "numtype")))
(rule "Numtype_ok" "%|-%:OK" (tup (var "C") (var "numtype")))
)
(rule
"vec"
(exp "C" (var "context"))
(exp "vectype" (var "vectype"))
"%|-%:OK"
(tup (var "C") (sub (var "vectype") (var "valtype") (var "vectype")))
(rule "Vectype_ok" "%|-%:OK" (tup (var "C") (var "vectype")))
)
(rule
"ref"
(exp "C" (var "context"))
(exp "reftype" (var "reftype"))
"%|-%:OK"
(tup (var "C") (sub (var "reftype") (var "valtype") (var "reftype")))
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "reftype")))
)
(rule
"bot"
(exp "C" (var "context"))
"%|-%:OK"
(tup (var "C") (case "BOT" (tup)))
)
)
(rel
"Typeuse_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "typeuse")))
(rule
"typeidx"
(exp "C" (var "context"))
(exp "typeidx" (var "typeidx"))
(exp "dt" (var "deftype"))
"%|-%:OK"
(tup (var "C") (case "_IDX%" (tup (var "typeidx"))))
(if
(cmp
eq
bool
(idx (dot (var "C") "TYPES") (proj (uncase (var "typeidx") "%") 0))
(var "dt")
)
)
)
(rule
"rec"
(exp "C" (var "context"))
(exp "i" (var "n"))
(exp "st" (var "subtype"))
"%|-%:OK"
(tup (var "C") (case "REC%" (tup (var "i"))))
(if (cmp eq bool (idx (dot (var "C") "RECS") (var "i")) (var "st")))
)
(rule
"deftype"
(exp "C" (var "context"))
(exp "deftype" (var "deftype"))
"%|-%:OK"
(tup (var "C") (sub (var "deftype") (var "typeuse") (var "deftype")))
(rule "Deftype_ok" "%|-%:OK" (tup (var "C") (var "deftype")))
)
)
(rel
"Resulttype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "resulttype")))
(rule
""
(exp "C" (var "context"))
(exp "t*" (iter (var "valtype") list))
"%|-%:OK"
(tup
(var "C")
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
(iter
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "t")))
list
(dom "t" (var "t*"))
)
)
)
(rel
"Fieldtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "fieldtype")))
(rule
""
(exp "C" (var "context"))
(exp "storagetype" (var "storagetype"))
"%|-%:OK"
(tup
(var "C")
(case "%%" (tup (iter (case "MUT" (tup)) opt) (var "storagetype")))
)
(rule "Storagetype_ok" "%|-%:OK" (tup (var "C") (var "storagetype")))
)
)
(rel
"Storagetype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "storagetype")))
(rule
"val"
(exp "C" (var "context"))
(exp "valtype" (var "valtype"))
"%|-%:OK"
(tup (var "C") (sub (var "valtype") (var "storagetype") (var "valtype")))
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "valtype")))
)
(rule
"pack"
(exp "C" (var "context"))
(exp "packtype" (var "packtype"))
"%|-%:OK"
(tup
(var "C")
(sub (var "packtype") (var "storagetype") (var "packtype"))
)
(rule "Packtype_ok" "%|-%:OK" (tup (var "C") (var "packtype")))
)
)
(rel
"Comptype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "comptype")))
(rule
"struct"
(exp "C" (var "context"))
(exp "fieldtype*" (iter (var "fieldtype") list))
"%|-%:OK"
(tup
(var "C")
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(var "fieldtype")
list
(dom "fieldtype" (var "fieldtype*"))
)
)
)
)
)
)
(iter
(rule "Fieldtype_ok" "%|-%:OK" (tup (var "C") (var "fieldtype")))
list
(dom "fieldtype" (var "fieldtype*"))
)
)
(rule
"array"
(exp "C" (var "context"))
(exp "fieldtype" (var "fieldtype"))
"%|-%:OK"
(tup (var "C") (case "ARRAY%" (tup (var "fieldtype"))))
(rule "Fieldtype_ok" "%|-%:OK" (tup (var "C") (var "fieldtype")))
)
(rule
"func"
(exp "C" (var "context"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:OK"
(tup
(var "C")
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Resulttype_ok"
"%|-%:OK"
(tup
(var "C")
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
)
)
(rule
"Resulttype_ok"
"%|-%:OK"
(tup
(var "C")
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rel
"Subtype_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "subtype"))
(bind (var "_") (var "oktypeidx"))
)
(rule
""
(exp "C" (var "context"))
(exp "x*" (iter (var "idx") list))
(exp "comptype" (var "comptype"))
(exp "x_0" (var "idx"))
(exp "x'**" (iter (iter (var "idx") list) list))
(exp "comptype'*" (iter (var "comptype") list))
"%|-%:%"
(tup
(var "C")
(case
"SUB%%%"
(tup
(iter (case "FINAL" (tup)) opt)
(iter (case "_IDX%" (tup (var "x"))) list (dom "x" (var "x*")))
(var "comptype")
)
)
(case "OK%" (tup (var "x_0")))
)
(if
(cmp
le
nat
(len (iter (var "x") list (dom "x" (var "x*"))))
(num (nat 1))
)
)
(iter
(if
(cmp
lt
nat
(proj (uncase (var "x") "%") 0)
(proj (uncase (var "x_0") "%") 0)
)
)
list
(dom "x" (var "x*"))
)
(iter
(if
(cmp
eq
bool
(call
"unrolldt"
(exp
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
)
)
(case
"SUB%%%"
(tup
(opt)
(iter
(case "_IDX%" (tup (var "x'")))
list
(dom "x'" (var "x'*"))
)
(var "comptype'")
)
)
)
)
list
(dom "comptype'" (var "comptype'*"))
(dom "x" (var "x*"))
(dom "x'*" (var "x'**"))
)
(rule "Comptype_ok" "%|-%:OK" (tup (var "C") (var "comptype")))
(iter
(rule
"Comptype_sub"
"%|-%<:%"
(tup (var "C") (var "comptype") (var "comptype'"))
)
list
(dom "comptype'" (var "comptype'*"))
)
)
)
(rel
"Rectype_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "rectype"))
(bind (var "_") (var "oktypeidx"))
)
(rule
"empty"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%:%"
(tup
(var "C")
(case "REC%" (tup (case "%" (tup (list)))))
(case "OK%" (tup (var "x")))
)
)
(rule
"cons"
(exp "C" (var "context"))
(exp "subtype_1" (var "subtype"))
(exp "subtype*" (iter (var "subtype") list))
(exp "x" (var "idx"))
"%|-%:%"
(tup
(var "C")
(case
"REC%"
(tup
(case
"%"
(tup
(cat
(list (var "subtype_1"))
(iter (var "subtype") list (dom "subtype" (var "subtype*")))
)
)
)
)
)
(case "OK%" (tup (var "x")))
)
(rule
"Subtype_ok"
"%|-%:%"
(tup (var "C") (var "subtype_1") (case "OK%" (tup (var "x"))))
)
(rule
"Rectype_ok"
"%|-%:%"
(tup
(var "C")
(case
"REC%"
(tup
(case
"%"
(tup
(iter (var "subtype") list (dom "subtype" (var "subtype*")))
)
)
)
)
(case
"OK%"
(tup
(case
"%"
(tup
(bin add nat (proj (uncase (var "x") "%") 0) (num (nat 1)))
)
)
)
)
)
)
)
(rule
"_rec2"
(exp "C" (var "context"))
(exp "subtype*" (iter (var "subtype") list))
(exp "x" (var "idx"))
"%|-%:%"
(tup
(var "C")
(case
"REC%"
(tup
(case
"%"
(tup (iter (var "subtype") list (dom "subtype" (var "subtype*"))))
)
)
)
(case "OK%" (tup (var "x")))
)
(rule
"Rectype_ok2"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field
"RECS"
(iter (var "subtype") list (dom "subtype" (var "subtype*")))
)
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(case
"REC%"
(tup
(case
"%"
(tup
(iter (var "subtype") list (dom "subtype" (var "subtype*")))
)
)
)
)
(case "OK%%" (tup (var "x") (num (nat 0))))
)
)
)
)
(rel
"Subtype_ok2"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "subtype"))
(bind (var "_") (var "oktypeidxnat"))
)
(rule
""
(exp "C" (var "context"))
(exp "typeuse*" (iter (var "typeuse") list))
(exp "compttype" (var "comptype"))
(exp "x" (var "idx"))
(exp "i" nat)
(exp "typeuse'**" (iter (iter (var "typeuse") list) list))
(exp "comptype'*" (iter (var "comptype") list))
(exp "comptype" (var "comptype"))
"%|-%:%"
(tup
(var "C")
(case
"SUB%%%"
(tup
(iter (case "FINAL" (tup)) opt)
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "compttype")
)
)
(case "OK%%" (tup (var "x") (var "i")))
)
(if
(cmp
le
nat
(len (iter (var "typeuse") list (dom "typeuse" (var "typeuse*"))))
(num (nat 1))
)
)
(iter
(if
(call "before" (exp (var "typeuse")) (exp (var "x")) (exp (var "i")))
)
list
(dom "typeuse" (var "typeuse*"))
)
(iter
(if
(cmp
eq
bool
(call
"unrollht"
(exp (var "C"))
(exp (sub (var "typeuse") (var "heaptype") (var "typeuse")))
)
(case
"SUB%%%"
(tup
(opt)
(iter (var "typeuse'") list (dom "typeuse'" (var "typeuse'*")))
(var "comptype'")
)
)
)
)
list
(dom "comptype'" (var "comptype'*"))
(dom "typeuse" (var "typeuse*"))
(dom "typeuse'*" (var "typeuse'**"))
)
(rule "Comptype_ok" "%|-%:OK" (tup (var "C") (var "comptype")))
(iter
(rule
"Comptype_sub"
"%|-%<:%"
(tup (var "C") (var "comptype") (var "comptype'"))
)
list
(dom "comptype'" (var "comptype'*"))
)
)
)
(rel
"Rectype_ok2"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "rectype"))
(bind (var "_") (var "oktypeidxnat"))
)
(rule
"empty"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "i" nat)
"%|-%:%"
(tup
(var "C")
(case "REC%" (tup (case "%" (tup (list)))))
(case "OK%%" (tup (var "x") (var "i")))
)
)
(rule
"cons"
(exp "C" (var "context"))
(exp "subtype_1" (var "subtype"))
(exp "subtype*" (iter (var "subtype") list))
(exp "x" (var "idx"))
(exp "i" nat)
"%|-%:%"
(tup
(var "C")
(case
"REC%"
(tup
(case
"%"
(tup
(cat
(list (var "subtype_1"))
(iter (var "subtype") list (dom "subtype" (var "subtype*")))
)
)
)
)
)
(case "OK%%" (tup (var "x") (var "i")))
)
(rule
"Subtype_ok2"
"%|-%:%"
(tup
(var "C")
(var "subtype_1")
(case "OK%%" (tup (var "x") (var "i")))
)
)
(rule
"Rectype_ok2"
"%|-%:%"
(tup
(var "C")
(case
"REC%"
(tup
(case
"%"
(tup
(iter (var "subtype") list (dom "subtype" (var "subtype*")))
)
)
)
)
(case
"OK%%"
(tup
(case
"%"
(tup
(bin add nat (proj (uncase (var "x") "%") 0) (num (nat 1)))
)
)
(bin add nat (var "i") (num (nat 1)))
)
)
)
)
)
)
(rel
"Deftype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "deftype")))
(rule
""
(exp "C" (var "context"))
(exp "rectype" (var "rectype"))
(exp "i" (var "n"))
(exp "x" (var "idx"))
(exp "subtype*" (iter (var "subtype") list))
(exp "n" (var "n"))
"%|-%:OK"
(tup (var "C") (case "_DEF%%" (tup (var "rectype") (var "i"))))
(rule
"Rectype_ok"
"%|-%:%"
(tup (var "C") (var "rectype") (case "OK%" (tup (var "x"))))
)
(if
(cmp
eq
bool
(var "rectype")
(case
"REC%"
(tup
(case
"%"
(tup
(iter
(var "subtype")
(listn (var "n"))
(dom "subtype" (var "subtype*"))
)
)
)
)
)
)
)
(if (cmp lt nat (var "i") (var "n")))
)
)
(rel
"Comptype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "comptype"))
(bind (var "_") (var "comptype"))
)
(rule
"struct"
(exp "C" (var "context"))
(exp "ft_1*" (iter (var "fieldtype") list))
(exp "ft'_1*" (iter (var "fieldtype") list))
(exp "ft_2*" (iter (var "fieldtype") list))
"%|-%<:%"
(tup
(var "C")
(case
"STRUCT%"
(tup
(case
"%"
(tup
(cat
(iter (var "ft_1") list (dom "ft_1" (var "ft_1*")))
(iter (var "ft'_1") list (dom "ft'_1" (var "ft'_1*")))
)
)
)
)
)
(case
"STRUCT%"
(tup
(case "%" (tup (iter (var "ft_2") list (dom "ft_2" (var "ft_2*")))))
)
)
)
(iter
(rule
"Fieldtype_sub"
"%|-%<:%"
(tup (var "C") (var "ft_1") (var "ft_2"))
)
list
(dom "ft_1" (var "ft_1*"))
(dom "ft_2" (var "ft_2*"))
)
)
(rule
"array"
(exp "C" (var "context"))
(exp "ft_1" (var "fieldtype"))
(exp "ft_2" (var "fieldtype"))
"%|-%<:%"
(tup
(var "C")
(case "ARRAY%" (tup (var "ft_1")))
(case "ARRAY%" (tup (var "ft_2")))
)
(rule "Fieldtype_sub" "%|-%<:%" (tup (var "C") (var "ft_1") (var "ft_2")))
)
(rule
"func"
(exp "C" (var "context"))
(exp "t_11*" (iter (var "valtype") list))
(exp "t_12*" (iter (var "valtype") list))
(exp "t_21*" (iter (var "valtype") list))
(exp "t_22*" (iter (var "valtype") list))
"%|-%<:%"
(tup
(var "C")
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_11") list (dom "t_11" (var "t_11*")))))
(case "%" (tup (iter (var "t_12") list (dom "t_12" (var "t_12*")))))
)
)
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_21") list (dom "t_21" (var "t_21*")))))
(case "%" (tup (iter (var "t_22") list (dom "t_22" (var "t_22*")))))
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_21") list (dom "t_21" (var "t_21*")))))
(case "%" (tup (iter (var "t_11") list (dom "t_11" (var "t_11*")))))
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_12") list (dom "t_12" (var "t_12*")))))
(case "%" (tup (iter (var "t_22") list (dom "t_22" (var "t_22*")))))
)
)
)
)
(rel
"Deftype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "deftype"))
(bind (var "_") (var "deftype"))
)
(rule
"refl"
(exp "C" (var "context"))
(exp "deftype_1" (var "deftype"))
(exp "deftype_2" (var "deftype"))
"%|-%<:%"
(tup (var "C") (var "deftype_1") (var "deftype_2"))
(if
(cmp
eq
bool
(call "clos_deftype" (exp (var "C")) (exp (var "deftype_1")))
(call "clos_deftype" (exp (var "C")) (exp (var "deftype_2")))
)
)
)
(rule
"super"
(exp "C" (var "context"))
(exp "deftype_1" (var "deftype"))
(exp "deftype_2" (var "deftype"))
(exp "final?" (iter (var "final") opt))
(exp "typeuse*" (iter (var "typeuse") list))
(exp "ct" (var "comptype"))
(exp "i" nat)
"%|-%<:%"
(tup (var "C") (var "deftype_1") (var "deftype_2"))
(if
(cmp
eq
bool
(call "unrolldt" (exp (var "deftype_1")))
(case
"SUB%%%"
(tup
(iter (var "final") opt (dom "final" (var "final?")))
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "ct")
)
)
)
)
(rule
"Heaptype_sub"
"%|-%<:%"
(tup
(var "C")
(sub
(var "typeuse")
(var "heaptype")
(idx
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "i")
)
)
(sub (var "deftype") (var "heaptype") (var "deftype_2"))
)
)
)
)
(rel
"Heaptype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "heaptype"))
(bind (var "_") (var "heaptype"))
)
(rule
"refl"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (var "heaptype") (var "heaptype"))
)
(rule
"trans"
(exp "C" (var "context"))
(exp "heaptype_1" (var "heaptype"))
(exp "heaptype_2" (var "heaptype"))
(exp "heaptype'" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (var "heaptype_1") (var "heaptype_2"))
(rule "Heaptype_ok" "%|-%:OK" (tup (var "C") (var "heaptype'")))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup (var "C") (var "heaptype_1") (var "heaptype'"))
)
(rule
"Heaptype_sub"
"%|-%<:%"
(tup (var "C") (var "heaptype'") (var "heaptype_2"))
)
)
(rule
"eq-any"
(exp "C" (var "context"))
"%|-%<:%"
(tup (var "C") (case "EQ" (tup)) (case "ANY" (tup)))
)
(rule
"i31-eq"
(exp "C" (var "context"))
"%|-%<:%"
(tup (var "C") (case "I31" (tup)) (case "EQ" (tup)))
)
(rule
"struct-eq"
(exp "C" (var "context"))
"%|-%<:%"
(tup (var "C") (case "STRUCT" (tup)) (case "EQ" (tup)))
)
(rule
"array-eq"
(exp "C" (var "context"))
"%|-%<:%"
(tup (var "C") (case "ARRAY" (tup)) (case "EQ" (tup)))
)
(rule
"struct"
(exp "C" (var "context"))
(exp "deftype" (var "deftype"))
(exp "fieldtype*" (iter (var "fieldtype") list))
"%|-%<:%"
(tup
(var "C")
(sub (var "deftype") (var "heaptype") (var "deftype"))
(case "STRUCT" (tup))
)
(rule
"Expand"
"%~~%"
(tup
(var "deftype")
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(var "fieldtype")
list
(dom "fieldtype" (var "fieldtype*"))
)
)
)
)
)
)
)
)
(rule
"array"
(exp "C" (var "context"))
(exp "deftype" (var "deftype"))
(exp "fieldtype" (var "fieldtype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "deftype") (var "heaptype") (var "deftype"))
(case "ARRAY" (tup))
)
(rule
"Expand"
"%~~%"
(tup (var "deftype") (case "ARRAY%" (tup (var "fieldtype"))))
)
)
(rule
"func"
(exp "C" (var "context"))
(exp "deftype" (var "deftype"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%<:%"
(tup
(var "C")
(sub (var "deftype") (var "heaptype") (var "deftype"))
(case "FUNC" (tup))
)
(rule
"Expand"
"%~~%"
(tup
(var "deftype")
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"def"
(exp "C" (var "context"))
(exp "deftype_1" (var "deftype"))
(exp "deftype_2" (var "deftype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "deftype") (var "heaptype") (var "deftype_1"))
(sub (var "deftype") (var "heaptype") (var "deftype_2"))
)
(rule
"Deftype_sub"
"%|-%<:%"
(tup (var "C") (var "deftype_1") (var "deftype_2"))
)
)
(rule
"typeidx-l"
(exp "C" (var "context"))
(exp "typeidx" (var "typeidx"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (case "_IDX%" (tup (var "typeidx"))) (var "heaptype"))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup
(var "C")
(sub
(var "deftype")
(var "heaptype")
(idx (dot (var "C") "TYPES") (proj (uncase (var "typeidx") "%") 0))
)
(var "heaptype")
)
)
)
(rule
"typeidx-r"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
(exp "typeidx" (var "typeidx"))
"%|-%<:%"
(tup (var "C") (var "heaptype") (case "_IDX%" (tup (var "typeidx"))))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup
(var "C")
(var "heaptype")
(sub
(var "deftype")
(var "heaptype")
(idx (dot (var "C") "TYPES") (proj (uncase (var "typeidx") "%") 0))
)
)
)
)
(rule
"rec"
(exp "C" (var "context"))
(exp "i" (var "n"))
(exp "typeuse*" (iter (var "typeuse") list))
(exp "j" nat)
(exp "final?" (iter (var "final") opt))
(exp "ct" (var "comptype"))
"%|-%<:%"
(tup
(var "C")
(case "REC%" (tup (var "i")))
(sub
(var "typeuse")
(var "heaptype")
(idx
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "j")
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "RECS") (var "i"))
(case
"SUB%%%"
(tup
(iter (var "final") opt (dom "final" (var "final?")))
(iter (var "typeuse") list (dom "typeuse" (var "typeuse*")))
(var "ct")
)
)
)
)
)
(rule
"none"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (case "NONE" (tup)) (var "heaptype"))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup (var "C") (var "heaptype") (case "ANY" (tup)))
)
)
(rule
"nofunc"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (case "NOFUNC" (tup)) (var "heaptype"))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup (var "C") (var "heaptype") (case "FUNC" (tup)))
)
)
(rule
"noexn"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (case "NOEXN" (tup)) (var "heaptype"))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup (var "C") (var "heaptype") (case "EXN" (tup)))
)
)
(rule
"noextern"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (case "NOEXTERN" (tup)) (var "heaptype"))
(rule
"Heaptype_sub"
"%|-%<:%"
(tup (var "C") (var "heaptype") (case "EXTERN" (tup)))
)
)
(rule
"bot"
(exp "C" (var "context"))
(exp "heaptype" (var "heaptype"))
"%|-%<:%"
(tup (var "C") (case "BOT" (tup)) (var "heaptype"))
)
)
(rel
"Reftype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "reftype"))
(bind (var "_") (var "reftype"))
)
(rule
"nonnull"
(exp "C" (var "context"))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
"%|-%<:%"
(tup
(var "C")
(case "REF%%" (tup (opt) (var "ht_1")))
(case "REF%%" (tup (opt) (var "ht_2")))
)
(rule "Heaptype_sub" "%|-%<:%" (tup (var "C") (var "ht_1") (var "ht_2")))
)
(rule
"null"
(exp "C" (var "context"))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
"%|-%<:%"
(tup
(var "C")
(case "REF%%" (tup (iter (case "NULL" (tup)) opt) (var "ht_1")))
(case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht_2")))
)
(rule "Heaptype_sub" "%|-%<:%" (tup (var "C") (var "ht_1") (var "ht_2")))
)
)
(rel
"Valtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "valtype"))
(bind (var "_") (var "valtype"))
)
(rule
"num"
(exp "C" (var "context"))
(exp "numtype_1" (var "numtype"))
(exp "numtype_2" (var "numtype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "numtype") (var "valtype") (var "numtype_1"))
(sub (var "numtype") (var "valtype") (var "numtype_2"))
)
(rule
"Numtype_sub"
"%|-%<:%"
(tup (var "C") (var "numtype_1") (var "numtype_2"))
)
)
(rule
"vec"
(exp "C" (var "context"))
(exp "vectype_1" (var "vectype"))
(exp "vectype_2" (var "vectype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "vectype") (var "valtype") (var "vectype_1"))
(sub (var "vectype") (var "valtype") (var "vectype_2"))
)
(rule
"Vectype_sub"
"%|-%<:%"
(tup (var "C") (var "vectype_1") (var "vectype_2"))
)
)
(rule
"ref"
(exp "C" (var "context"))
(exp "reftype_1" (var "reftype"))
(exp "reftype_2" (var "reftype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "reftype") (var "valtype") (var "reftype_1"))
(sub (var "reftype") (var "valtype") (var "reftype_2"))
)
(rule
"Reftype_sub"
"%|-%<:%"
(tup (var "C") (var "reftype_1") (var "reftype_2"))
)
)
(rule
"bot"
(exp "C" (var "context"))
(exp "valtype" (var "valtype"))
"%|-%<:%"
(tup (var "C") (case "BOT" (tup)) (var "valtype"))
)
)
(rel
"Resulttype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "resulttype"))
(bind (var "_") (var "resulttype"))
)
(rule
""
(exp "C" (var "context"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
(iter
(rule "Valtype_sub" "%|-%<:%" (tup (var "C") (var "t_1") (var "t_2")))
list
(dom "t_1" (var "t_1*"))
(dom "t_2" (var "t_2*"))
)
)
)
(rel
"Storagetype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "storagetype"))
(bind (var "_") (var "storagetype"))
)
(rule
"val"
(exp "C" (var "context"))
(exp "valtype_1" (var "valtype"))
(exp "valtype_2" (var "valtype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "valtype") (var "storagetype") (var "valtype_1"))
(sub (var "valtype") (var "storagetype") (var "valtype_2"))
)
(rule
"Valtype_sub"
"%|-%<:%"
(tup (var "C") (var "valtype_1") (var "valtype_2"))
)
)
(rule
"pack"
(exp "C" (var "context"))
(exp "packtype_1" (var "packtype"))
(exp "packtype_2" (var "packtype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "packtype") (var "storagetype") (var "packtype_1"))
(sub (var "packtype") (var "storagetype") (var "packtype_2"))
)
(rule
"Packtype_sub"
"%|-%<:%"
(tup (var "C") (var "packtype_1") (var "packtype_2"))
)
)
)
(rel
"Fieldtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "fieldtype"))
(bind (var "_") (var "fieldtype"))
)
(rule
"const"
(exp "C" (var "context"))
(exp "zt_1" (var "storagetype"))
(exp "zt_2" (var "storagetype"))
"%|-%<:%"
(tup
(var "C")
(case "%%" (tup (opt) (var "zt_1")))
(case "%%" (tup (opt) (var "zt_2")))
)
(rule
"Storagetype_sub"
"%|-%<:%"
(tup (var "C") (var "zt_1") (var "zt_2"))
)
)
(rule
"var"
(exp "C" (var "context"))
(exp "zt_1" (var "storagetype"))
(exp "zt_2" (var "storagetype"))
"%|-%<:%"
(tup
(var "C")
(case "%%" (tup (opt (case "MUT" (tup))) (var "zt_1")))
(case "%%" (tup (opt (case "MUT" (tup))) (var "zt_2")))
)
(rule
"Storagetype_sub"
"%|-%<:%"
(tup (var "C") (var "zt_1") (var "zt_2"))
)
(rule
"Storagetype_sub"
"%|-%<:%"
(tup (var "C") (var "zt_2") (var "zt_1"))
)
)
)
)
(rel
"Instrtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "instrtype")))
(rule
""
(exp "C" (var "context"))
(exp "t_1*" (iter (var "valtype") list))
(exp "x*" (iter (var "idx") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "lct*" (iter (var "localtype") list))
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x") list (dom "x" (var "x*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Resulttype_ok"
"%|-%:OK"
(tup
(var "C")
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
)
)
(rule
"Resulttype_ok"
"%|-%:OK"
(tup
(var "C")
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
(iter
(if
(cmp
eq
bool
(idx (dot (var "C") "LOCALS") (proj (uncase (var "x") "%") 0))
(var "lct")
)
)
list
(dom "lct" (var "lct*"))
(dom "x" (var "x*"))
)
)
)
(rel
"Expand_use"
"%~~_%%"
(tup
(bind (var "_") (var "typeuse"))
(bind (var "_") (var "context"))
(bind (var "_") (var "comptype"))
)
(rule
"deftype"
(exp "deftype" (var "deftype"))
(exp "C" (var "context"))
(exp "comptype" (var "comptype"))
"%~~_%%"
(tup
(sub (var "deftype") (var "typeuse") (var "deftype"))
(var "C")
(var "comptype")
)
(rule "Expand" "%~~%" (tup (var "deftype") (var "comptype")))
)
(rule
"typeidx"
(exp "typeidx" (var "typeidx"))
(exp "C" (var "context"))
(exp "comptype" (var "comptype"))
"%~~_%%"
(tup (case "_IDX%" (tup (var "typeidx"))) (var "C") (var "comptype"))
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "typeidx") "%") 0))
(var "comptype")
)
)
)
)
(rel
"Limits_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "limits"))
(bind (var "_") nat)
)
(rule
""
(exp "C" (var "context"))
(exp "n" (var "n"))
(exp "m?" (iter (var "m") opt))
(exp "k" nat)
"%|-%:%"
(tup
(var "C")
(case
"[%..%]"
(tup
(case "%" (tup (var "n")))
(iter (case "%" (tup (var "m"))) opt (dom "m" (var "m?")))
)
)
(var "k")
)
(if (cmp le nat (var "n") (var "k")))
(iter
(if
(bin
and
bool
(cmp le nat (var "n") (var "m"))
(cmp le nat (var "m") (var "k"))
)
)
opt
(dom "m" (var "m?"))
)
)
)
(rel
"Tagtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "tagtype")))
(rule
""
(exp "C" (var "context"))
(exp "typeuse" (var "typeuse"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:OK"
(tup (var "C") (var "typeuse"))
(rule "Typeuse_ok" "%|-%:OK" (tup (var "C") (var "typeuse")))
(rule
"Expand_use"
"%~~_%%"
(tup
(var "typeuse")
(var "C")
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
)
(rel
"Globaltype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "globaltype")))
(rule
""
(exp "C" (var "context"))
(exp "t" (var "valtype"))
"%|-%:OK"
(tup (var "C") (case "%%" (tup (iter (case "MUT" (tup)) opt) (var "t"))))
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "t")))
)
)
(rel
"Memtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "memtype")))
(rule
""
(exp "C" (var "context"))
(exp "addrtype" (var "addrtype"))
(exp "limits" (var "limits"))
"%|-%:OK"
(tup (var "C") (case "%%PAGE" (tup (var "addrtype") (var "limits"))))
(rule
"Limits_ok"
"%|-%:%"
(tup (var "C") (var "limits") (bin pow nat (num (nat 2)) (num (nat 16))))
)
)
)
(rel
"Tabletype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "tabletype")))
(rule
""
(exp "C" (var "context"))
(exp "addrtype" (var "addrtype"))
(exp "limits" (var "limits"))
(exp "reftype" (var "reftype"))
"%|-%:OK"
(tup
(var "C")
(case "%%%" (tup (var "addrtype") (var "limits") (var "reftype")))
)
(rule
"Limits_ok"
"%|-%:%"
(tup
(var "C")
(var "limits")
(cvt
int
nat
(bin
sub
int
(cvt nat int (bin pow nat (num (nat 2)) (num (nat 32))))
(cvt nat int (num (nat 1)))
)
)
)
)
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "reftype")))
)
)
(rel
"Externtype_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "externtype")))
(rule
"tag"
(exp "C" (var "context"))
(exp "tagtype" (var "tagtype"))
"%|-%:OK"
(tup (var "C") (case "TAG%" (tup (var "tagtype"))))
(rule "Tagtype_ok" "%|-%:OK" (tup (var "C") (var "tagtype")))
)
(rule
"global"
(exp "C" (var "context"))
(exp "globaltype" (var "globaltype"))
"%|-%:OK"
(tup (var "C") (case "GLOBAL%" (tup (var "globaltype"))))
(rule "Globaltype_ok" "%|-%:OK" (tup (var "C") (var "globaltype")))
)
(rule
"mem"
(exp "C" (var "context"))
(exp "memtype" (var "memtype"))
"%|-%:OK"
(tup (var "C") (case "MEM%" (tup (var "memtype"))))
(rule "Memtype_ok" "%|-%:OK" (tup (var "C") (var "memtype")))
)
(rule
"table"
(exp "C" (var "context"))
(exp "tabletype" (var "tabletype"))
"%|-%:OK"
(tup (var "C") (case "TABLE%" (tup (var "tabletype"))))
(rule "Tabletype_ok" "%|-%:OK" (tup (var "C") (var "tabletype")))
)
(rule
"func"
(exp "C" (var "context"))
(exp "typeuse" (var "typeuse"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:OK"
(tup (var "C") (case "FUNC%" (tup (var "typeuse"))))
(rule "Typeuse_ok" "%|-%:OK" (tup (var "C") (var "typeuse")))
(rule
"Expand_use"
"%~~_%%"
(tup
(var "typeuse")
(var "C")
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
)
(rel
"Instrtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "instrtype"))
(bind (var "_") (var "instrtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "t_11*" (iter (var "valtype") list))
(exp "x_1*" (iter (var "idx") list))
(exp "t_12*" (iter (var "valtype") list))
(exp "t_21*" (iter (var "valtype") list))
(exp "x_2*" (iter (var "idx") list))
(exp "t_22*" (iter (var "valtype") list))
(exp "x*" (iter (var "idx") list))
(exp "t*" (iter (var "valtype") list))
"%|-%<:%"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_11") list (dom "t_11" (var "t_11*")))))
(iter (var "x_1") list (dom "x_1" (var "x_1*")))
(case "%" (tup (iter (var "t_12") list (dom "t_12" (var "t_12*")))))
)
)
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_21") list (dom "t_21" (var "t_21*")))))
(iter (var "x_2") list (dom "x_2" (var "x_2*")))
(case "%" (tup (iter (var "t_22") list (dom "t_22" (var "t_22*")))))
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_21") list (dom "t_21" (var "t_21*")))))
(case "%" (tup (iter (var "t_11") list (dom "t_11" (var "t_11*")))))
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_12") list (dom "t_12" (var "t_12*")))))
(case "%" (tup (iter (var "t_22") list (dom "t_22" (var "t_22*")))))
)
)
(if
(cmp
eq
bool
(iter (var "x") list (dom "x" (var "x*")))
(call
"setminus_"
(typ (var "localidx"))
(exp (iter (var "x_2") list (dom "x_2" (var "x_2*"))))
(exp (iter (var "x_1") list (dom "x_1" (var "x_1*"))))
)
)
)
(iter
(if
(cmp
eq
bool
(idx (dot (var "C") "LOCALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (case "SET" (tup)) (var "t")))
)
)
list
(dom "t" (var "t*"))
(dom "x" (var "x*"))
)
)
)
(rel
"Limits_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "limits"))
(bind (var "_") (var "limits"))
)
(rule
"max"
(exp "C" (var "context"))
(exp "n_1" (var "n"))
(exp "m_1" (var "m"))
(exp "n_2" (var "n"))
(exp "m_2?" (iter (var "m") opt))
"%|-%<:%"
(tup
(var "C")
(case
"[%..%]"
(tup (case "%" (tup (var "n_1"))) (opt (case "%" (tup (var "m_1")))))
)
(case
"[%..%]"
(tup
(case "%" (tup (var "n_2")))
(iter (case "%" (tup (var "m_2"))) opt (dom "m_2" (var "m_2?")))
)
)
)
(if (cmp ge nat (var "n_1") (var "n_2")))
(iter
(if (cmp le nat (var "m_1") (var "m_2")))
opt
(dom "m_2" (var "m_2?"))
)
)
(rule
"eps"
(exp "C" (var "context"))
(exp "n_1" (var "n"))
(exp "n_2" (var "n"))
"%|-%<:%"
(tup
(var "C")
(case "[%..%]" (tup (case "%" (tup (var "n_1"))) (opt)))
(case "[%..%]" (tup (case "%" (tup (var "n_2"))) (opt)))
)
(if (cmp ge nat (var "n_1") (var "n_2")))
)
)
(rel
"Tagtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "tagtype"))
(bind (var "_") (var "tagtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "deftype_1" (var "deftype"))
(exp "deftype_2" (var "deftype"))
"%|-%<:%"
(tup
(var "C")
(sub (var "deftype") (var "typeuse") (var "deftype_1"))
(sub (var "deftype") (var "typeuse") (var "deftype_2"))
)
(rule
"Deftype_sub"
"%|-%<:%"
(tup (var "C") (var "deftype_1") (var "deftype_2"))
)
(rule
"Deftype_sub"
"%|-%<:%"
(tup (var "C") (var "deftype_2") (var "deftype_1"))
)
)
)
(rel
"Globaltype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "globaltype"))
(bind (var "_") (var "globaltype"))
)
(rule
"const"
(exp "C" (var "context"))
(exp "valtype_1" (var "valtype"))
(exp "valtype_2" (var "valtype"))
"%|-%<:%"
(tup
(var "C")
(case "%%" (tup (opt) (var "valtype_1")))
(case "%%" (tup (opt) (var "valtype_2")))
)
(rule
"Valtype_sub"
"%|-%<:%"
(tup (var "C") (var "valtype_1") (var "valtype_2"))
)
)
(rule
"var"
(exp "C" (var "context"))
(exp "valtype_1" (var "valtype"))
(exp "valtype_2" (var "valtype"))
"%|-%<:%"
(tup
(var "C")
(case "%%" (tup (opt (case "MUT" (tup))) (var "valtype_1")))
(case "%%" (tup (opt (case "MUT" (tup))) (var "valtype_2")))
)
(rule
"Valtype_sub"
"%|-%<:%"
(tup (var "C") (var "valtype_1") (var "valtype_2"))
)
(rule
"Valtype_sub"
"%|-%<:%"
(tup (var "C") (var "valtype_2") (var "valtype_1"))
)
)
)
(rel
"Memtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "memtype"))
(bind (var "_") (var "memtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "addrtype" (var "addrtype"))
(exp "limits_1" (var "limits"))
(exp "limits_2" (var "limits"))
"%|-%<:%"
(tup
(var "C")
(case "%%PAGE" (tup (var "addrtype") (var "limits_1")))
(case "%%PAGE" (tup (var "addrtype") (var "limits_2")))
)
(rule
"Limits_sub"
"%|-%<:%"
(tup (var "C") (var "limits_1") (var "limits_2"))
)
)
)
(rel
"Tabletype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "tabletype"))
(bind (var "_") (var "tabletype"))
)
(rule
""
(exp "C" (var "context"))
(exp "addrtype" (var "addrtype"))
(exp "limits_1" (var "limits"))
(exp "reftype_1" (var "reftype"))
(exp "limits_2" (var "limits"))
(exp "reftype_2" (var "reftype"))
"%|-%<:%"
(tup
(var "C")
(case "%%%" (tup (var "addrtype") (var "limits_1") (var "reftype_1")))
(case "%%%" (tup (var "addrtype") (var "limits_2") (var "reftype_2")))
)
(rule
"Limits_sub"
"%|-%<:%"
(tup (var "C") (var "limits_1") (var "limits_2"))
)
(rule
"Reftype_sub"
"%|-%<:%"
(tup (var "C") (var "reftype_1") (var "reftype_2"))
)
(rule
"Reftype_sub"
"%|-%<:%"
(tup (var "C") (var "reftype_2") (var "reftype_1"))
)
)
)
(rel
"Externtype_sub"
"%|-%<:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "externtype"))
(bind (var "_") (var "externtype"))
)
(rule
"tag"
(exp "C" (var "context"))
(exp "tagtype_1" (var "tagtype"))
(exp "tagtype_2" (var "tagtype"))
"%|-%<:%"
(tup
(var "C")
(case "TAG%" (tup (var "tagtype_1")))
(case "TAG%" (tup (var "tagtype_2")))
)
(rule
"Tagtype_sub"
"%|-%<:%"
(tup (var "C") (var "tagtype_1") (var "tagtype_2"))
)
)
(rule
"global"
(exp "C" (var "context"))
(exp "globaltype_1" (var "globaltype"))
(exp "globaltype_2" (var "globaltype"))
"%|-%<:%"
(tup
(var "C")
(case "GLOBAL%" (tup (var "globaltype_1")))
(case "GLOBAL%" (tup (var "globaltype_2")))
)
(rule
"Globaltype_sub"
"%|-%<:%"
(tup (var "C") (var "globaltype_1") (var "globaltype_2"))
)
)
(rule
"mem"
(exp "C" (var "context"))
(exp "memtype_1" (var "memtype"))
(exp "memtype_2" (var "memtype"))
"%|-%<:%"
(tup
(var "C")
(case "MEM%" (tup (var "memtype_1")))
(case "MEM%" (tup (var "memtype_2")))
)
(rule
"Memtype_sub"
"%|-%<:%"
(tup (var "C") (var "memtype_1") (var "memtype_2"))
)
)
(rule
"table"
(exp "C" (var "context"))
(exp "tabletype_1" (var "tabletype"))
(exp "tabletype_2" (var "tabletype"))
"%|-%<:%"
(tup
(var "C")
(case "TABLE%" (tup (var "tabletype_1")))
(case "TABLE%" (tup (var "tabletype_2")))
)
(rule
"Tabletype_sub"
"%|-%<:%"
(tup (var "C") (var "tabletype_1") (var "tabletype_2"))
)
)
(rule
"func"
(exp "C" (var "context"))
(exp "deftype_1" (var "deftype"))
(exp "deftype_2" (var "deftype"))
"%|-%<:%"
(tup
(var "C")
(case
"FUNC%"
(tup (sub (var "deftype") (var "typeuse") (var "deftype_1")))
)
(case
"FUNC%"
(tup (sub (var "deftype") (var "typeuse") (var "deftype_2")))
)
)
(rule
"Deftype_sub"
"%|-%<:%"
(tup (var "C") (var "deftype_1") (var "deftype_2"))
)
)
)
(rel
"Blocktype_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "blocktype"))
(bind (var "_") (var "instrtype"))
)
(rule
"valtype"
(exp "C" (var "context"))
(exp "valtype?" (iter (var "valtype") opt))
"%|-%:%"
(tup
(var "C")
(case
"_RESULT%"
(tup (iter (var "valtype") opt (dom "valtype" (var "valtype?"))))
)
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup
(lift (iter (var "valtype") opt (dom "valtype" (var "valtype?"))))
)
)
)
)
)
(iter
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "valtype")))
opt
(dom "valtype" (var "valtype?"))
)
)
(rule
"typeidx"
(exp "C" (var "context"))
(exp "typeidx" (var "typeidx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "_IDX%" (tup (var "typeidx")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "typeidx") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
)
(rel
"Catch_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "catch")))
(rule
"catch"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(exp "t*" (iter (var "valtype") list))
"%|-%:OK"
(tup (var "C") (case "CATCH%%" (tup (var "x") (var "l"))))
(rule
"Expand"
"%~~%"
(tup
(call
"as_deftype"
(exp (idx (dot (var "C") "TAGS") (proj (uncase (var "x") "%") 0)))
)
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
(case "%" (tup (list)))
)
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
)
)
)
(rule
"catch_ref"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(exp "t*" (iter (var "valtype") list))
"%|-%:OK"
(tup (var "C") (case "CATCH_REF%%" (tup (var "x") (var "l"))))
(rule
"Expand"
"%~~%"
(tup
(call
"as_deftype"
(exp (idx (dot (var "C") "TAGS") (proj (uncase (var "x") "%") 0)))
)
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
(case "%" (tup (list)))
)
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (case "REF%%" (tup (opt) (case "EXN" (tup)))))
)
)
)
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
)
)
)
(rule
"catch_all"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
"%|-%:OK"
(tup (var "C") (case "CATCH_ALL%" (tup (var "l"))))
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (list)))
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
)
)
)
(rule
"catch_all_ref"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
"%|-%:OK"
(tup (var "C") (case "CATCH_ALL_REF%" (tup (var "l"))))
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (list (case "REF%%" (tup (opt) (case "EXN" (tup)))))))
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
)
)
)
)
(def
"default_"
(exp "valtype" (var "valtype"))
(iter (var "val") opt)
(clause
(exp "Inn" (var "Inn"))
(exp (sub (var "Inn") (var "valtype") (var "Inn")))
(opt
(case
"CONST%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(case "%" (tup (num (nat 0))))
)
)
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp (sub (var "Fnn") (var "valtype") (var "Fnn")))
(opt
(case
"CONST%%"
(tup
(sub (var "Fnn") (var "numtype") (var "Fnn"))
(call
"fzero"
(exp
(call "size" (exp (sub (var "Fnn") (var "numtype") (var "Fnn"))))
)
)
)
)
)
)
(clause
(exp "Vnn" (var "Vnn"))
(exp (sub (var "Vnn") (var "valtype") (var "Vnn")))
(opt (case "VCONST%%" (tup (var "Vnn") (case "%" (tup (num (nat 0)))))))
)
(clause
(exp "ht" (var "heaptype"))
(exp (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht"))))
(opt (case "REF.NULL%" (tup (var "ht"))))
)
(clause
(exp "ht" (var "heaptype"))
(exp (case "REF%%" (tup (opt) (var "ht"))))
(opt)
)
)
(rel
"Defaultable"
"|-%DEFAULTABLE"
(var "valtype")
(rule
""
(exp "t" (var "valtype"))
"|-%DEFAULTABLE"
(var "t")
(if (cmp ne bool (call "default_" (exp (var "t"))) (opt)))
)
)
(rel
"Memarg_ok"
"|-%:%->%"
(tup
(bind (var "_") (var "memarg"))
(bind (var "_") (var "addrtype"))
(bind (var "_") (var "N"))
)
(rule
""
(exp "n" (var "n"))
(exp "m" (var "m"))
(exp "at" (var "addrtype"))
(exp "N" (var "N"))
"|-%:%->%"
(tup
(struct
(field "ALIGN" (case "%" (tup (var "n"))))
(field "OFFSET" (case "%" (tup (var "m"))))
)
(var "at")
(var "N")
)
(if
(cmp
le
rat
(cvt nat rat (bin pow nat (num (nat 2)) (var "n")))
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
(if
(cmp
lt
nat
(var "m")
(bin
pow
nat
(num (nat 2))
(call "size" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
)
)
)
)
(def
"is_packtype"
(exp "storagetype" (var "storagetype"))
bool
(clause
(exp "zt" (var "storagetype"))
(exp (var "zt"))
(cmp
eq
bool
(var "zt")
(sub (var "valtype") (var "storagetype") (call "unpack" (exp (var "zt"))))
)
)
)
(rec
(rel
"Instr_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "instr"))
(bind (var "_") (var "instrtype"))
)
(rule
"nop"
(exp "C" (var "context"))
"%|-%:%"
(tup
(var "C")
(case "NOP" (tup))
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list))))
)
)
)
(rule
"unreachable"
(exp "C" (var "context"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "UNREACHABLE" (tup))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"drop"
(exp "C" (var "context"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "DROP" (tup))
(case
"%->_%%"
(tup (case "%" (tup (list (var "t")))) (list) (case "%" (tup (list))))
)
)
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "t")))
)
(rule
"select-expl"
(exp "C" (var "context"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "SELECT%" (tup (opt (list (var "t")))))
(case
"%->_%%"
(tup
(case "%" (tup (list (var "t") (var "t") (case "I32" (tup)))))
(list)
(case "%" (tup (list (var "t"))))
)
)
)
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "t")))
)
(rule
"select-impl"
(exp "C" (var "context"))
(exp "t" (var "valtype"))
(exp "t'" (var "valtype"))
(exp "numtype" (var "numtype"))
(exp "vectype" (var "vectype"))
"%|-%:%"
(tup
(var "C")
(case "SELECT%" (tup (opt)))
(case
"%->_%%"
(tup
(case "%" (tup (list (var "t") (var "t") (case "I32" (tup)))))
(list)
(case "%" (tup (list (var "t"))))
)
)
)
(rule "Valtype_ok" "%|-%:OK" (tup (var "C") (var "t")))
(rule "Valtype_sub" "%|-%<:%" (tup (var "C") (var "t") (var "t'")))
(if
(bin
or
bool
(cmp
eq
bool
(var "t'")
(sub (var "numtype") (var "valtype") (var "numtype"))
)
(cmp
eq
bool
(var "t'")
(sub (var "vectype") (var "valtype") (var "vectype"))
)
)
)
)
(rule
"block"
(exp "C" (var "context"))
(exp "bt" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "x*" (iter (var "idx") list))
"%|-%:%"
(tup
(var "C")
(case
"BLOCK%%"
(tup
(var "bt")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Blocktype_ok"
"%|-%:%"
(tup
(var "C")
(var "bt")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x") list (dom "x" (var "x*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"loop"
(exp "C" (var "context"))
(exp "bt" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "x*" (iter (var "idx") list))
"%|-%:%"
(tup
(var "C")
(case
"LOOP%%"
(tup
(var "bt")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Blocktype_ok"
"%|-%:%"
(tup
(var "C")
(var "bt")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_1") list (dom "t_1" (var "t_1*"))))
)
)
)
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x") list (dom "x" (var "x*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"if"
(exp "C" (var "context"))
(exp "bt" (var "blocktype"))
(exp "instr_1*" (iter (var "instr") list))
(exp "instr_2*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "x_1*" (iter (var "idx") list))
(exp "x_2*" (iter (var "idx") list))
"%|-%:%"
(tup
(var "C")
(case
"IF%%ELSE%"
(tup
(var "bt")
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(list (case "I32" (tup)))
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Blocktype_ok"
"%|-%:%"
(tup
(var "C")
(var "bt")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x_1") list (dom "x_1" (var "x_1*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x_2") list (dom "x_2" (var "x_2*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"br"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "BR%" (tup (var "l")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(iter (var "t") list (dom "t" (var "t*")))
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(if
(cmp
eq
bool
(proj
(uncase
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
"%"
)
0
)
(iter (var "t") list (dom "t" (var "t*")))
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"br_if"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
(exp "t*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "BR_IF%" (tup (var "l")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (case "I32" (tup)))
)
)
)
(list)
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
)
)
(if
(cmp
eq
bool
(proj
(uncase
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
"%"
)
0
)
(iter (var "t") list (dom "t" (var "t*")))
)
)
)
(rule
"br_table"
(exp "C" (var "context"))
(exp "l*" (iter (var "labelidx") list))
(exp "l'" (var "labelidx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case
"BR_TABLE%%"
(tup (iter (var "l") list (dom "l" (var "l*"))) (var "l'"))
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (case "I32" (tup)))
)
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(iter
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
)
)
list
(dom "l" (var "l*"))
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
(idx (dot (var "C") "LABELS") (proj (uncase (var "l'") "%") 0))
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (case "I32" (tup)))
)
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"br_on_null"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
(exp "t*" (iter (var "valtype") list))
(exp "ht" (var "heaptype"))
"%|-%:%"
(tup
(var "C")
(case "BR_ON_NULL%" (tup (var "l")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list
(case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht")))
)
)
)
)
(list)
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (case "REF%%" (tup (opt) (var "ht"))))
)
)
)
)
)
)
(if
(cmp
eq
bool
(proj
(uncase
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
"%"
)
0
)
(iter (var "t") list (dom "t" (var "t*")))
)
)
(rule "Heaptype_ok" "%|-%:OK" (tup (var "C") (var "ht")))
)
(rule
"br_on_non_null"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
(exp "t*" (iter (var "valtype") list))
(exp "ht" (var "heaptype"))
"%|-%:%"
(tup
(var "C")
(case "BR_ON_NON_NULL%" (tup (var "l")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list
(case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht")))
)
)
)
)
(list)
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list
(case "REF%%" (tup (iter (case "NULL" (tup)) opt) (var "ht")))
)
)
)
)
)
)
)
(rule
"br_on_cast"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
(exp "t*" (iter (var "valtype") list))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "BR_ON_CAST%%%" (tup (var "l") (var "rt_1") (var "rt_2")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (sub (var "reftype") (var "valtype") (var "rt_1")))
)
)
)
(list)
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list
(sub
(var "reftype")
(var "valtype")
(call "diffrt" (exp (var "rt_1")) (exp (var "rt_2")))
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (sub (var "reftype") (var "valtype") (var "rt")))
)
)
)
)
)
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt_1")))
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt_2")))
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt_2") (var "rt_1")))
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt_2") (var "rt")))
)
(rule
"br_on_cast_fail"
(exp "C" (var "context"))
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
(exp "t*" (iter (var "valtype") list))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "BR_ON_CAST_FAIL%%%" (tup (var "l") (var "rt_1") (var "rt_2")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (sub (var "reftype") (var "valtype") (var "rt_1")))
)
)
)
(list)
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (sub (var "reftype") (var "valtype") (var "rt_2")))
)
)
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "LABELS") (proj (uncase (var "l") "%") 0))
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(list (sub (var "reftype") (var "valtype") (var "rt")))
)
)
)
)
)
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt_1")))
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt_2")))
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt_2") (var "rt_1")))
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(var "C")
(call "diffrt" (exp (var "rt_1")) (exp (var "rt_2")))
(var "rt")
)
)
)
(rule
"call"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "CALL%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "FUNCS") (proj (uncase (var "x") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"call_ref"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "CALL_REF%" (tup (case "_IDX%" (tup (var "x")))))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
)
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"call_indirect"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "at" (var "addrtype"))
(exp "t_2*" (iter (var "valtype") list))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "CALL_INDIRECT%%" (tup (var "x") (case "_IDX%" (tup (var "y")))))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(list (sub (var "addrtype") (var "valtype") (var "at")))
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(var "C")
(var "rt")
(case "REF%%" (tup (opt (case "NULL" (tup))) (case "FUNC" (tup))))
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "y") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"return"
(exp "C" (var "context"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "RETURN" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(iter (var "t") list (dom "t" (var "t*")))
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(if
(cmp
eq
bool
(dot (var "C") "RETURN")
(opt (case "%" (tup (iter (var "t") list (dom "t" (var "t*"))))))
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"return_call"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t_3*" (iter (var "valtype") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_4*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "t'_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "RETURN_CALL%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_3") list (dom "t_3" (var "t_3*")))
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
)
)
)
(list)
(case "%" (tup (iter (var "t_4") list (dom "t_4" (var "t_4*")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "FUNCS") (proj (uncase (var "x") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(if
(cmp
eq
bool
(dot (var "C") "RETURN")
(opt
(case "%" (tup (iter (var "t'_2") list (dom "t'_2" (var "t'_2*")))))
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
(case "%" (tup (iter (var "t'_2") list (dom "t'_2" (var "t'_2*")))))
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_3") list (dom "t_3" (var "t_3*")))))
(list)
(case "%" (tup (iter (var "t_4") list (dom "t_4" (var "t_4*")))))
)
)
)
)
)
(rule
"return_call_ref"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t_3*" (iter (var "valtype") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_4*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "t'_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "RETURN_CALL_REF%" (tup (case "_IDX%" (tup (var "x")))))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_3") list (dom "t_3" (var "t_3*")))
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
)
)
)
)
)
(list)
(case "%" (tup (iter (var "t_4") list (dom "t_4" (var "t_4*")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(if
(cmp
eq
bool
(dot (var "C") "RETURN")
(opt
(case "%" (tup (iter (var "t'_2") list (dom "t'_2" (var "t'_2*")))))
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
(case "%" (tup (iter (var "t'_2") list (dom "t'_2" (var "t'_2*")))))
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_3") list (dom "t_3" (var "t_3*")))))
(list)
(case "%" (tup (iter (var "t_4") list (dom "t_4" (var "t_4*")))))
)
)
)
)
)
(rule
"return_call_indirect"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "t_3*" (iter (var "valtype") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "at" (var "addrtype"))
(exp "t_4*" (iter (var "valtype") list))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
(exp "t_2*" (iter (var "valtype") list))
(exp "t'_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case
"RETURN_CALL_INDIRECT%%"
(tup (var "x") (case "_IDX%" (tup (var "y"))))
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_3") list (dom "t_3" (var "t_3*")))
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(list (sub (var "addrtype") (var "valtype") (var "at")))
)
)
)
)
(list)
(case "%" (tup (iter (var "t_4") list (dom "t_4" (var "t_4*")))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(var "C")
(var "rt")
(case "REF%%" (tup (opt (case "NULL" (tup))) (case "FUNC" (tup))))
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "y") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(if
(cmp
eq
bool
(dot (var "C") "RETURN")
(opt
(case "%" (tup (iter (var "t'_2") list (dom "t'_2" (var "t'_2*")))))
)
)
)
(rule
"Resulttype_sub"
"%|-%<:%"
(tup
(var "C")
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
(case "%" (tup (iter (var "t'_2") list (dom "t'_2" (var "t'_2*")))))
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_3") list (dom "t_3" (var "t_3*")))))
(list)
(case "%" (tup (iter (var "t_4") list (dom "t_4" (var "t_4*")))))
)
)
)
)
)
(rule
"throw"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "THROW%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(iter (var "t") list (dom "t" (var "t*")))
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call
"as_deftype"
(exp (idx (dot (var "C") "TAGS") (proj (uncase (var "x") "%") 0)))
)
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
(case "%" (tup (list)))
)
)
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"throw_ref"
(exp "C" (var "context"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(case "THROW_REF" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
(list
(case
"REF%%"
(tup (opt (case "NULL" (tup))) (case "EXN" (tup)))
)
)
)
)
)
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Instrtype_ok"
"%|-%:OK"
(tup
(var "C")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(rule
"try_table"
(exp "C" (var "context"))
(exp "bt" (var "blocktype"))
(exp "catch*" (iter (var "catch") list))
(exp "instr*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "x*" (iter (var "idx") list))
"%|-%:%"
(tup
(var "C")
(case
"TRY_TABLE%%%"
(tup
(var "bt")
(case
"%"
(tup (iter (var "catch") list (dom "catch" (var "catch*"))))
)
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Blocktype_ok"
"%|-%:%"
(tup
(var "C")
(var "bt")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x") list (dom "x" (var "x*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(iter
(rule "Catch_ok" "%|-%:OK" (tup (var "C") (var "catch")))
list
(dom "catch" (var "catch*"))
)
)
(rule
"ref.null"
(exp "C" (var "context"))
(exp "ht" (var "heaptype"))
"%|-%:%"
(tup
(var "C")
(case "REF.NULL%" (tup (var "ht")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht"))))
)
)
)
)
)
(rule "Heaptype_ok" "%|-%:OK" (tup (var "C") (var "ht")))
)
(rule
"ref.func"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "dt" (var "deftype"))
"%|-%:%"
(tup
(var "C")
(case "REF.FUNC%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt)
(sub (var "deftype") (var "heaptype") (var "dt"))
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "FUNCS") (proj (uncase (var "x") "%") 0))
(var "dt")
)
)
(if (mem (var "x") (dot (var "C") "REFS")))
)
(rule
"ref.i31"
(exp "C" (var "context"))
"%|-%:%"
(tup
(var "C")
(case "REF.I31" (tup))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "I32" (tup)))))
(list)
(case
"%"
(tup (list (case "REF%%" (tup (opt) (case "I31" (tup))))))
)
)
)
)
)
(rule
"ref.is_null"
(exp "C" (var "context"))
(exp "ht" (var "heaptype"))
"%|-%:%"
(tup
(var "C")
(case "REF.IS_NULL" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht"))))
)
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
(rule "Heaptype_ok" "%|-%:OK" (tup (var "C") (var "ht")))
)
(rule
"ref.as_non_null"
(exp "C" (var "context"))
(exp "ht" (var "heaptype"))
"%|-%:%"
(tup
(var "C")
(case "REF.AS_NON_NULL" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht"))))
)
)
(list)
(case "%" (tup (list (case "REF%%" (tup (opt) (var "ht"))))))
)
)
)
(rule "Heaptype_ok" "%|-%:OK" (tup (var "C") (var "ht")))
)
(rule
"ref.eq"
(exp "C" (var "context"))
"%|-%:%"
(tup
(var "C")
(case "REF.EQ" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup (opt (case "NULL" (tup))) (case "EQ" (tup)))
)
(case
"REF%%"
(tup (opt (case "NULL" (tup))) (case "EQ" (tup)))
)
)
)
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"ref.test"
(exp "C" (var "context"))
(exp "rt" (var "reftype"))
(exp "rt'" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "REF.TEST%" (tup (var "rt")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "reftype") (var "valtype") (var "rt'"))))
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt")))
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt'")))
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt") (var "rt'")))
)
(rule
"ref.cast"
(exp "C" (var "context"))
(exp "rt" (var "reftype"))
(exp "rt'" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "REF.CAST%" (tup (var "rt")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "reftype") (var "valtype") (var "rt'"))))
)
(list)
(case
"%"
(tup (list (sub (var "reftype") (var "valtype") (var "rt"))))
)
)
)
)
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt")))
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "rt'")))
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt") (var "rt'")))
)
(rule
"i31.get"
(exp "C" (var "context"))
(exp "sx" (var "sx"))
"%|-%:%"
(tup
(var "C")
(case "I31.GET%" (tup (var "sx")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup (opt (case "NULL" (tup))) (case "I31" (tup)))
)
)
)
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"struct.new"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "zt*" (iter (var "storagetype") list))
(exp "mut?*" (iter (iter (var "mut") opt) list))
"%|-%:%"
(tup
(var "C")
(case "STRUCT.NEW%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(iter
(call "unpack" (exp (var "zt")))
list
(dom "zt" (var "zt*"))
)
)
)
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt")
)
)
list
(dom "mut?" (var "mut?*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
)
)
(rule
"struct.new_default"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "mut?*" (iter (iter (var "mut") opt) list))
(exp "zt*" (iter (var "storagetype") list))
"%|-%:%"
(tup
(var "C")
(case "STRUCT.NEW_DEFAULT%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt")
)
)
list
(dom "mut?" (var "mut?*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
)
(iter
(rule "Defaultable" "|-%DEFAULTABLE" (call "unpack" (exp (var "zt"))))
list
(dom "zt" (var "zt*"))
)
)
(rule
"struct.get"
(exp "C" (var "context"))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(exp "zt" (var "storagetype"))
(exp "ft*" (iter (var "fieldtype") list))
(exp "mut?" (iter (var "mut") opt))
"%|-%:%"
(tup
(var "C")
(case
"STRUCT.GET%%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x") (var "i"))
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
)
)
)
(list)
(case "%" (tup (list (call "unpack" (exp (var "zt"))))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"STRUCT%"
(tup (case "%" (tup (iter (var "ft") list (dom "ft" (var "ft*"))))))
)
)
)
(if
(cmp
eq
bool
(idx
(iter (var "ft") list (dom "ft" (var "ft*")))
(proj (uncase (var "i") "%") 0)
)
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
(if
(bin
equiv
bool
(cmp eq bool (iter (var "sx") opt (dom "sx" (var "sx?"))) (opt))
(call "is_packtype" (exp (var "zt")))
)
)
)
(rule
"struct.set"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(exp "zt" (var "storagetype"))
(exp "ft*" (iter (var "fieldtype") list))
"%|-%:%"
(tup
(var "C")
(case "STRUCT.SET%%" (tup (var "x") (var "i")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
(call "unpack" (exp (var "zt")))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"STRUCT%"
(tup (case "%" (tup (iter (var "ft") list (dom "ft" (var "ft*"))))))
)
)
)
(if
(cmp
eq
bool
(idx
(iter (var "ft") list (dom "ft" (var "ft*")))
(proj (uncase (var "i") "%") 0)
)
(case "%%" (tup (opt (case "MUT" (tup))) (var "zt")))
)
)
)
(rule
"array.new"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.NEW%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (call "unpack" (exp (var "zt"))) (case "I32" (tup))))
)
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
)
(rule
"array.new_default"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.NEW_DEFAULT%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "I32" (tup)))))
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(rule "Defaultable" "|-%DEFAULTABLE" (call "unpack" (exp (var "zt"))))
)
(rule
"array.new_fixed"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "n" (var "n"))
(exp "zt" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
(case
"%->_%%"
(tup
(case
"%"
(tup (iter (call "unpack" (exp (var "zt"))) (listn (var "n"))))
)
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
)
(rule
"array.new_elem"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "mut?" (iter (var "mut") opt))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.NEW_ELEM%%" (tup (var "x") (var "y")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "I32" (tup)) (case "I32" (tup)))))
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(sub (var "reftype") (var "storagetype") (var "rt"))
)
)
)
)
)
)
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(var "C")
(idx (dot (var "C") "ELEMS") (proj (uncase (var "y") "%") 0))
(var "rt")
)
)
)
(rule
"array.new_data"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
(exp "numtype" (var "numtype"))
(exp "vectype" (var "vectype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.NEW_DATA%%" (tup (var "x") (var "y")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "I32" (tup)) (case "I32" (tup)))))
(list)
(case
"%"
(tup
(list (case "REF%%" (tup (opt) (case "_IDX%" (tup (var "x"))))))
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(bin
or
bool
(cmp
eq
bool
(call "unpack" (exp (var "zt")))
(sub (var "numtype") (var "valtype") (var "numtype"))
)
(cmp
eq
bool
(call "unpack" (exp (var "zt")))
(sub (var "vectype") (var "valtype") (var "vectype"))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "DATAS") (proj (uncase (var "y") "%") 0))
(case "OK" (tup))
)
)
)
(rule
"array.get"
(exp "C" (var "context"))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
"%|-%:%"
(tup
(var "C")
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x"))
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list (call "unpack" (exp (var "zt"))))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(bin
equiv
bool
(cmp eq bool (iter (var "sx") opt (dom "sx" (var "sx?"))) (opt))
(call "is_packtype" (exp (var "zt")))
)
)
)
(rule
"array.set"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "zt" (var "storagetype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.SET%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
(case "I32" (tup))
(call "unpack" (exp (var "zt")))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup (case "%%" (tup (opt (case "MUT" (tup))) (var "zt"))))
)
)
)
)
(rule
"array.len"
(exp "C" (var "context"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.LEN" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup (opt (case "NULL" (tup))) (case "ARRAY" (tup)))
)
)
)
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"array.fill"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "zt" (var "storagetype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.FILL%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
(case "I32" (tup))
(call "unpack" (exp (var "zt")))
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup (case "%%" (tup (opt (case "MUT" (tup))) (var "zt"))))
)
)
)
)
(rule
"array.copy"
(exp "C" (var "context"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(exp "zt_1" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt_2" (var "storagetype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x_1")))
)
)
(case "I32" (tup))
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x_2")))
)
)
(case "I32" (tup))
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x_1") "%") 0))
(case
"ARRAY%"
(tup (case "%%" (tup (opt (case "MUT" (tup))) (var "zt_1"))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x_2") "%") 0))
(case
"ARRAY%"
(tup
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt_2")
)
)
)
)
)
)
(rule
"Storagetype_sub"
"%|-%<:%"
(tup (var "C") (var "zt_2") (var "zt_1"))
)
)
(rule
"array.init_elem"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "zt" (var "storagetype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
(case "I32" (tup))
(case "I32" (tup))
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup (case "%%" (tup (opt (case "MUT" (tup))) (var "zt"))))
)
)
)
(rule
"Storagetype_sub"
"%|-%<:%"
(tup
(var "C")
(sub
(var "reftype")
(var "storagetype")
(idx (dot (var "C") "ELEMS") (proj (uncase (var "y") "%") 0))
)
(var "zt")
)
)
)
(rule
"array.init_data"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "numtype" (var "numtype"))
(exp "vectype" (var "vectype"))
"%|-%:%"
(tup
(var "C")
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(case "_IDX%" (tup (var "x")))
)
)
(case "I32" (tup))
(case "I32" (tup))
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"ARRAY%"
(tup (case "%%" (tup (opt (case "MUT" (tup))) (var "zt"))))
)
)
)
(if
(bin
or
bool
(cmp
eq
bool
(call "unpack" (exp (var "zt")))
(sub (var "numtype") (var "valtype") (var "numtype"))
)
(cmp
eq
bool
(call "unpack" (exp (var "zt")))
(sub (var "vectype") (var "valtype") (var "vectype"))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "DATAS") (proj (uncase (var "y") "%") 0))
(case "OK" (tup))
)
)
)
(rule
"extern.convert_any"
(exp "C" (var "context"))
(exp "null_1?" (iter (var "null") opt))
(exp "null_2?" (iter (var "null") opt))
"%|-%:%"
(tup
(var "C")
(case "EXTERN.CONVERT_ANY" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(case "ANY" (tup))
)
)
)
)
)
(list)
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
(case "EXTERN" (tup))
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
)
)
)
(rule
"any.convert_extern"
(exp "C" (var "context"))
(exp "null_1?" (iter (var "null") opt))
(exp "null_2?" (iter (var "null") opt))
"%|-%:%"
(tup
(var "C")
(case "ANY.CONVERT_EXTERN" (tup))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(case "EXTERN" (tup))
)
)
)
)
)
(list)
(case
"%"
(tup
(list
(case
"REF%%"
(tup
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
(case "ANY" (tup))
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
)
)
)
(rule
"local.get"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "LOCAL.GET%" (tup (var "x")))
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list (var "t")))))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "LOCALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (case "SET" (tup)) (var "t")))
)
)
)
(rule
"local.set"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
(exp "init" (var "init"))
"%|-%:%"
(tup
(var "C")
(case "LOCAL.SET%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list (var "t"))))
(list (var "x"))
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "LOCALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (var "init") (var "t")))
)
)
)
(rule
"local.tee"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
(exp "init" (var "init"))
"%|-%:%"
(tup
(var "C")
(case "LOCAL.TEE%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list (var "t"))))
(list (var "x"))
(case "%" (tup (list (var "t"))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "LOCALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (var "init") (var "t")))
)
)
)
(rule
"global.get"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
(exp "mut?" (iter (var "mut") opt))
"%|-%:%"
(tup
(var "C")
(case "GLOBAL.GET%" (tup (var "x")))
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list (var "t")))))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "GLOBALS") (proj (uncase (var "x") "%") 0))
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "t"))
)
)
)
)
(rule
"global.set"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "GLOBAL.SET%" (tup (var "x")))
(case
"%->_%%"
(tup (case "%" (tup (list (var "t")))) (list) (case "%" (tup (list))))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "GLOBALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (opt (case "MUT" (tup))) (var "t")))
)
)
)
(rule
"table.get"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "rt" (var "reftype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.GET%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case
"%"
(tup (list (sub (var "reftype") (var "valtype") (var "rt"))))
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
)
(rule
"table.set"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "rt" (var "reftype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.SET%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(sub (var "reftype") (var "valtype") (var "rt"))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
)
(rule
"table.size"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.SIZE%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
)
(rule
"table.grow"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "rt" (var "reftype"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.GROW%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "reftype") (var "valtype") (var "rt"))
(sub (var "addrtype") (var "valtype") (var "at"))
)
)
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
)
(rule
"table.fill"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "rt" (var "reftype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.FILL%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(sub (var "reftype") (var "valtype") (var "rt"))
(sub (var "addrtype") (var "valtype") (var "at"))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
)
(rule
"table.copy"
(exp "C" (var "context"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(exp "at_1" (var "addrtype"))
(exp "at_2" (var "addrtype"))
(exp "lim_1" (var "limits"))
(exp "rt_1" (var "reftype"))
(exp "lim_2" (var "limits"))
(exp "rt_2" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.COPY%%" (tup (var "x_1") (var "x_2")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at_1"))
(sub (var "addrtype") (var "valtype") (var "at_2"))
(sub
(var "addrtype")
(var "valtype")
(call "minat" (exp (var "at_1")) (exp (var "at_2")))
)
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x_1") "%") 0))
(case "%%%" (tup (var "at_1") (var "lim_1") (var "rt_1")))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x_2") "%") 0))
(case "%%%" (tup (var "at_2") (var "lim_2") (var "rt_2")))
)
)
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt_2") (var "rt_1")))
)
(rule
"table.init"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(case "I32" (tup))
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt_1")))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "ELEMS") (proj (uncase (var "y") "%") 0))
(var "rt_2")
)
)
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt_2") (var "rt_1")))
)
(rule
"elem.drop"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "ELEM.DROP%" (tup (var "x")))
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list))))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "ELEMS") (proj (uncase (var "x") "%") 0))
(var "rt")
)
)
)
(rule
"memory.size"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "MEMORY.SIZE%" (tup (var "x")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
)
(rule
"memory.grow"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "MEMORY.GROW%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
)
(rule
"memory.fill"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "MEMORY.FILL%" (tup (var "x")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(case "I32" (tup))
(sub (var "addrtype") (var "valtype") (var "at"))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
)
(rule
"memory.copy"
(exp "C" (var "context"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(exp "at_1" (var "addrtype"))
(exp "at_2" (var "addrtype"))
(exp "lim_1" (var "limits"))
(exp "lim_2" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at_1"))
(sub (var "addrtype") (var "valtype") (var "at_2"))
(sub
(var "addrtype")
(var "valtype")
(call "minat" (exp (var "at_1")) (exp (var "at_2")))
)
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x_1") "%") 0))
(case "%%PAGE" (tup (var "at_1") (var "lim_1")))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x_2") "%") 0))
(case "%%PAGE" (tup (var "at_2") (var "lim_2")))
)
)
)
(rule
"memory.init"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(case "I32" (tup))
(case "I32" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "DATAS") (proj (uncase (var "y") "%") 0))
(case "OK" (tup))
)
)
)
(rule
"data.drop"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%:%"
(tup
(var "C")
(case "DATA.DROP%" (tup (var "x")))
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list))))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "DATAS") (proj (uncase (var "x") "%") 0))
(case "OK" (tup))
)
)
)
(rule
"load-val"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "LOAD%%%%" (tup (var "nt") (opt) (var "x") (var "memarg")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt"))))
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule
"Memarg_ok"
"|-%:%->%"
(tup (var "memarg") (var "at") (call "size" (exp (var "nt"))))
)
)
(rule
"load-pack"
(exp "C" (var "context"))
(exp "Inn" (var "Inn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"LOAD%%%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(opt (case "%_%" (tup (case "%" (tup (var "M"))) (var "sx"))))
(var "x")
(var "memarg")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case
"%"
(tup (list (sub (var "Inn") (var "valtype") (var "Inn"))))
)
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule "Memarg_ok" "|-%:%->%" (tup (var "memarg") (var "at") (var "M")))
)
(rule
"store-val"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "STORE%%%%" (tup (var "nt") (opt) (var "x") (var "memarg")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(sub (var "numtype") (var "valtype") (var "nt"))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule
"Memarg_ok"
"|-%:%->%"
(tup (var "memarg") (var "at") (call "size" (exp (var "nt"))))
)
)
(rule
"store-pack"
(exp "C" (var "context"))
(exp "Inn" (var "Inn"))
(exp "M" (var "M"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"STORE%%%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(opt (case "%" (tup (case "%" (tup (var "M"))))))
(var "x")
(var "memarg")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(sub (var "Inn") (var "valtype") (var "Inn"))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule "Memarg_ok" "|-%:%->%" (tup (var "memarg") (var "at") (var "M")))
)
(rule
"vload-val"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"VLOAD%%%%"
(tup (case "V128" (tup)) (opt) (var "x") (var "memarg"))
)
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule
"Memarg_ok"
"|-%:%->%"
(tup (var "memarg") (var "at") (call "vsize" (exp (case "V128" (tup)))))
)
)
(rule
"vload-pack"
(exp "C" (var "context"))
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (var "M"))) (var "N") (var "sx"))
)
)
(var "x")
(var "memarg")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule
"Memarg_ok"
"|-%:%->%"
(tup (var "memarg") (var "at") (bin mul nat (var "M") (var "N")))
)
)
(rule
"vload-splat"
(exp "C" (var "context"))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (var "N"))))))
(var "x")
(var "memarg")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule "Memarg_ok" "|-%:%->%" (tup (var "memarg") (var "at") (var "N")))
)
(rule
"vload-zero"
(exp "C" (var "context"))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (var "N"))))))
(var "x")
(var "memarg")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "addrtype") (var "valtype") (var "at"))))
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule "Memarg_ok" "|-%:%->%" (tup (var "memarg") (var "at") (var "N")))
)
(rule
"vload_lane"
(exp "C" (var "context"))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "i" (var "laneidx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (var "N")))
(var "x")
(var "memarg")
(var "i")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(case "V128" (tup))
)
)
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule "Memarg_ok" "|-%:%->%" (tup (var "memarg") (var "at") (var "N")))
(if
(cmp
lt
rat
(cvt nat rat (proj (uncase (var "i") "%") 0))
(bin div rat (cvt nat rat (num (nat 128))) (cvt nat rat (var "N")))
)
)
)
(rule
"vstore"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "VSTORE%%%" (tup (case "V128" (tup)) (var "x") (var "memarg")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(case "V128" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule
"Memarg_ok"
"|-%:%->%"
(tup (var "memarg") (var "at") (call "vsize" (exp (case "V128" (tup)))))
)
)
(rule
"vstore_lane"
(exp "C" (var "context"))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "memarg" (var "memarg"))
(exp "i" (var "laneidx"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (var "N")))
(var "x")
(var "memarg")
(var "i")
)
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "addrtype") (var "valtype") (var "at"))
(case "V128" (tup))
)
)
)
(list)
(case "%" (tup (list)))
)
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule "Memarg_ok" "|-%:%->%" (tup (var "memarg") (var "at") (var "N")))
(if
(cmp
lt
rat
(cvt nat rat (proj (uncase (var "i") "%") 0))
(bin div rat (cvt nat rat (num (nat 128))) (cvt nat rat (var "N")))
)
)
)
(rule
"const"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "c_nt" (var "num_" (exp (var "nt"))))
"%|-%:%"
(tup
(var "C")
(case "CONST%%" (tup (var "nt") (var "c_nt")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt"))))
)
)
)
)
)
(rule
"unop"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "unop_nt" (var "unop_" (exp (var "nt"))))
"%|-%:%"
(tup
(var "C")
(case "UNOP%%" (tup (var "nt") (var "unop_nt")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt"))))
)
(list)
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt"))))
)
)
)
)
)
(rule
"binop"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "binop_nt" (var "binop_" (exp (var "nt"))))
"%|-%:%"
(tup
(var "C")
(case "BINOP%%" (tup (var "nt") (var "binop_nt")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "numtype") (var "valtype") (var "nt"))
(sub (var "numtype") (var "valtype") (var "nt"))
)
)
)
(list)
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt"))))
)
)
)
)
)
(rule
"testop"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "testop_nt" (var "testop_" (exp (var "nt"))))
"%|-%:%"
(tup
(var "C")
(case "TESTOP%%" (tup (var "nt") (var "testop_nt")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt"))))
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"relop"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "relop_nt" (var "relop_" (exp (var "nt"))))
"%|-%:%"
(tup
(var "C")
(case "RELOP%%" (tup (var "nt") (var "relop_nt")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub (var "numtype") (var "valtype") (var "nt"))
(sub (var "numtype") (var "valtype") (var "nt"))
)
)
)
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"cvtop"
(exp "C" (var "context"))
(exp "nt_1" (var "numtype"))
(exp "nt_2" (var "numtype"))
(exp "cvtop" (var "cvtop__" (exp (var "nt_2")) (exp (var "nt_1"))))
"%|-%:%"
(tup
(var "C")
(case "CVTOP%%%" (tup (var "nt_1") (var "nt_2") (var "cvtop")))
(case
"%->_%%"
(tup
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt_2"))))
)
(list)
(case
"%"
(tup (list (sub (var "numtype") (var "valtype") (var "nt_1"))))
)
)
)
)
)
(rule
"vconst"
(exp "C" (var "context"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%|-%:%"
(tup
(var "C")
(case "VCONST%%" (tup (case "V128" (tup)) (var "c")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vvunop"
(exp "C" (var "context"))
(exp "vvunop" (var "vvunop"))
"%|-%:%"
(tup
(var "C")
(case "VVUNOP%%" (tup (case "V128" (tup)) (var "vvunop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vvbinop"
(exp "C" (var "context"))
(exp "vvbinop" (var "vvbinop"))
"%|-%:%"
(tup
(var "C")
(case "VVBINOP%%" (tup (case "V128" (tup)) (var "vvbinop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vvternop"
(exp "C" (var "context"))
(exp "vvternop" (var "vvternop"))
"%|-%:%"
(tup
(var "C")
(case "VVTERNOP%%" (tup (case "V128" (tup)) (var "vvternop")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case "V128" (tup))
(case "V128" (tup))
(case "V128" (tup))
)
)
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vvtestop"
(exp "C" (var "context"))
(exp "vvtestop" (var "vvtestop"))
"%|-%:%"
(tup
(var "C")
(case "VVTESTOP%%" (tup (case "V128" (tup)) (var "vvtestop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"vunop"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "vunop" (var "vunop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VUNOP%%" (tup (var "sh") (var "vunop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vbinop"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "vbinop" (var "vbinop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VBINOP%%" (tup (var "sh") (var "vbinop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vternop"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "vternop" (var "vternop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VTERNOP%%" (tup (var "sh") (var "vternop")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case "V128" (tup))
(case "V128" (tup))
(case "V128" (tup))
)
)
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vtestop"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "vtestop" (var "vtestop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VTESTOP%%" (tup (var "sh") (var "vtestop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"vrelop"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "vrelop" (var "vrelop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VRELOP%%" (tup (var "sh") (var "vrelop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vshiftop"
(exp "C" (var "context"))
(exp "sh" (var "ishape"))
(exp "vshiftop" (var "vshiftop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VSHIFTOP%%" (tup (var "sh") (var "vshiftop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "I32" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vbitmask"
(exp "C" (var "context"))
(exp "sh" (var "ishape"))
"%|-%:%"
(tup
(var "C")
(case "VBITMASK%" (tup (var "sh")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"vswizzlop"
(exp "C" (var "context"))
(exp "sh" (var "bshape"))
(exp "vswizzlop" (var "vswizzlop_" (exp (var "sh"))))
"%|-%:%"
(tup
(var "C")
(case "VSWIZZLOP%%" (tup (var "sh") (var "vswizzlop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vshuffle"
(exp "C" (var "context"))
(exp "sh" (var "bshape"))
(exp "i*" (iter (var "laneidx") list))
"%|-%:%"
(tup
(var "C")
(case
"VSHUFFLE%%"
(tup (var "sh") (iter (var "i") list (dom "i" (var "i*"))))
)
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(iter
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(bin
mul
nat
(num (nat 2))
(proj
(uncase (call "dim" (exp (proj (uncase (var "sh") "%") 0))) "%")
0
)
)
)
)
list
(dom "i" (var "i*"))
)
)
(rule
"vsplat"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
"%|-%:%"
(tup
(var "C")
(case "VSPLAT%" (tup (var "sh")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(sub
(var "numtype")
(var "valtype")
(call "unpackshape" (exp (var "sh")))
)
)
)
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vextract_lane"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "sx?" (iter (var "sx") opt))
(exp "i" (var "laneidx"))
"%|-%:%"
(tup
(var "C")
(case
"VEXTRACT_LANE%%%"
(tup
(var "sh")
(iter (var "sx") opt (dom "sx" (var "sx?")))
(var "i")
)
)
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case
"%"
(tup
(list
(sub
(var "numtype")
(var "valtype")
(call "unpackshape" (exp (var "sh")))
)
)
)
)
)
)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (call "dim" (exp (var "sh"))) "%") 0)
)
)
)
(rule
"vreplace_lane"
(exp "C" (var "context"))
(exp "sh" (var "shape"))
(exp "i" (var "laneidx"))
"%|-%:%"
(tup
(var "C")
(case "VREPLACE_LANE%%" (tup (var "sh") (var "i")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case "V128" (tup))
(sub
(var "numtype")
(var "valtype")
(call "unpackshape" (exp (var "sh")))
)
)
)
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (call "dim" (exp (var "sh"))) "%") 0)
)
)
)
(rule
"vextunop"
(exp "C" (var "context"))
(exp "sh_1" (var "ishape"))
(exp "sh_2" (var "ishape"))
(exp "vextunop" (var "vextunop__" (exp (var "sh_2")) (exp (var "sh_1"))))
"%|-%:%"
(tup
(var "C")
(case "VEXTUNOP%%%" (tup (var "sh_1") (var "sh_2") (var "vextunop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vextbinop"
(exp "C" (var "context"))
(exp "sh_1" (var "ishape"))
(exp "sh_2" (var "ishape"))
(exp
"vextbinop"
(var "vextbinop__" (exp (var "sh_2")) (exp (var "sh_1")))
)
"%|-%:%"
(tup
(var "C")
(case "VEXTBINOP%%%" (tup (var "sh_1") (var "sh_2") (var "vextbinop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vextternop"
(exp "C" (var "context"))
(exp "sh_1" (var "ishape"))
(exp "sh_2" (var "ishape"))
(exp
"vextternop"
(var "vextternop__" (exp (var "sh_2")) (exp (var "sh_1")))
)
"%|-%:%"
(tup
(var "C")
(case
"VEXTTERNOP%%%"
(tup (var "sh_1") (var "sh_2") (var "vextternop"))
)
(case
"%->_%%"
(tup
(case
"%"
(tup
(list
(case "V128" (tup))
(case "V128" (tup))
(case "V128" (tup))
)
)
)
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vnarrow"
(exp "C" (var "context"))
(exp "sh_1" (var "ishape"))
(exp "sh_2" (var "ishape"))
(exp "sx" (var "sx"))
"%|-%:%"
(tup
(var "C")
(case "VNARROW%%%" (tup (var "sh_1") (var "sh_2") (var "sx")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)) (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
(rule
"vcvtop"
(exp "C" (var "context"))
(exp "sh_1" (var "shape"))
(exp "sh_2" (var "shape"))
(exp "vcvtop" (var "vcvtop__" (exp (var "sh_2")) (exp (var "sh_1"))))
"%|-%:%"
(tup
(var "C")
(case "VCVTOP%%%" (tup (var "sh_1") (var "sh_2") (var "vcvtop")))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "V128" (tup)))))
(list)
(case "%" (tup (list (case "V128" (tup)))))
)
)
)
)
)
(rel
"Instrs_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (iter (var "instr") list))
(bind (var "_") (var "instrtype"))
)
(rule
"empty"
(exp "C" (var "context"))
"%|-%:%"
(tup
(var "C")
(list)
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list))))
)
)
)
(rule
"seq"
(exp "C" (var "context"))
(exp "instr_1" (var "instr"))
(exp "instr_2*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "x_1*" (iter (var "idx") list))
(exp "x_2*" (iter (var "idx") list))
(exp "t_3*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "init*" (iter (var "init") list))
(exp "t*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(cat
(list (var "instr_1"))
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
)
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(cat
(iter (var "x_1") list (dom "x_1" (var "x_1*")))
(iter (var "x_2") list (dom "x_2" (var "x_2*")))
)
(case "%" (tup (iter (var "t_3") list (dom "t_3" (var "t_3*")))))
)
)
)
(rule
"Instr_ok"
"%|-%:%"
(tup
(var "C")
(var "instr_1")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x_1") list (dom "x_1" (var "x_1*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(iter
(if
(cmp
eq
bool
(idx (dot (var "C") "LOCALS") (proj (uncase (var "x_1") "%") 0))
(case "%%" (tup (var "init") (var "t")))
)
)
list
(dom "init" (var "init*"))
(dom "t" (var "t*"))
(dom "x_1" (var "x_1*"))
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(call
"with_locals"
(exp (var "C"))
(exp (iter (var "x_1") list (dom "x_1" (var "x_1*"))))
(exp
(iter
(case "%%" (tup (case "SET" (tup)) (var "t")))
list
(dom "t" (var "t*"))
)
)
)
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
(iter (var "x_2") list (dom "x_2" (var "x_2*")))
(case "%" (tup (iter (var "t_3") list (dom "t_3" (var "t_3*")))))
)
)
)
)
)
(rule
"sub"
(exp "C" (var "context"))
(exp "instr*" (iter (var "instr") list))
(exp "it'" (var "instrtype"))
(exp "it" (var "instrtype"))
"%|-%:%"
(tup
(var "C")
(iter (var "instr") list (dom "instr" (var "instr*")))
(var "it'")
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(var "C")
(iter (var "instr") list (dom "instr" (var "instr*")))
(var "it")
)
)
(rule "Instrtype_sub" "%|-%<:%" (tup (var "C") (var "it") (var "it'")))
(rule "Instrtype_ok" "%|-%:OK" (tup (var "C") (var "it'")))
)
(rule
"frame"
(exp "C" (var "context"))
(exp "instr*" (iter (var "instr") list))
(exp "t*" (iter (var "valtype") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "x*" (iter (var "idx") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(iter (var "t_1") list (dom "t_1" (var "t_1*")))
)
)
)
(iter (var "x") list (dom "x" (var "x*")))
(case
"%"
(tup
(cat
(iter (var "t") list (dom "t" (var "t*")))
(iter (var "t_2") list (dom "t_2" (var "t_2*")))
)
)
)
)
)
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(var "C")
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(iter (var "x") list (dom "x" (var "x*")))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"Resulttype_ok"
"%|-%:OK"
(tup
(var "C")
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
)
)
)
)
(rel
"Expr_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "expr"))
(bind (var "_") (var "resulttype"))
)
(rule
""
(exp "C" (var "context"))
(exp "instr*" (iter (var "instr") list))
(exp "t*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(iter (var "instr") list (dom "instr" (var "instr*")))
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
(rule
"Instrs_ok"
"%|-%:%"
(tup
(var "C")
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
)
)
)
)
)
(rel
"Nondefaultable"
"|-%NONDEFAULTABLE"
(var "valtype")
(rule
""
(exp "t" (var "valtype"))
"|-%NONDEFAULTABLE"
(var "t")
(if (cmp eq bool (call "default_" (exp (var "t"))) (opt)))
)
)
(rel
"Instr_const"
"%|-%CONST"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "instr")))
(rule
"const"
(exp "C" (var "context"))
(exp "nt" (var "numtype"))
(exp "c_nt" (var "num_" (exp (var "nt"))))
"%|-%CONST"
(tup (var "C") (case "CONST%%" (tup (var "nt") (var "c_nt"))))
)
(rule
"vconst"
(exp "C" (var "context"))
(exp "vt" (var "vectype"))
(exp "c_vt" (var "vec_" (exp (var "vt"))))
"%|-%CONST"
(tup (var "C") (case "VCONST%%" (tup (var "vt") (var "c_vt"))))
)
(rule
"ref.null"
(exp "C" (var "context"))
(exp "ht" (var "heaptype"))
"%|-%CONST"
(tup (var "C") (case "REF.NULL%" (tup (var "ht"))))
)
(rule
"ref.i31"
(exp "C" (var "context"))
"%|-%CONST"
(tup (var "C") (case "REF.I31" (tup)))
)
(rule
"ref.func"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%CONST"
(tup (var "C") (case "REF.FUNC%" (tup (var "x"))))
)
(rule
"struct.new"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%CONST"
(tup (var "C") (case "STRUCT.NEW%" (tup (var "x"))))
)
(rule
"struct.new_default"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%CONST"
(tup (var "C") (case "STRUCT.NEW_DEFAULT%" (tup (var "x"))))
)
(rule
"array.new"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%CONST"
(tup (var "C") (case "ARRAY.NEW%" (tup (var "x"))))
)
(rule
"array.new_default"
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%CONST"
(tup (var "C") (case "ARRAY.NEW_DEFAULT%" (tup (var "x"))))
)
(rule
"array.new_fixed"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "n" (var "n"))
"%|-%CONST"
(tup
(var "C")
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
)
(rule
"any.convert_extern"
(exp "C" (var "context"))
"%|-%CONST"
(tup (var "C") (case "ANY.CONVERT_EXTERN" (tup)))
)
(rule
"extern.convert_any"
(exp "C" (var "context"))
"%|-%CONST"
(tup (var "C") (case "EXTERN.CONVERT_ANY" (tup)))
)
(rule
"global.get"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
"%|-%CONST"
(tup (var "C") (case "GLOBAL.GET%" (tup (var "x"))))
(if
(cmp
eq
bool
(idx (dot (var "C") "GLOBALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (opt) (var "t")))
)
)
)
(rule
"binop"
(exp "C" (var "context"))
(exp "Inn" (var "Inn"))
(exp
"binop"
(var "binop_" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
"%|-%CONST"
(tup
(var "C")
(case
"BINOP%%"
(tup (sub (var "Inn") (var "numtype") (var "Inn")) (var "binop"))
)
)
(if (mem (var "Inn") (list (case "I32" (tup)) (case "I64" (tup)))))
(if
(mem
(var "binop")
(list (case "ADD" (tup)) (case "SUB" (tup)) (case "MUL" (tup)))
)
)
)
)
(rel
"Expr_const"
"%|-%CONST"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "expr")))
(rule
""
(exp "C" (var "context"))
(exp "instr*" (iter (var "instr") list))
"%|-%CONST"
(tup (var "C") (iter (var "instr") list (dom "instr" (var "instr*"))))
(iter
(rule "Instr_const" "%|-%CONST" (tup (var "C") (var "instr")))
list
(dom "instr" (var "instr*"))
)
)
)
(rel
"Expr_ok_const"
"%|-%:%CONST"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "expr"))
(bind (var "_") (var "valtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "expr" (var "expr"))
(exp "t" (var "valtype"))
"%|-%:%CONST"
(tup (var "C") (var "expr") (var "t"))
(rule
"Expr_ok"
"%|-%:%"
(tup (var "C") (var "expr") (case "%" (tup (list (var "t")))))
)
(rule "Expr_const" "%|-%CONST" (tup (var "C") (var "expr")))
)
)
(rel
"Type_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "type"))
(bind (var "_") (iter (var "deftype") list))
)
(rule
""
(exp "C" (var "context"))
(exp "rectype" (var "rectype"))
(exp "dt*" (iter (var "deftype") list))
(exp "x" (var "idx"))
"%|-%:%"
(tup
(var "C")
(case "TYPE%" (tup (var "rectype")))
(iter (var "dt") list (dom "dt" (var "dt*")))
)
(if
(cmp
eq
bool
(proj (uncase (var "x") "%") 0)
(len (dot (var "C") "TYPES"))
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(call "rolldt" (exp (var "x")) (exp (var "rectype")))
)
)
(rule
"Rectype_ok"
"%|-%:%"
(tup
(comp
(var "C")
(struct
(field "TYPES" (iter (var "dt") list (dom "dt" (var "dt*"))))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
)
(var "rectype")
(case "OK%" (tup (var "x")))
)
)
)
)
(rel
"Tag_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "tag"))
(bind (var "_") (var "tagtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "tagtype" (var "tagtype"))
"%|-%:%"
(tup
(var "C")
(case "TAG%" (tup (var "tagtype")))
(call "clos_tagtype" (exp (var "C")) (exp (var "tagtype")))
)
(rule "Tagtype_ok" "%|-%:OK" (tup (var "C") (var "tagtype")))
)
)
(rel
"Global_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "global"))
(bind (var "_") (var "globaltype"))
)
(rule
""
(exp "C" (var "context"))
(exp "globaltype" (var "globaltype"))
(exp "expr" (var "expr"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "GLOBAL%%" (tup (var "globaltype") (var "expr")))
(var "globaltype")
)
(rule "Globaltype_ok" "%|-%:OK" (tup (var "C") (var "globaltype")))
(if
(cmp
eq
bool
(var "globaltype")
(case "%%" (tup (iter (case "MUT" (tup)) opt) (var "t")))
)
)
(rule "Expr_ok_const" "%|-%:%CONST" (tup (var "C") (var "expr") (var "t")))
)
)
(rel
"Mem_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "mem"))
(bind (var "_") (var "memtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "memtype" (var "memtype"))
"%|-%:%"
(tup (var "C") (case "MEMORY%" (tup (var "memtype"))) (var "memtype"))
(rule "Memtype_ok" "%|-%:OK" (tup (var "C") (var "memtype")))
)
)
(rel
"Table_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "table"))
(bind (var "_") (var "tabletype"))
)
(rule
""
(exp "C" (var "context"))
(exp "tabletype" (var "tabletype"))
(exp "expr" (var "expr"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "C")
(case "TABLE%%" (tup (var "tabletype") (var "expr")))
(var "tabletype")
)
(rule "Tabletype_ok" "%|-%:OK" (tup (var "C") (var "tabletype")))
(if
(cmp
eq
bool
(var "tabletype")
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
(rule
"Expr_ok_const"
"%|-%:%CONST"
(tup
(var "C")
(var "expr")
(sub (var "reftype") (var "valtype") (var "rt"))
)
)
)
)
(rel
"Local_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "local"))
(bind (var "_") (var "localtype"))
)
(rule
"set"
(exp "C" (var "context"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "LOCAL%" (tup (var "t")))
(case "%%" (tup (case "SET" (tup)) (var "t")))
)
(rule "Defaultable" "|-%DEFAULTABLE" (var "t"))
)
(rule
"unset"
(exp "C" (var "context"))
(exp "t" (var "valtype"))
"%|-%:%"
(tup
(var "C")
(case "LOCAL%" (tup (var "t")))
(case "%%" (tup (case "UNSET" (tup)) (var "t")))
)
(rule "Nondefaultable" "|-%NONDEFAULTABLE" (var "t"))
)
)
(rel
"Func_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "func"))
(bind (var "_") (var "deftype"))
)
(rule
""
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "local*" (iter (var "local") list))
(exp "expr" (var "expr"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "lct*" (iter (var "localtype") list))
"%|-%:%"
(tup
(var "C")
(case
"FUNC%%%"
(tup
(var "x")
(iter (var "local") list (dom "local" (var "local*")))
(var "expr")
)
)
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
)
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "TYPES") (proj (uncase (var "x") "%") 0))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(iter
(rule "Local_ok" "%|-%:%" (tup (var "C") (var "local") (var "lct")))
list
(dom "lct" (var "lct*"))
(dom "local" (var "local*"))
)
(rule
"Expr_ok"
"%|-%:%"
(tup
(comp
(var "C")
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field
"LOCALS"
(cat
(iter
(case "%%" (tup (case "SET" (tup)) (var "t_1")))
list
(dom "t_1" (var "t_1*"))
)
(iter (var "lct") list (dom "lct" (var "lct*")))
)
)
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field
"RETURN"
(opt
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field "REFS" (list))
)
)
(var "expr")
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rel
"Datamode_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "datamode"))
(bind (var "_") (var "datatype"))
)
(rule
"passive"
(exp "C" (var "context"))
"%|-%:%"
(tup (var "C") (case "PASSIVE" (tup)) (case "OK" (tup)))
)
(rule
"active"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "expr" (var "expr"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
"%|-%:%"
(tup
(var "C")
(case "ACTIVE%%" (tup (var "x") (var "expr")))
(case "OK" (tup))
)
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(rule
"Expr_ok_const"
"%|-%:%CONST"
(tup
(var "C")
(var "expr")
(sub (var "addrtype") (var "valtype") (var "at"))
)
)
)
)
(rel
"Data_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "data"))
(bind (var "_") (var "datatype"))
)
(rule
""
(exp "C" (var "context"))
(exp "b*" (iter (var "byte") list))
(exp "datamode" (var "datamode"))
"%|-%:%"
(tup
(var "C")
(case
"DATA%%"
(tup (iter (var "b") list (dom "b" (var "b*"))) (var "datamode"))
)
(case "OK" (tup))
)
(rule
"Datamode_ok"
"%|-%:%"
(tup (var "C") (var "datamode") (case "OK" (tup)))
)
)
)
(rel
"Elemmode_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "elemmode"))
(bind (var "_") (var "elemtype"))
)
(rule
"passive"
(exp "C" (var "context"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup (var "C") (case "PASSIVE" (tup)) (var "rt"))
)
(rule
"declare"
(exp "C" (var "context"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup (var "C") (case "DECLARE" (tup)) (var "rt"))
)
(rule
"active"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "expr" (var "expr"))
(exp "rt" (var "reftype"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "rt'" (var "reftype"))
"%|-%:%"
(tup (var "C") (case "ACTIVE%%" (tup (var "x") (var "expr"))) (var "rt"))
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(case "%%%" (tup (var "at") (var "lim") (var "rt'")))
)
)
(rule "Reftype_sub" "%|-%<:%" (tup (var "C") (var "rt") (var "rt'")))
(rule
"Expr_ok_const"
"%|-%:%CONST"
(tup
(var "C")
(var "expr")
(sub (var "addrtype") (var "valtype") (var "at"))
)
)
)
)
(rel
"Elem_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "elem"))
(bind (var "_") (var "elemtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "elemtype" (var "elemtype"))
(exp "expr*" (iter (var "expr") list))
(exp "elemmode" (var "elemmode"))
"%|-%:%"
(tup
(var "C")
(case
"ELEM%%%"
(tup
(var "elemtype")
(iter (var "expr") list (dom "expr" (var "expr*")))
(var "elemmode")
)
)
(var "elemtype")
)
(rule "Reftype_ok" "%|-%:OK" (tup (var "C") (var "elemtype")))
(iter
(rule
"Expr_ok_const"
"%|-%:%CONST"
(tup
(var "C")
(var "expr")
(sub (var "reftype") (var "valtype") (var "elemtype"))
)
)
list
(dom "expr" (var "expr*"))
)
(rule
"Elemmode_ok"
"%|-%:%"
(tup (var "C") (var "elemmode") (var "elemtype"))
)
)
)
(rel
"Start_ok"
"%|-%:OK"
(tup (bind (var "_") (var "context")) (bind (var "_") (var "start")))
(rule
""
(exp "C" (var "context"))
(exp "x" (var "idx"))
"%|-%:OK"
(tup (var "C") (case "START%" (tup (var "x"))))
(rule
"Expand"
"%~~%"
(tup
(idx (dot (var "C") "FUNCS") (proj (uncase (var "x") "%") 0))
(case "FUNC%->%" (tup (case "%" (tup (list))) (case "%" (tup (list)))))
)
)
)
)
(rel
"Import_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "import"))
(bind (var "_") (var "externtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "name_1" (var "name"))
(exp "name_2" (var "name"))
(exp "xt" (var "externtype"))
"%|-%:%"
(tup
(var "C")
(case "IMPORT%%%" (tup (var "name_1") (var "name_2") (var "xt")))
(call "clos_externtype" (exp (var "C")) (exp (var "xt")))
)
(rule "Externtype_ok" "%|-%:OK" (tup (var "C") (var "xt")))
)
)
(rel
"Externidx_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "externidx"))
(bind (var "_") (var "externtype"))
)
(rule
"tag"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "jt" (var "tagtype"))
"%|-%:%"
(tup (var "C") (case "TAG%" (tup (var "x"))) (case "TAG%" (tup (var "jt"))))
(if
(cmp
eq
bool
(idx (dot (var "C") "TAGS") (proj (uncase (var "x") "%") 0))
(var "jt")
)
)
)
(rule
"global"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "gt" (var "globaltype"))
"%|-%:%"
(tup
(var "C")
(case "GLOBAL%" (tup (var "x")))
(case "GLOBAL%" (tup (var "gt")))
)
(if
(cmp
eq
bool
(idx (dot (var "C") "GLOBALS") (proj (uncase (var "x") "%") 0))
(var "gt")
)
)
)
(rule
"mem"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "mt" (var "memtype"))
"%|-%:%"
(tup (var "C") (case "MEM%" (tup (var "x"))) (case "MEM%" (tup (var "mt"))))
(if
(cmp
eq
bool
(idx (dot (var "C") "MEMS") (proj (uncase (var "x") "%") 0))
(var "mt")
)
)
)
(rule
"table"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "tt" (var "tabletype"))
"%|-%:%"
(tup
(var "C")
(case "TABLE%" (tup (var "x")))
(case "TABLE%" (tup (var "tt")))
)
(if
(cmp
eq
bool
(idx (dot (var "C") "TABLES") (proj (uncase (var "x") "%") 0))
(var "tt")
)
)
)
(rule
"func"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "dt" (var "deftype"))
"%|-%:%"
(tup
(var "C")
(case "FUNC%" (tup (var "x")))
(case "FUNC%" (tup (sub (var "deftype") (var "typeuse") (var "dt"))))
)
(if
(cmp
eq
bool
(idx (dot (var "C") "FUNCS") (proj (uncase (var "x") "%") 0))
(var "dt")
)
)
)
)
(rel
"Export_ok"
"%|-%:%%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (var "export"))
(bind (var "_") (var "name"))
(bind (var "_") (var "externtype"))
)
(rule
""
(exp "C" (var "context"))
(exp "name" (var "name"))
(exp "externidx" (var "externidx"))
(exp "xt" (var "externtype"))
"%|-%:%%"
(tup
(var "C")
(case "EXPORT%%" (tup (var "name") (var "externidx")))
(var "name")
(var "xt")
)
(rule "Externidx_ok" "%|-%:%" (tup (var "C") (var "externidx") (var "xt")))
)
)
(rec
(rel
"Globals_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (iter (var "global") list))
(bind (var "_") (iter (var "globaltype") list))
)
(rule
"empty"
(exp "C" (var "context"))
"%|-%:%"
(tup (var "C") (list) (list))
)
(rule
"cons"
(exp "C" (var "context"))
(exp "global_1" (var "global"))
(exp "global*" (iter (var "global") list))
(exp "gt_1" (var "globaltype"))
(exp "gt*" (iter (var "globaltype") list))
"%|-%:%"
(tup
(var "C")
(cat
(list (var "global_1"))
(iter (var "global") list (dom "global" (var "global*")))
)
(cat (list (var "gt_1")) (iter (var "gt") list (dom "gt" (var "gt*"))))
)
(rule "Global_ok" "%|-%:%" (tup (var "C") (var "global_1") (var "gt_1")))
(rule
"Globals_ok"
"%|-%:%"
(tup
(comp
(var "C")
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list (var "gt_1")))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
)
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "gt") list (dom "gt" (var "gt*")))
)
)
)
)
)
(rec
(rel
"Types_ok"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (iter (var "type") list))
(bind (var "_") (iter (var "deftype") list))
)
(rule
"empty"
(exp "C" (var "context"))
"%|-%:%"
(tup (var "C") (list) (list))
)
(rule
"cons"
(exp "C" (var "context"))
(exp "type_1" (var "type"))
(exp "type*" (iter (var "type") list))
(exp "dt_1*" (iter (var "deftype") list))
(exp "dt*" (iter (var "deftype") list))
"%|-%:%"
(tup
(var "C")
(cat
(list (var "type_1"))
(iter (var "type") list (dom "type" (var "type*")))
)
(cat
(iter (var "dt_1") list (dom "dt_1" (var "dt_1*")))
(iter (var "dt") list (dom "dt" (var "dt*")))
)
)
(rule
"Type_ok"
"%|-%:%"
(tup
(var "C")
(var "type_1")
(iter (var "dt_1") list (dom "dt_1" (var "dt_1*")))
)
)
(rule
"Types_ok"
"%|-%:%"
(tup
(comp
(var "C")
(struct
(field
"TYPES"
(iter (var "dt_1") list (dom "dt_1" (var "dt_1*")))
)
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
)
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "dt") list (dom "dt" (var "dt*")))
)
)
)
)
)
(typ
"nonfuncs"
(inst
(variant
(case
"%%%%"
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "elem*" (iter (var "elem") list))
(tup
(bind
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "global") list)
)
(bind
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "mem") list)
)
(bind
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "table") list)
)
(bind
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "elem") list)
)
)
)
)
)
)
(def
"funcidx_nonfuncs"
(exp "nonfuncs" (var "nonfuncs"))
(iter (var "funcidx") list)
(clause
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "elem*" (iter (var "elem") list))
(exp
(case
"%%%%"
(tup
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
)
)
)
(call
"funcidx_module"
(exp
(case
"MODULE%%%%%%%%%%%"
(tup
(list)
(list)
(list)
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(list)
(list)
(iter (var "elem") list (dom "elem" (var "elem*")))
(opt)
(list)
)
)
)
)
)
)
(rel
"Module_ok"
"|-%:%"
(tup (bind (var "_") (var "module")) (bind (var "_") (var "moduletype")))
(rule
""
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "func*" (iter (var "func") list))
(exp "data*" (iter (var "data") list))
(exp "elem*" (iter (var "elem") list))
(exp "start?" (iter (var "start") opt))
(exp "export*" (iter (var "export") list))
(exp "C" (var "context"))
(exp "xt_I*" (iter (var "externtype") list))
(exp "xt_E*" (iter (var "externtype") list))
(exp "dt'*" (iter (var "deftype") list))
(exp "C'" (var "context"))
(exp "jt*" (iter (var "tagtype") list))
(exp "gt*" (iter (var "globaltype") list))
(exp "mt*" (iter (var "memtype") list))
(exp "tt*" (iter (var "tabletype") list))
(exp "dt*" (iter (var "deftype") list))
(exp "ok*" (iter (var "datatype") list))
(exp "rt*" (iter (var "reftype") list))
(exp "nm*" (iter (var "name") list))
(exp "jt_I*" (iter (var "tagtype") list))
(exp "mt_I*" (iter (var "memtype") list))
(exp "tt_I*" (iter (var "tabletype") list))
(exp "gt_I*" (iter (var "globaltype") list))
(exp "dt_I*" (iter (var "deftype") list))
(exp "x*" (iter (var "idx") list))
"|-%:%"
(tup
(case
"MODULE%%%%%%%%%%%"
(tup
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "export") list (dom "export" (var "export*")))
)
)
(call
"clos_moduletype"
(exp (var "C"))
(exp
(case
"%->%"
(tup
(iter (var "xt_I") list (dom "xt_I" (var "xt_I*")))
(iter (var "xt_E") list (dom "xt_E" (var "xt_E*")))
)
)
)
)
)
(rule
"Types_ok"
"%|-%:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "dt'") list (dom "dt'" (var "dt'*")))
)
)
(iter
(rule
"Import_ok"
"%|-%:%"
(tup
(struct
(field "TYPES" (iter (var "dt'") list (dom "dt'" (var "dt'*"))))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "import")
(var "xt_I")
)
)
list
(dom "import" (var "import*"))
(dom "xt_I" (var "xt_I*"))
)
(iter
(rule "Tag_ok" "%|-%:%" (tup (var "C'") (var "tag") (var "jt")))
list
(dom "jt" (var "jt*"))
(dom "tag" (var "tag*"))
)
(rule
"Globals_ok"
"%|-%:%"
(tup
(var "C'")
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "gt") list (dom "gt" (var "gt*")))
)
)
(iter
(rule "Mem_ok" "%|-%:%" (tup (var "C'") (var "mem") (var "mt")))
list
(dom "mem" (var "mem*"))
(dom "mt" (var "mt*"))
)
(iter
(rule "Table_ok" "%|-%:%" (tup (var "C'") (var "table") (var "tt")))
list
(dom "table" (var "table*"))
(dom "tt" (var "tt*"))
)
(iter
(rule "Func_ok" "%|-%:%" (tup (var "C") (var "func") (var "dt")))
list
(dom "dt" (var "dt*"))
(dom "func" (var "func*"))
)
(iter
(rule "Data_ok" "%|-%:%" (tup (var "C") (var "data") (var "ok")))
list
(dom "data" (var "data*"))
(dom "ok" (var "ok*"))
)
(iter
(rule "Elem_ok" "%|-%:%" (tup (var "C") (var "elem") (var "rt")))
list
(dom "elem" (var "elem*"))
(dom "rt" (var "rt*"))
)
(iter
(rule "Start_ok" "%|-%:OK" (tup (var "C") (var "start")))
opt
(dom "start" (var "start?"))
)
(iter
(rule
"Export_ok"
"%|-%:%%"
(tup (var "C") (var "export") (var "nm") (var "xt_E"))
)
list
(dom "export" (var "export*"))
(dom "nm" (var "nm*"))
(dom "xt_E" (var "xt_E*"))
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp (iter (var "nm") list (dom "nm" (var "nm*"))))
)
)
(if
(cmp
eq
bool
(var "C")
(comp
(var "C'")
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field
"TAGS"
(cat
(iter (var "jt_I") list (dom "jt_I" (var "jt_I*")))
(iter (var "jt") list (dom "jt" (var "jt*")))
)
)
(field "GLOBALS" (iter (var "gt") list (dom "gt" (var "gt*"))))
(field
"MEMS"
(cat
(iter (var "mt_I") list (dom "mt_I" (var "mt_I*")))
(iter (var "mt") list (dom "mt" (var "mt*")))
)
)
(field
"TABLES"
(cat
(iter (var "tt_I") list (dom "tt_I" (var "tt_I*")))
(iter (var "tt") list (dom "tt" (var "tt*")))
)
)
(field "FUNCS" (list))
(field "DATAS" (iter (var "ok") list (dom "ok" (var "ok*"))))
(field "ELEMS" (iter (var "rt") list (dom "rt" (var "rt*"))))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
)
)
)
(if
(cmp
eq
bool
(var "C'")
(struct
(field "TYPES" (iter (var "dt'") list (dom "dt'" (var "dt'*"))))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (iter (var "gt_I") list (dom "gt_I" (var "gt_I*"))))
(field "MEMS" (list))
(field "TABLES" (list))
(field
"FUNCS"
(cat
(iter (var "dt_I") list (dom "dt_I" (var "dt_I*")))
(iter (var "dt") list (dom "dt" (var "dt*")))
)
)
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (iter (var "x") list (dom "x" (var "x*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "x") list (dom "x" (var "x*")))
(call
"funcidx_nonfuncs"
(exp
(case
"%%%%"
(tup
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
)
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "jt_I") list (dom "jt_I" (var "jt_I*")))
(call
"tagsxt"
(exp (iter (var "xt_I") list (dom "xt_I" (var "xt_I*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "gt_I") list (dom "gt_I" (var "gt_I*")))
(call
"globalsxt"
(exp (iter (var "xt_I") list (dom "xt_I" (var "xt_I*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "mt_I") list (dom "mt_I" (var "mt_I*")))
(call
"memsxt"
(exp (iter (var "xt_I") list (dom "xt_I" (var "xt_I*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "tt_I") list (dom "tt_I" (var "tt_I*")))
(call
"tablesxt"
(exp (iter (var "xt_I") list (dom "xt_I" (var "xt_I*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt_I") list (dom "dt_I" (var "dt_I*")))
(call
"funcsxt"
(exp (iter (var "xt_I") list (dom "xt_I" (var "xt_I*"))))
)
)
)
)
)
(typ
"relaxed2"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
or
bool
(cmp eq bool (var "i") (num (nat 0)))
(cmp eq bool (var "i") (num (nat 1)))
)
)
)
)
)
)
(typ
"relaxed4"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if
(bin
or
bool
(bin
or
bool
(bin
or
bool
(cmp eq bool (var "i") (num (nat 0)))
(cmp eq bool (var "i") (num (nat 1)))
)
(cmp eq bool (var "i") (num (nat 2)))
)
(cmp eq bool (var "i") (num (nat 3)))
)
)
)
)
)
)
(def
"relaxed2"
(exp "relaxed2" (var "relaxed2"))
(typ "X")
(exp "X" (var "X"))
(exp "X" (var "X"))
(var "X")
(clause
(exp "i" (var "relaxed2"))
(typ "X")
(exp "X_1" (var "X"))
(exp "X_2" (var "X"))
(exp (var "i"))
(typ (var "X"))
(exp (var "X_1"))
(exp (var "X_2"))
(idx (list (var "X_1") (var "X_2")) (proj (uncase (var "i") "%") 0))
(if (call "ND"))
)
(clause
(exp "i" (var "relaxed2"))
(typ "X")
(exp "X_1" (var "X"))
(exp "X_2" (var "X"))
(exp (var "i"))
(typ (var "X"))
(exp (var "X_1"))
(exp (var "X_2"))
(idx (list (var "X_1") (var "X_2")) (num (nat 0)))
else
)
)
(def
"relaxed4"
(exp "relaxed4" (var "relaxed4"))
(typ "X")
(exp "X" (var "X"))
(exp "X" (var "X"))
(exp "X" (var "X"))
(exp "X" (var "X"))
(var "X")
(clause
(exp "i" (var "relaxed4"))
(typ "X")
(exp "X_1" (var "X"))
(exp "X_2" (var "X"))
(exp "X_3" (var "X"))
(exp "X_4" (var "X"))
(exp (var "i"))
(typ (var "X"))
(exp (var "X_1"))
(exp (var "X_2"))
(exp (var "X_3"))
(exp (var "X_4"))
(idx
(list (var "X_1") (var "X_2") (var "X_3") (var "X_4"))
(proj (uncase (var "i") "%") 0)
)
(if (call "ND"))
)
(clause
(exp "i" (var "relaxed4"))
(typ "X")
(exp "X_1" (var "X"))
(exp "X_2" (var "X"))
(exp "X_3" (var "X"))
(exp "X_4" (var "X"))
(exp (var "i"))
(typ (var "X"))
(exp (var "X_1"))
(exp (var "X_2"))
(exp (var "X_3"))
(exp (var "X_4"))
(idx (list (var "X_1") (var "X_2") (var "X_3") (var "X_4")) (num (nat 0)))
else
)
)
(def "R_fmadd" (var "relaxed2"))
(def "R_fmin" (var "relaxed4"))
(def "R_fmax" (var "relaxed4"))
(def "R_idot" (var "relaxed2"))
(def "R_iq15mulr" (var "relaxed2"))
(def "R_trunc_u" (var "relaxed4"))
(def "R_trunc_s" (var "relaxed2"))
(def "R_swizzle" (var "relaxed2"))
(def "R_laneselect" (var "relaxed2"))
(def "s33_to_u32" (exp "s33" (var "s33")) (var "u32"))
(def
"ibits_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "bit") list)
)
(def
"fbits_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "bit") list)
)
(def
"ibytes_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "byte") list)
)
(def
"fbytes_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "byte") list)
)
(def
"nbytes_"
(exp "numtype" (var "numtype"))
(exp "num_" (var "num_" (exp (var "numtype"))))
(iter (var "byte") list)
)
(def
"vbytes_"
(exp "vectype" (var "vectype"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(iter (var "byte") list)
)
(def
"zbytes_"
(exp "storagetype" (var "storagetype"))
(exp "lit_" (var "lit_" (exp (var "storagetype"))))
(iter (var "byte") list)
)
(def
"cbytes_"
(exp "Cnn" (var "Cnn"))
(exp
"lit_"
(var "lit_" (exp (sub (var "Cnn") (var "storagetype") (var "Cnn"))))
)
(iter (var "byte") list)
)
(def
"inv_ibits_"
(exp "N" (var "N"))
(exp "_" (iter (var "bit") list))
(var "iN" (exp (var "N")))
)
(def
"inv_fbits_"
(exp "N" (var "N"))
(exp "_" (iter (var "bit") list))
(var "fN" (exp (var "N")))
)
(def
"inv_ibytes_"
(exp "N" (var "N"))
(exp "_" (iter (var "byte") list))
(var "iN" (exp (var "N")))
)
(def
"inv_fbytes_"
(exp "N" (var "N"))
(exp "_" (iter (var "byte") list))
(var "fN" (exp (var "N")))
)
(def
"inv_nbytes_"
(exp "numtype" (var "numtype"))
(exp "_" (iter (var "byte") list))
(var "num_" (exp (var "numtype")))
)
(def
"inv_vbytes_"
(exp "vectype" (var "vectype"))
(exp "_" (iter (var "byte") list))
(var "vec_" (exp (var "vectype")))
)
(def
"inv_zbytes_"
(exp "storagetype" (var "storagetype"))
(exp "_" (iter (var "byte") list))
(var "lit_" (exp (var "storagetype")))
)
(def
"inv_cbytes_"
(exp "Cnn" (var "Cnn"))
(exp "_" (iter (var "byte") list))
(var "lit_" (exp (sub (var "Cnn") (var "storagetype") (var "Cnn"))))
)
(def
"signed_"
(exp "N" (var "N"))
(exp "nat" nat)
int
(clause
(exp "N" (var "N"))
(exp "i" nat)
(exp (var "N"))
(exp (var "i"))
(cvt nat int (var "i"))
(if
(cmp
lt
nat
(var "i")
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 1))))
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i" nat)
(exp (var "N"))
(exp (var "i"))
(bin
sub
int
(cvt nat int (var "i"))
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
)
(if
(bin
and
bool
(cmp
le
nat
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 1))))
)
)
(var "i")
)
(cmp lt nat (var "i") (bin pow nat (num (nat 2)) (var "N")))
)
)
)
)
(def
"inv_signed_"
(exp "N" (var "N"))
(exp "int" int)
nat
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(cvt int nat (var "i"))
(if
(bin
and
bool
(cmp le int (cvt nat int (num (nat 0))) (var "i"))
(cmp
lt
int
(var "i")
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(cvt
int
nat
(bin
add
int
(var "i")
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
)
)
(if
(bin
and
bool
(cmp
le
int
(un
minus
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(var "i")
)
(cmp lt int (var "i") (cvt nat int (num (nat 0))))
)
)
)
)
(def
"sx"
(exp "storagetype" (var "storagetype"))
(iter (var "sx") opt)
(clause
(exp "consttype" (var "consttype"))
(exp (sub (var "consttype") (var "storagetype") (var "consttype")))
(opt)
)
(clause
(exp "packtype" (var "packtype"))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(opt (case "S" (tup)))
)
)
(def
"zero"
(exp "lanetype" (var "lanetype"))
(var "lane_" (exp (var "lanetype")))
(clause
(exp "Jnn" (var "Jnn"))
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
(case "%" (tup (num (nat 0))))
)
(clause
(exp "Fnn" (var "Fnn"))
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn")))
(call
"fzero"
(exp (call "size" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
)
)
)
(def
"bool"
(exp "bool" bool)
nat
(clause (exp (bool false)) (num (nat 0)))
(clause (exp (bool true)) (num (nat 1)))
)
(def "truncz" (exp "rat" rat) int)
(def "ceilz" (exp "rat" rat) int)
(def
"sat_u_"
(exp "N" (var "N"))
(exp "int" int)
nat
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(num (nat 0))
(if (cmp lt int (var "i") (cvt nat int (num (nat 0)))))
)
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(cvt
int
nat
(bin
sub
int
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
(cvt nat int (num (nat 1)))
)
)
(if
(cmp
gt
int
(var "i")
(bin
sub
int
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
(cvt nat int (num (nat 1)))
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(cvt int nat (var "i"))
else
)
)
(def
"sat_s_"
(exp "N" (var "N"))
(exp "int" int)
int
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(un
minus
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 1))))
)
)
)
)
(if
(cmp
lt
int
(var "i")
(un
minus
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(bin
sub
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 1))))
)
)
)
(cvt nat int (num (nat 1)))
)
(if
(cmp
gt
int
(var "i")
(bin
sub
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
(cvt nat int (num (nat 1)))
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i" int)
(exp (var "N"))
(exp (var "i"))
(var "i")
else
)
)
(def
"ineg_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(case
"%"
(tup
(cvt
int
nat
(bin
mod
int
(bin
sub
int
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
(cvt nat int (proj (uncase (var "i_1") "%") 0))
)
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
)
)
)
)
)
)
(def
"iabs_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(var "i_1")
(if
(cmp
ge
int
(call "signed_" (exp (var "N")) (exp (proj (uncase (var "i_1") "%") 0)))
(cvt nat int (num (nat 0)))
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(call "ineg_" (exp (var "N")) (exp (var "i_1")))
else
)
)
(def
"iclz_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"ictz_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"ipopcnt_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"iextend_"
(exp "N" (var "N"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "M" (var "M"))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "M"))
(exp (case "U" (tup)))
(exp (var "i"))
(case
"%"
(tup
(bin
mod
nat
(proj (uncase (var "i") "%") 0)
(bin pow nat (num (nat 2)) (var "M"))
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "M" (var "M"))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "M"))
(exp (case "S" (tup)))
(exp (var "i"))
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp
(call
"signed_"
(exp (var "M"))
(exp
(bin
mod
nat
(proj (uncase (var "i") "%") 0)
(bin pow nat (num (nat 2)) (var "M"))
)
)
)
)
)
)
)
)
)
(def
"iadd_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(bin
mod
nat
(bin
add
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
(bin pow nat (num (nat 2)) (var "N"))
)
)
)
)
)
(def
"isub_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(cvt
int
nat
(bin
mod
int
(bin
sub
int
(cvt
nat
int
(bin
add
nat
(bin pow nat (num (nat 2)) (var "N"))
(proj (uncase (var "i_1") "%") 0)
)
)
(cvt nat int (proj (uncase (var "i_2") "%") 0))
)
(cvt nat int (bin pow nat (num (nat 2)) (var "N")))
)
)
)
)
)
)
(def
"imul_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(bin
mod
nat
(bin
mul
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
(bin pow nat (num (nat 2)) (var "N"))
)
)
)
)
)
(def
"idiv_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) opt)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (case "%" (tup (num (nat 0)))))
(opt)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(opt
(case
"%"
(tup
(cvt
int
nat
(call
"truncz"
(exp
(bin
div
rat
(cvt nat rat (proj (uncase (var "i_1") "%") 0))
(cvt nat rat (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (case "%" (tup (num (nat 0)))))
(opt)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(opt)
(if
(cmp
eq
bool
(bin
div
rat
(cvt
int
rat
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
)
(cvt
int
rat
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
(cvt
nat
rat
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 1))))
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(opt
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp
(call
"truncz"
(exp
(bin
div
rat
(cvt
int
rat
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
)
(cvt
int
rat
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
)
)
)
)
(def
"irem_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) opt)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (case "%" (tup (num (nat 0)))))
(opt)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(opt
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "i_1") "%") 0))
(cvt
nat
int
(bin
mul
nat
(proj (uncase (var "i_2") "%") 0)
(cvt
int
nat
(call
"truncz"
(exp
(bin
div
rat
(cvt nat rat (proj (uncase (var "i_1") "%") 0))
(cvt nat rat (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (case "%" (tup (num (nat 0)))))
(opt)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp "j_1" int)
(exp "j_2" int)
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(opt
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp
(bin
sub
int
(var "j_1")
(bin
mul
int
(var "j_2")
(call
"truncz"
(exp
(bin
div
rat
(cvt int rat (var "j_1"))
(cvt int rat (var "j_2"))
)
)
)
)
)
)
)
)
)
)
(if
(bin
and
bool
(cmp
eq
bool
(var "j_1")
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
)
(cmp
eq
bool
(var "j_2")
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
(def
"imin_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_1")
(if
(cmp
le
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_2")
(if
(cmp
gt
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_1")
(if
(cmp
le
int
(call "signed_" (exp (var "N")) (exp (proj (uncase (var "i_1") "%") 0)))
(call "signed_" (exp (var "N")) (exp (proj (uncase (var "i_2") "%") 0)))
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_2")
else
)
)
(def
"imax_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_1")
(if
(cmp
ge
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_2")
(if
(cmp
lt
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_1")
(if
(cmp
ge
int
(call "signed_" (exp (var "N")) (exp (proj (uncase (var "i_1") "%") 0)))
(call "signed_" (exp (var "N")) (exp (proj (uncase (var "i_2") "%") 0)))
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(var "i_2")
else
)
)
(def
"iadd_sat_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"sat_u_"
(exp (var "N"))
(exp
(cvt
nat
int
(bin
add
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp
(call
"sat_s_"
(exp (var "N"))
(exp
(bin
add
int
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
)
)
(def
"isub_sat_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"sat_u_"
(exp (var "N"))
(exp
(bin
sub
int
(cvt nat int (proj (uncase (var "i_1") "%") 0))
(cvt nat int (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp
(call
"sat_s_"
(exp (var "N"))
(exp
(bin
sub
int
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
)
)
(def
"iq15mulr_sat_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"irelaxed_q15mulr_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) list)
)
(def
"iavgr_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"inot_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"irev_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"iand_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"iandnot_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"ior_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"ixor_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"ishl_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "u32" (var "u32"))
(var "iN" (exp (var "N")))
)
(def
"ishr_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "u32" (var "u32"))
(var "iN" (exp (var "N")))
)
(def
"irotl_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"irotr_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"ibitselect_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(def
"irelaxed_laneselect_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) list)
)
(def
"ieqz_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(case
"%"
(tup
(call
"bool"
(exp (cmp eq bool (proj (uncase (var "i_1") "%") 0) (num (nat 0))))
)
)
)
)
)
(def
"inez_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(case
"%"
(tup
(call
"bool"
(exp (cmp ne bool (proj (uncase (var "i_1") "%") 0) (num (nat 0))))
)
)
)
)
)
(def
"ieq_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(exp (var "i_2"))
(case "%" (tup (call "bool" (exp (cmp eq bool (var "i_1") (var "i_2"))))))
)
)
(def
"ine_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (var "i_1"))
(exp (var "i_2"))
(case "%" (tup (call "bool" (exp (cmp ne bool (var "i_1") (var "i_2"))))))
)
)
(def
"ilt_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
lt
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
lt
int
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
(def
"igt_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
gt
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
gt
int
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
(def
"ile_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
le
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
le
int
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
(def
"ige_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "U" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
ge
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
)
)
)
(clause
(exp "N" (var "N"))
(exp "i_1" (var "iN" (exp (var "N"))))
(exp "i_2" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(case
"%"
(tup
(call
"bool"
(exp
(cmp
ge
int
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_1") "%") 0))
)
(call
"signed_"
(exp (var "N"))
(exp (proj (uncase (var "i_2") "%") 0))
)
)
)
)
)
)
)
)
(def
"fabs_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fneg_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fsqrt_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fceil_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"ffloor_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"ftrunc_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fnearest_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fadd_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fsub_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fmul_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fdiv_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fmin_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fmax_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fpmin_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fpmax_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"frelaxed_min_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"frelaxed_max_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"fcopysign_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"feq_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(def
"fne_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(def
"flt_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(def
"fgt_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(def
"fle_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(def
"fge_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(def
"frelaxed_madd_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"frelaxed_nmadd_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"wrap__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "M"))))
(var "iN" (exp (var "N")))
)
(def
"extend__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "M"))))
(var "iN" (exp (var "N")))
)
(def
"trunc__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "fN" (var "fN" (exp (var "M"))))
(iter (var "iN" (exp (var "N"))) opt)
)
(def
"trunc_sat__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "fN" (var "fN" (exp (var "M"))))
(iter (var "iN" (exp (var "N"))) opt)
)
(def
"relaxed_trunc__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "fN" (var "fN" (exp (var "M"))))
(iter (var "iN" (exp (var "N"))) opt)
)
(def
"demote__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "M"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"promote__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "M"))))
(iter (var "fN" (exp (var "N"))) list)
)
(def
"convert__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "M"))))
(var "fN" (exp (var "N")))
)
(def
"narrow__"
(exp "M" (var "M"))
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "M"))))
(var "iN" (exp (var "N")))
)
(def
"reinterpret__"
(exp "numtype_1" (var "numtype"))
(exp "numtype_2" (var "numtype"))
(exp "num_" (var "num_" (exp (var "numtype_1"))))
(var "num_" (exp (var "numtype_2")))
)
(def
"lpacknum_"
(exp "lanetype" (var "lanetype"))
(exp "num_" (var "num_" (exp (call "lunpack" (exp (var "lanetype"))))))
(var "lane_" (exp (var "lanetype")))
(clause
(exp "numtype" (var "numtype"))
(exp
"c"
(var
"num_"
(exp
(call
"lunpack"
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
)
)
)
)
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
(exp (var "c"))
(var "c")
)
(clause
(exp "packtype" (var "packtype"))
(exp
"c"
(var
"num_"
(exp
(call
"lunpack"
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
)
)
)
)
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
(exp (var "c"))
(call
"wrap__"
(exp
(call
"size"
(exp
(call
"lunpack"
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
)
)
)
)
(exp (call "psize" (exp (var "packtype"))))
(exp (var "c"))
)
)
)
(def
"cpacknum_"
(exp "storagetype" (var "storagetype"))
(exp
"lit_"
(var
"lit_"
(exp
(sub
(var "consttype")
(var "storagetype")
(call "cunpack" (exp (var "storagetype")))
)
)
)
)
(var "lit_" (exp (var "storagetype")))
(clause
(exp "consttype" (var "consttype"))
(exp
"c"
(var
"lit_"
(exp
(sub
(var "consttype")
(var "storagetype")
(call
"cunpack"
(exp
(sub (var "consttype") (var "storagetype") (var "consttype"))
)
)
)
)
)
)
(exp (sub (var "consttype") (var "storagetype") (var "consttype")))
(exp (var "c"))
(var "c")
)
(clause
(exp "packtype" (var "packtype"))
(exp
"c"
(var
"lit_"
(exp
(sub
(var "consttype")
(var "storagetype")
(call
"cunpack"
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
)
)
)
)
)
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(exp (var "c"))
(call
"wrap__"
(exp
(call
"size"
(exp
(call
"lunpack"
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
)
)
)
)
(exp (call "psize" (exp (var "packtype"))))
(exp (var "c"))
)
)
)
(def
"lunpacknum_"
(exp "lanetype" (var "lanetype"))
(exp "lane_" (var "lane_" (exp (var "lanetype"))))
(var "num_" (exp (call "lunpack" (exp (var "lanetype")))))
(clause
(exp "numtype" (var "numtype"))
(exp
"c"
(var "lane_" (exp (sub (var "numtype") (var "lanetype") (var "numtype"))))
)
(exp (sub (var "numtype") (var "lanetype") (var "numtype")))
(exp (var "c"))
(var "c")
)
(clause
(exp "packtype" (var "packtype"))
(exp
"c"
(var
"lane_"
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
)
)
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
(exp (var "c"))
(call
"extend__"
(exp (call "psize" (exp (var "packtype"))))
(exp
(call
"size"
(exp
(call
"lunpack"
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
)
)
)
)
(exp (case "U" (tup)))
(exp (var "c"))
)
)
)
(def
"cunpacknum_"
(exp "storagetype" (var "storagetype"))
(exp "lit_" (var "lit_" (exp (var "storagetype"))))
(var
"lit_"
(exp
(sub
(var "consttype")
(var "storagetype")
(call "cunpack" (exp (var "storagetype")))
)
)
)
(clause
(exp "consttype" (var "consttype"))
(exp
"c"
(var
"lit_"
(exp (sub (var "consttype") (var "storagetype") (var "consttype")))
)
)
(exp (sub (var "consttype") (var "storagetype") (var "consttype")))
(exp (var "c"))
(var "c")
)
(clause
(exp "packtype" (var "packtype"))
(exp
"c"
(var
"lit_"
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
)
)
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(exp (var "c"))
(call
"extend__"
(exp (call "psize" (exp (var "packtype"))))
(exp
(call
"size"
(exp
(call
"lunpack"
(exp (sub (var "packtype") (var "lanetype") (var "packtype")))
)
)
)
)
(exp (case "U" (tup)))
(exp (var "c"))
)
)
)
(def
"unop_"
(exp "numtype" (var "numtype"))
(exp "unop_" (var "unop_" (exp (var "numtype"))))
(exp "num_" (var "num_" (exp (var "numtype"))))
(iter (var "num_" (exp (var "numtype"))) list)
(clause
(exp "Inn" (var "Inn"))
(exp "i" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "CLZ" (tup)))
(exp (var "i"))
(list
(call
"iclz_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "CTZ" (tup)))
(exp (var "i"))
(list
(call
"ictz_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "POPCNT" (tup)))
(exp (var "i"))
(list
(call
"ipopcnt_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "M" (var "M"))
(exp "i" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "EXTEND%" (tup (case "%" (tup (var "M"))))))
(exp (var "i"))
(list
(call
"iextend_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "M"))
(exp (case "S" (tup)))
(exp (var "i"))
)
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "ABS" (tup)))
(exp (var "f"))
(call
"fabs_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "NEG" (tup)))
(exp (var "f"))
(call
"fneg_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "SQRT" (tup)))
(exp (var "f"))
(call
"fsqrt_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "CEIL" (tup)))
(exp (var "f"))
(call
"fceil_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "FLOOR" (tup)))
(exp (var "f"))
(call
"ffloor_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "TRUNC" (tup)))
(exp (var "f"))
(call
"ftrunc_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "NEAREST" (tup)))
(exp (var "f"))
(call
"fnearest_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f"))
)
)
)
(def
"binop_"
(exp "numtype" (var "numtype"))
(exp "binop_" (var "binop_" (exp (var "numtype"))))
(exp "num_" (var "num_" (exp (var "numtype"))))
(exp "num_" (var "num_" (exp (var "numtype"))))
(iter (var "num_" (exp (var "numtype"))) list)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "ADD" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"iadd_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "SUB" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"isub_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "MUL" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"imul_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "DIV%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(lift
(call
"idiv_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "sx"))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "REM%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(lift
(call
"irem_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "sx"))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "AND" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"iand_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "OR" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"ior_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "XOR" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"ixor_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "SHL" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"ishl_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (case "%" (tup (proj (uncase (var "i_2") "%") 0))))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "SHR%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"ishr_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "sx"))
(exp (var "i_1"))
(exp (case "%" (tup (proj (uncase (var "i_2") "%") 0))))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "ROTL" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"irotl_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "ROTR" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(list
(call
"irotr_"
(exp
(call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn"))))
)
(exp (var "i_1"))
(exp (var "i_2"))
)
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "ADD" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fadd_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "SUB" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fsub_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "MUL" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fmul_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "DIV" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fdiv_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "MIN" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fmin_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "MAX" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fmax_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "COPYSIGN" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fcopysign_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
)
(def
"testop_"
(exp "numtype" (var "numtype"))
(exp "testop_" (var "testop_" (exp (var "numtype"))))
(exp "num_" (var "num_" (exp (var "numtype"))))
(var "u32")
(clause
(exp "Inn" (var "Inn"))
(exp "i" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "EQZ" (tup)))
(exp (var "i"))
(call
"ieqz_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "i"))
)
)
)
(def
"relop_"
(exp "numtype" (var "numtype"))
(exp "relop_" (var "relop_" (exp (var "numtype"))))
(exp "num_" (var "num_" (exp (var "numtype"))))
(exp "num_" (var "num_" (exp (var "numtype"))))
(var "u32")
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "EQ" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(call
"ieq_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "NE" (tup)))
(exp (var "i_1"))
(exp (var "i_2"))
(call
"ine_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "LT%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(call
"ilt_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "sx"))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "GT%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(call
"igt_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "sx"))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "LE%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(call
"ile_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "sx"))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
(clause
(exp "Inn" (var "Inn"))
(exp "sx" (var "sx"))
(exp "i_1" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "i_2" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
(exp (case "GE%" (tup (var "sx"))))
(exp (var "i_1"))
(exp (var "i_2"))
(call
"ige_"
(exp (call "sizenn" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp (var "sx"))
(exp (var "i_1"))
(exp (var "i_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "EQ" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"feq_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "NE" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fne_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "LT" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"flt_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "GT" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fgt_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "LE" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fle_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "f_1" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp "f_2" (var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
(exp (case "GE" (tup)))
(exp (var "f_1"))
(exp (var "f_2"))
(call
"fge_"
(exp (call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn")))))
(exp (var "f_1"))
(exp (var "f_2"))
)
)
)
(def
"cvtop__"
(exp "numtype_1" (var "numtype"))
(exp "numtype_2" (var "numtype"))
(exp
"cvtop__"
(var "cvtop__" (exp (var "numtype_1")) (exp (var "numtype_2")))
)
(exp "num_" (var "num_" (exp (var "numtype_1"))))
(iter (var "num_" (exp (var "numtype_2"))) list)
(clause
(exp "Inn_1" (var "Inn"))
(exp "Inn_2" (var "Inn"))
(exp "sx" (var "sx"))
(exp
"i_1"
(var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(exp (case "EXTEND%" (tup (var "sx"))))
(exp (var "i_1"))
(list
(call
"extend__"
(exp
(call "sizenn1" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Inn") (var "numtype") (var "Inn_2"))))
)
(exp (var "sx"))
(exp (var "i_1"))
)
)
)
(clause
(exp "Inn_1" (var "Inn"))
(exp "Inn_2" (var "Inn"))
(exp
"i_1"
(var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(exp (case "WRAP" (tup)))
(exp (var "i_1"))
(list
(call
"wrap__"
(exp
(call "sizenn1" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Inn") (var "numtype") (var "Inn_2"))))
)
(exp (var "i_1"))
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "Inn_2" (var "Inn"))
(exp "sx" (var "sx"))
(exp
"f_1"
(var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(exp (case "TRUNC%" (tup (var "sx"))))
(exp (var "f_1"))
(lift
(call
"trunc__"
(exp
(call "sizenn1" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Inn") (var "numtype") (var "Inn_2"))))
)
(exp (var "sx"))
(exp (var "f_1"))
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "Inn_2" (var "Inn"))
(exp "sx" (var "sx"))
(exp
"f_1"
(var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(exp (case "TRUNC_SAT%" (tup (var "sx"))))
(exp (var "f_1"))
(lift
(call
"trunc_sat__"
(exp
(call "sizenn1" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Inn") (var "numtype") (var "Inn_2"))))
)
(exp (var "sx"))
(exp (var "f_1"))
)
)
)
(clause
(exp "Inn_1" (var "Inn"))
(exp "Fnn_2" (var "Fnn"))
(exp "sx" (var "sx"))
(exp
"i_1"
(var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(exp (case "CONVERT%" (tup (var "sx"))))
(exp (var "i_1"))
(list
(call
"convert__"
(exp
(call "sizenn1" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_2"))))
)
(exp (var "sx"))
(exp (var "i_1"))
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "Fnn_2" (var "Fnn"))
(exp
"f_1"
(var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(exp (case "PROMOTE" (tup)))
(exp (var "f_1"))
(call
"promote__"
(exp
(call "sizenn1" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_2"))))
)
(exp (var "f_1"))
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "Fnn_2" (var "Fnn"))
(exp
"f_1"
(var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(exp (case "DEMOTE" (tup)))
(exp (var "f_1"))
(call
"demote__"
(exp
(call "sizenn1" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp
(call "sizenn2" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_2"))))
)
(exp (var "f_1"))
)
)
(clause
(exp "Inn_1" (var "Inn"))
(exp "Fnn_2" (var "Fnn"))
(exp
"i_1"
(var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
)
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(exp (case "REINTERPRET" (tup)))
(exp (var "i_1"))
(list
(call
"reinterpret__"
(exp (sub (var "Inn") (var "numtype") (var "Inn_1")))
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_2")))
(exp (var "i_1"))
)
)
(if
(cmp
eq
bool
(call "size" (exp (sub (var "Inn") (var "numtype") (var "Inn_1"))))
(call "size" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_2"))))
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "Inn_2" (var "Inn"))
(exp
"f_1"
(var "num_" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
)
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(exp (case "REINTERPRET" (tup)))
(exp (var "f_1"))
(list
(call
"reinterpret__"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn_1")))
(exp (sub (var "Inn") (var "numtype") (var "Inn_2")))
(exp (var "f_1"))
)
)
(if
(cmp
eq
bool
(call "size" (exp (sub (var "Fnn") (var "numtype") (var "Fnn_1"))))
(call "size" (exp (sub (var "Inn") (var "numtype") (var "Inn_2"))))
)
)
)
)
(def
"lanes_"
(exp "shape" (var "shape"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "lane_" (exp (call "lanetype" (exp (var "shape"))))) list)
)
(def
"inv_lanes_"
(exp "shape" (var "shape"))
(exp
"_"
(iter (var "lane_" (exp (call "lanetype" (exp (var "shape"))))) list)
)
(var "vec_" (exp (case "V128" (tup))))
)
(def
"zeroop"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp "vcvtop__" (var "vcvtop__" (exp (var "shape_1")) (exp (var "shape_2"))))
(iter (var "zero") opt)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "half" (var "half"))
(exp "sx" (var "sx"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "EXTEND%%" (tup (var "half") (var "sx"))))
(opt)
)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp "half?" (iter (var "half") opt))
(exp "sx" (var "sx"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"CONVERT%%"
(tup (iter (var "half") opt (dom "half" (var "half?"))) (var "sx"))
)
)
(opt)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"TRUNC_SAT%%"
(tup (var "sx") (iter (var "zero") opt (dom "zero" (var "zero?"))))
)
)
(iter (var "zero") opt (dom "zero" (var "zero?")))
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"RELAXED_TRUNC%%"
(tup (var "sx") (iter (var "zero") opt (dom "zero" (var "zero?"))))
)
)
(iter (var "zero") opt (dom "zero" (var "zero?")))
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp "zero" (var "zero"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "DEMOTE%" (tup (var "zero"))))
(opt (var "zero"))
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "PROMOTELOW" (tup)))
(opt)
)
)
(def
"halfop"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp "vcvtop__" (var "vcvtop__" (exp (var "shape_1")) (exp (var "shape_2"))))
(iter (var "half") opt)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "half" (var "half"))
(exp "sx" (var "sx"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "EXTEND%%" (tup (var "half") (var "sx"))))
(opt (var "half"))
)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp "half?" (iter (var "half") opt))
(exp "sx" (var "sx"))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"CONVERT%%"
(tup (iter (var "half") opt (dom "half" (var "half?"))) (var "sx"))
)
)
(iter (var "half") opt (dom "half" (var "half?")))
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"TRUNC_SAT%%"
(tup (var "sx") (iter (var "zero") opt (dom "zero" (var "zero?"))))
)
)
(opt)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"RELAXED_TRUNC%%"
(tup (var "sx") (iter (var "zero") opt (dom "zero" (var "zero?"))))
)
)
(opt)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp "zero" (var "zero"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "DEMOTE%" (tup (var "zero"))))
(opt)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "PROMOTELOW" (tup)))
(opt (case "LOW" (tup)))
)
)
(def
"half"
(exp "half" (var "half"))
(exp "nat" nat)
(exp "nat" nat)
nat
(clause
(exp "i" nat)
(exp "j" nat)
(exp (case "LOW" (tup)))
(exp (var "i"))
(exp (var "j"))
(var "i")
)
(clause
(exp "i" nat)
(exp "j" nat)
(exp (case "HIGH" (tup)))
(exp (var "i"))
(exp (var "j"))
(var "j")
)
)
(def
"iswizzle_lane_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "c*" (iter (var "iN" (exp (var "N"))) list))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (iter (var "c") list (dom "c" (var "c*"))))
(exp (var "i"))
(idx
(iter (var "c") list (dom "c" (var "c*")))
(proj (uncase (var "i") "%") 0)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(len (iter (var "c") list (dom "c" (var "c*"))))
)
)
)
(clause
(exp "N" (var "N"))
(exp "c*" (iter (var "iN" (exp (var "N"))) list))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (iter (var "c") list (dom "c" (var "c*"))))
(exp (var "i"))
(case "%" (tup (num (nat 0))))
else
)
)
(def
"irelaxed_swizzle_lane_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
(clause
(exp "N" (var "N"))
(exp "c*" (iter (var "iN" (exp (var "N"))) list))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (iter (var "c") list (dom "c" (var "c*"))))
(exp (var "i"))
(idx
(iter (var "c") list (dom "c" (var "c*")))
(proj (uncase (var "i") "%") 0)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(len (iter (var "c") list (dom "c" (var "c*"))))
)
)
)
(clause
(exp "N" (var "N"))
(exp "c*" (iter (var "iN" (exp (var "N"))) list))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (iter (var "c") list (dom "c" (var "c*"))))
(exp (var "i"))
(case "%" (tup (num (nat 0))))
(if
(cmp
lt
int
(call "signed_" (exp (var "N")) (exp (proj (uncase (var "i") "%") 0)))
(cvt nat int (num (nat 0)))
)
)
)
(clause
(exp "N" (var "N"))
(exp "c*" (iter (var "iN" (exp (var "N"))) list))
(exp "i" (var "iN" (exp (var "N"))))
(exp (var "N"))
(exp (iter (var "c") list (dom "c" (var "c*"))))
(exp (var "i"))
(call
"relaxed2"
(exp (call "R_swizzle"))
(typ (var "iN" (exp (var "N"))))
(exp (case "%" (tup (num (nat 0)))))
(exp
(idx
(iter (var "c") list (dom "c" (var "c*")))
(bin
mod
nat
(proj (uncase (var "i") "%") 0)
(len (iter (var "c") list (dom "c" (var "c*"))))
)
)
)
)
else
)
)
(def
"ivunop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(list
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
)
)
(def
"fvunop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c**"
(iter
(iter
(var "lane_" (exp (sub (var "Fnn") (var "lanetype") (var "Fnn"))))
list
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(iter
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ
(var "lane_" (exp (sub (var "Fnn") (var "lanetype") (var "Fnn"))))
)
(exp
(iter
(call
"f_"
(exp
(call
"sizenn"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
)
)
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
)
)
)
)
(def
"ivbinop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(list
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "c_1"))
(exp (var "c_2"))
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
)
)
(def
"ivbinopsx_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "sx" (var "sx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
(list
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
(exp (var "c_2"))
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
)
)
(def
"ivbinopsxnd_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "sx" (var "sx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c**"
(iter
(iter
(var "lane_" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
list
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
(iter
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ
(var "lane_" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
)
(exp
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
(exp (var "c_2"))
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
)
)
)
)
(def
"fvbinop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c**"
(iter
(iter
(var "lane_" (exp (sub (var "Fnn") (var "lanetype") (var "Fnn"))))
list
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(iter
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ
(var "lane_" (exp (sub (var "Fnn") (var "lanetype") (var "Fnn"))))
)
(exp
(iter
(call
"f_"
(exp
(call
"sizenn"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
)
)
(exp (var "c_1"))
(exp (var "c_2"))
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
)
)
)
)
(def
"ivternopnd_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_3" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c**"
(iter
(iter
(var "lane_" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
list
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_3*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
(iter
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_3") list (dom "c_3" (var "c_3*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_3"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ
(var "lane_" (exp (sub (var "Jnn") (var "lanetype") (var "Jnn"))))
)
(exp
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
(dom "c_3" (var "c_3*"))
)
)
)
)
)
)
)
(def
"fvternop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(iter (var "fN" (exp (var "N"))) list)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_3" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c**"
(iter
(iter
(var "lane_" (exp (sub (var "Fnn") (var "lanetype") (var "Fnn"))))
list
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_3*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
(iter
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_3") list (dom "c_3" (var "c_3*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_3"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ
(var "lane_" (exp (sub (var "Fnn") (var "lanetype") (var "Fnn"))))
)
(exp
(iter
(call
"f_"
(exp
(call
"sizenn"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
)
)
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
(dom "c_3" (var "c_3*"))
)
)
)
)
)
)
)
(def
"ivrelop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"extend__"
(exp (num (nat 1)))
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (case "S" (tup)))
(exp
(case
"%"
(tup
(proj
(uncase
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "c_1"))
(exp (var "c_2"))
)
"%"
)
0
)
)
)
)
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
)
)
(def
"ivrelopsx_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
)
(exp "sx" (var "sx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "iN" (var "iN" (exp (var "N"))))
(var "u32")
)
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"extend__"
(exp (num (nat 1)))
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (case "S" (tup)))
(exp
(case
"%"
(tup
(proj
(uncase
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
(exp (var "c_2"))
)
"%"
)
0
)
)
)
)
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
)
)
(def
"fvrelop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "fN" (var "fN" (exp (var "N"))))
(exp "fN" (var "fN" (exp (var "N"))))
(var "u32")
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "Inn" (var "Inn"))
(exp
"c*"
(iter
(var
"iN"
(exp
(call "sizenn" (exp (sub (var "Fnn") (var "numtype") (var "Fnn"))))
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Inn") (var "lanetype") (var "Inn"))
(case "%" (tup (var "M")))
)
)
)
(exp
(iter
(case "%" (tup (proj (uncase (var "c") "%") 0)))
list
(dom "c" (var "c*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"extend__"
(exp (num (nat 1)))
(exp
(call
"sizenn"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
)
)
(exp (case "S" (tup)))
(exp
(case
"%"
(tup
(proj
(uncase
(call
"f_"
(exp
(call
"sizenn"
(exp (sub (var "Fnn") (var "numtype") (var "Fnn")))
)
)
(exp (var "c_1"))
(exp (var "c_2"))
)
"%"
)
0
)
)
)
)
)
list
(dom "c_1" (var "c_1*"))
(dom "c_2" (var "c_2*"))
)
)
)
(if
(cmp
eq
bool
(call "isize" (exp (var "Inn")))
(call "fsize" (exp (var "Fnn")))
)
)
)
)
(def
"ivshiftop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "u32" (var "u32"))
(var "iN" (exp (var "N")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "u32" (var "u32"))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "u32" (var "u32"))
(var "iN" (exp (var "N")))
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "i" (var "u32"))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "i"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "c_1"))
(exp (var "i"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
)
)
(def
"ivshiftopsx_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "u32" (var "u32"))
(var "iN" (exp (var "N")))
)
(exp "sx" (var "sx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "u32" (var "u32"))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "sx" (var "sx"))
(exp "iN" (var "iN" (exp (var "N"))))
(exp "u32" (var "u32"))
(var "iN" (exp (var "N")))
)
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "i" (var "u32"))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "i"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
(exp (var "i"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
)
)
(def
"ivbitmaskop_"
(exp "shape" (var "shape"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "u32")
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c" (var "iN" (exp (num (nat 32)))))
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
(call "irev_" (exp (num (nat 32))) (exp (var "c")))
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(call "ibits_" (exp (num (nat 32))) (exp (var "c")))
(cat
(iter
(case
"%"
(tup
(proj
(uncase
(call
"ilt_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (case "S" (tup)))
(exp (var "c_1"))
(exp (case "%" (tup (num (nat 0)))))
)
"%"
)
0
)
)
)
list
(dom "c_1" (var "c_1*"))
)
(iter
(case "%" (tup (num (nat 0))))
(listn
(cvt
int
nat
(bin
sub
int
(cvt nat int (num (nat 32)))
(cvt nat int (var "M"))
)
)
)
)
)
)
)
)
)
(def
"ivswizzlop_"
(exp "shape" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "iN" (var "iN" (exp (var "N"))))
(var "iN" (exp (var "N")))
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "f_")
(exp (var "v_1"))
(exp (var "v_2"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(call
"f_"
(exp
(call
"lsizenn"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn")))
)
)
(exp (iter (var "c_1") list (dom "c_1" (var "c_1*"))))
(exp (var "c_2"))
)
list
(dom "c_2" (var "c_2*"))
)
)
)
)
)
(def
"ivshufflop_"
(exp "shape" (var "shape"))
(exp "_" (iter (var "laneidx") list))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "i*" (iter (var "laneidx") list))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "i") list (dom "i" (var "i*"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(iter
(idx
(cat
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
)
(proj (uncase (var "i") "%") 0)
)
list
(dom "i" (var "i*"))
)
)
)
)
)
(def
"vvunop_"
(exp "vectype" (var "vectype"))
(exp "vvunop" (var "vvunop"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(iter (var "vec_" (exp (var "vectype"))) list)
(clause
(exp "Vnn" (var "Vnn"))
(exp "v" (var "vec_" (exp (var "Vnn"))))
(exp (var "Vnn"))
(exp (case "NOT" (tup)))
(exp (var "v"))
(list
(call "inot_" (exp (call "vsizenn" (exp (var "Vnn")))) (exp (var "v")))
)
)
)
(def
"vvbinop_"
(exp "vectype" (var "vectype"))
(exp "vvbinop" (var "vvbinop"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(iter (var "vec_" (exp (var "vectype"))) list)
(clause
(exp "Vnn" (var "Vnn"))
(exp "v_1" (var "vec_" (exp (var "Vnn"))))
(exp "v_2" (var "vec_" (exp (var "Vnn"))))
(exp (var "Vnn"))
(exp (case "AND" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(list
(call
"iand_"
(exp (call "vsizenn" (exp (var "Vnn"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(clause
(exp "Vnn" (var "Vnn"))
(exp "v_1" (var "vec_" (exp (var "Vnn"))))
(exp "v_2" (var "vec_" (exp (var "Vnn"))))
(exp (var "Vnn"))
(exp (case "ANDNOT" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(list
(call
"iandnot_"
(exp (call "vsizenn" (exp (var "Vnn"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(clause
(exp "Vnn" (var "Vnn"))
(exp "v_1" (var "vec_" (exp (var "Vnn"))))
(exp "v_2" (var "vec_" (exp (var "Vnn"))))
(exp (var "Vnn"))
(exp (case "OR" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(list
(call
"ior_"
(exp (call "vsizenn" (exp (var "Vnn"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(clause
(exp "Vnn" (var "Vnn"))
(exp "v_1" (var "vec_" (exp (var "Vnn"))))
(exp "v_2" (var "vec_" (exp (var "Vnn"))))
(exp (var "Vnn"))
(exp (case "XOR" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(list
(call
"ixor_"
(exp (call "vsizenn" (exp (var "Vnn"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
)
(def
"vvternop_"
(exp "vectype" (var "vectype"))
(exp "vvternop" (var "vvternop"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(iter (var "vec_" (exp (var "vectype"))) list)
(clause
(exp "Vnn" (var "Vnn"))
(exp "v_1" (var "vec_" (exp (var "Vnn"))))
(exp "v_2" (var "vec_" (exp (var "Vnn"))))
(exp "v_3" (var "vec_" (exp (var "Vnn"))))
(exp (var "Vnn"))
(exp (case "BITSELECT" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
(list
(call
"ibitselect_"
(exp (call "vsizenn" (exp (var "Vnn"))))
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
)
)
)
)
(def
"vunop_"
(exp "shape" (var "shape"))
(exp "vunop_" (var "vunop_" (exp (var "shape"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "ABS" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fabs_")
(exp (var "v"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "NEG" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fneg_")
(exp (var "v"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "SQRT" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fsqrt_")
(exp (var "v"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "CEIL" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fceil_")
(exp (var "v"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "FLOOR" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ffloor_")
(exp (var "v"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "TRUNC" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ftrunc_")
(exp (var "v"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "NEAREST" (tup)))
(exp (var "v"))
(call
"fvunop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fnearest_")
(exp (var "v"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "ABS" (tup)))
(exp (var "v"))
(call
"ivunop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "iabs_")
(exp (var "v"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "NEG" (tup)))
(exp (var "v"))
(call
"ivunop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ineg_")
(exp (var "v"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "POPCNT" (tup)))
(exp (var "v"))
(call
"ivunop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ipopcnt_")
(exp (var "v"))
)
)
)
(def
"vbinop_"
(exp "shape" (var "shape"))
(exp "vbinop_" (var "vbinop_" (exp (var "shape"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "ADD" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "iadd_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "SUB" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "isub_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "MUL" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "imul_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "ADD_SAT%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "iadd_sat_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "SUB_SAT%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "isub_sat_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "MIN%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "imin_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "MAX%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "imax_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "AVGRU" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "iavgr_")
(exp (case "U" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "Q15MULR_SATS" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "iq15mulr_sat_")
(exp (case "S" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "RELAXED_Q15MULRS" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivbinopsxnd_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "irelaxed_q15mulr_")
(exp (case "S" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "ADD" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fadd_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "SUB" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fsub_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "MUL" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fmul_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "DIV" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fdiv_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "MIN" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fmin_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "MAX" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fmax_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "PMIN" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fpmin_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "PMAX" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fpmax_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "RELAXED_MIN" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "frelaxed_min_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "RELAXED_MAX" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "frelaxed_max_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(def
"vternop_"
(exp "shape" (var "shape"))
(exp "vternop_" (var "vternop_" (exp (var "shape"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(iter (var "vec_" (exp (case "V128" (tup)))) list)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_3" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "RELAXED_LANESELECT" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
(call
"ivternopnd_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "irelaxed_laneselect_")
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_3" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "RELAXED_MADD" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
(call
"fvternop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "frelaxed_madd_")
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_3" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "RELAXED_NMADD" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
(call
"fvternop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "frelaxed_nmadd_")
(exp (var "v_1"))
(exp (var "v_2"))
(exp (var "v_3"))
)
)
)
(def
"vrelop_"
(exp "shape" (var "shape"))
(exp "vrelop_" (var "vrelop_" (exp (var "shape"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "EQ" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ieq_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "NE" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ine_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "LT%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivrelopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ilt_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "GT%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivrelopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "igt_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "LE%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivrelopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ile_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "GE%" (tup (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivrelopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ige_")
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "EQ" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "feq_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "NE" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fne_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "LT" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "flt_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "GT" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fgt_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "LE" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fle_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Fnn" (var "Fnn"))
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (case "GE" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"fvrelop_"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn"))
(case "%" (tup (var "M")))
)
)
)
(def "fge_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(def
"lcvtop__"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp "vcvtop__" (var "vcvtop__" (exp (var "shape_1")) (exp (var "shape_2"))))
(exp "lane_" (var "lane_" (exp (call "lanetype" (exp (var "shape_1"))))))
(iter (var "lane_" (exp (call "lanetype" (exp (var "shape_2"))))) list)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "half" (var "half"))
(exp "sx" (var "sx"))
(exp
"c_1"
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
)
(exp
"c"
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "EXTEND%%" (tup (var "half") (var "sx"))))
(exp (var "c_1"))
(list (var "c"))
(if
(cmp
eq
bool
(var "c")
(call
"extend__"
(exp
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
)
)
)
)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp "half?" (iter (var "half") opt))
(exp "sx" (var "sx"))
(exp
"c_1"
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
)
(exp
"c"
(var
"fN"
(exp
(call
"lsizenn2"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_2")))
)
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"CONVERT%%"
(tup (iter (var "half") opt (dom "half" (var "half?"))) (var "sx"))
)
)
(exp (var "c_1"))
(list (var "c"))
(if
(cmp
eq
bool
(var "c")
(call
"convert__"
(exp
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_2")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
)
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Inn_2" (var "Inn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(exp
"c_1"
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
)
(exp
"c?"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Inn") (var "lanetype") (var "Inn_2")))
)
)
)
opt
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Inn") (var "lanetype") (var "Inn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"TRUNC_SAT%%"
(tup (var "sx") (iter (var "zero") opt (dom "zero" (var "zero?"))))
)
)
(exp (var "c_1"))
(lift (iter (var "c") opt (dom "c" (var "c?"))))
(if
(cmp
eq
bool
(iter (var "c") opt (dom "c" (var "c?")))
(call
"trunc_sat__"
(exp
(call
"lsizenn1"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Inn") (var "lanetype") (var "Inn_2")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
)
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Inn_2" (var "Inn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "zero?" (iter (var "zero") opt))
(exp
"c_1"
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
)
(exp
"c?"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Inn") (var "lanetype") (var "Inn_2")))
)
)
)
opt
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Inn") (var "lanetype") (var "Inn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(case
"RELAXED_TRUNC%%"
(tup (var "sx") (iter (var "zero") opt (dom "zero" (var "zero?"))))
)
)
(exp (var "c_1"))
(lift (iter (var "c") opt (dom "c" (var "c?"))))
(if
(cmp
eq
bool
(iter (var "c") opt (dom "c" (var "c?")))
(call
"relaxed_trunc__"
(exp
(call
"lsizenn1"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Inn") (var "lanetype") (var "Inn_2")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
)
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp
"c_1"
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
)
(exp
"c*"
(iter
(var
"fN"
(exp
(call
"lsizenn2"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_2")))
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "DEMOTE%" (tup (case "ZERO" (tup)))))
(exp (var "c_1"))
(iter (var "c") list (dom "c" (var "c*")))
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(call
"demote__"
(exp
(call
"lsizenn1"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_2")))
)
)
(exp (var "c_1"))
)
)
)
)
(clause
(exp "Fnn_1" (var "Fnn"))
(exp "M_1" (var "M"))
(exp "Fnn_2" (var "Fnn"))
(exp "M_2" (var "M"))
(exp
"c_1"
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
)
(exp
"c*"
(iter
(var
"fN"
(exp
(call
"lsizenn2"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_2")))
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Fnn") (var "lanetype") (var "Fnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "PROMOTELOW" (tup)))
(exp (var "c_1"))
(iter (var "c") list (dom "c" (var "c*")))
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(call
"promote__"
(exp
(call
"lsizenn1"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Fnn") (var "lanetype") (var "Fnn_2")))
)
)
(exp (var "c_1"))
)
)
)
)
)
(def
"vcvtop__"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp "vcvtop__" (var "vcvtop__" (exp (var "shape_1")) (exp (var "shape_2"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Lnn_1" (var "Lnn"))
(exp "M" (var "M"))
(exp "Lnn_2" (var "Lnn"))
(exp
"vcvtop"
(var
"vcvtop__"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M"))))))
)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M"))))))
)
)
)
list
)
)
(exp "c**" (iter (iter (var "lane_" (exp (var "Lnn_2"))) list) list))
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M"))))))
(exp (var "vcvtop"))
(exp (var "v_1"))
(var "v")
(if
(bin
and
bool
(cmp
eq
bool
(call
"halfop"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M"))))))
(exp (var "vcvtop"))
)
(opt)
)
(cmp
eq
bool
(call
"zeroop"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M"))))))
(exp (var "vcvtop"))
)
(opt)
)
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M"))))))
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ (var "lane_" (exp (var "Lnn_2"))))
(exp
(iter
(call
"lcvtop__"
(exp
(case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M")))))
)
(exp
(case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M")))))
)
(exp (var "vcvtop"))
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
)
)
(if
(mem
(var "v")
(iter
(call
"inv_lanes_"
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M"))))))
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
)
)
)
(clause
(exp "Lnn_1" (var "Lnn"))
(exp "M_1" (var "M"))
(exp "Lnn_2" (var "Lnn"))
(exp "M_2" (var "M"))
(exp
"vcvtop"
(var
"vcvtop__"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp "half" (var "half"))
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1")))))
)
)
)
)
list
)
)
(exp "c**" (iter (iter (var "lane_" (exp (var "Lnn_2"))) list) list))
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
(exp (var "vcvtop"))
(exp (var "v_1"))
(var "v")
(if
(cmp
eq
bool
(call
"halfop"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
(exp (var "vcvtop"))
)
(opt (var "half"))
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(slice
(call
"lanes_"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (var "v_1"))
)
(call "half" (exp (var "half")) (exp (num (nat 0))) (exp (var "M_2")))
(var "M_2")
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ (var "lane_" (exp (var "Lnn_2"))))
(exp
(iter
(call
"lcvtop__"
(exp
(case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1")))))
)
(exp
(case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2")))))
)
(exp (var "vcvtop"))
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
)
)
(if
(mem
(var "v")
(iter
(call
"inv_lanes_"
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
)
)
)
(clause
(exp "Lnn_1" (var "Lnn"))
(exp "M_1" (var "M"))
(exp "Lnn_2" (var "Lnn"))
(exp "M_2" (var "M"))
(exp
"vcvtop"
(var
"vcvtop__"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
)
)
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1")))))
)
)
)
)
list
)
)
(exp "c**" (iter (iter (var "lane_" (exp (var "Lnn_2"))) list) list))
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
(exp (var "vcvtop"))
(exp (var "v_1"))
(var "v")
(if
(cmp
eq
bool
(call
"zeroop"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
(exp (var "vcvtop"))
)
(opt (case "ZERO" (tup)))
)
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp (case "%X%" (tup (var "Lnn_1") (case "%" (tup (var "M_1"))))))
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter
(iter (var "c") list (dom "c" (var "c*")))
list
(dom "c*" (var "c**"))
)
(call
"setproduct_"
(typ (var "lane_" (exp (var "Lnn_2"))))
(exp
(cat
(iter
(call
"lcvtop__"
(exp
(case
"%X%"
(tup (var "Lnn_1") (case "%" (tup (var "M_1"))))
)
)
(exp
(case
"%X%"
(tup (var "Lnn_2") (case "%" (tup (var "M_2"))))
)
)
(exp (var "vcvtop"))
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
(iter
(list (call "zero" (exp (var "Lnn_2"))))
(listn (var "M_1"))
)
)
)
)
)
)
(if
(mem
(var "v")
(iter
(call
"inv_lanes_"
(exp (case "%X%" (tup (var "Lnn_2") (case "%" (tup (var "M_2"))))))
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
list
(dom "c*" (var "c**"))
)
)
)
)
)
(def
"vshiftop_"
(exp "ishape" (var "ishape"))
(exp "vshiftop_" (var "vshiftop_" (exp (var "ishape"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "u32" (var "u32"))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp "i" (var "u32"))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
(exp (case "SHL" (tup)))
(exp (var "v"))
(exp (var "i"))
(call
"ivshiftop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ishl_")
(exp (var "v"))
(exp (var "i"))
)
)
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp "i" (var "u32"))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
(exp (case "SHR%" (tup (var "sx"))))
(exp (var "v"))
(exp (var "i"))
(call
"ivshiftopsx_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(def "ishr_")
(exp (var "sx"))
(exp (var "v"))
(exp (var "i"))
)
)
)
(def
"vbitmaskop_"
(exp "ishape" (var "ishape"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "u32")
(clause
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
(exp (var "v"))
(call
"ivbitmaskop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "v"))
)
)
)
(def
"vswizzlop_"
(exp "bshape" (var "bshape"))
(exp "vswizzlop_" (var "vswizzlop_" (exp (var "bshape"))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
)
)
(exp (case "SWIZZLE" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivswizzlop_"
(exp (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
(def "iswizzle_lane_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "M" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
)
)
(exp (case "RELAXED_SWIZZLE" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivswizzlop_"
(exp (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
(def "irelaxed_swizzle_lane_")
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(def
"vshufflop_"
(exp "bshape" (var "bshape"))
(exp "_" (iter (var "laneidx") list))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "M" (var "M"))
(exp "i*" (iter (var "laneidx") list))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
)
)
(exp (iter (var "i") list (dom "i" (var "i*"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivshufflop_"
(exp (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (var "M"))))))
(exp (iter (var "i") list (dom "i" (var "i*"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(def
"vnarrowop__"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(exp "sx" (var "sx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "v" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
list
)
)
(exp
"c'_1*"
(iter
(var
"iN"
(exp
(call
"lsize"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
"c'_2*"
(iter
(var
"iN"
(exp
(call
"lsize"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (var "sx"))
(exp (var "v_1"))
(exp (var "v_2"))
(var "v")
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp (var "v_2"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c'_1") list (dom "c'_1" (var "c'_1*")))
(iter
(call
"narrow__"
(exp
(call
"lsize"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsize"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c'_2") list (dom "c'_2" (var "c'_2*")))
(iter
(call
"narrow__"
(exp
(call
"lsize"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsize"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (var "sx"))
(exp (var "c_2"))
)
list
(dom "c_2" (var "c_2*"))
)
)
)
(if
(cmp
eq
bool
(var "v")
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp
(cat
(iter (var "c'_1") list (dom "c'_1" (var "c'_1*")))
(iter (var "c'_2") list (dom "c'_2" (var "c'_2*")))
)
)
)
)
)
)
)
(def
"ivadd_pairwise_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
(clause
(exp "N" (var "N"))
(exp "i*" (iter (var "iN" (exp (var "N"))) list))
(exp "j_1*" (iter (var "N") list))
(exp "j_2*" (iter (var "N") list))
(exp (var "N"))
(exp (iter (var "i") list (dom "i" (var "i*"))))
(iter
(call
"iadd_"
(exp (var "N"))
(exp (case "%" (tup (var "j_1"))))
(exp (case "%" (tup (var "j_2"))))
)
list
(dom "j_1" (var "j_1*"))
(dom "j_2" (var "j_2*"))
)
(if
(cmp
eq
bool
(call
"concat_"
(typ (var "N"))
(exp
(iter
(list (var "j_1") (var "j_2"))
list
(dom "j_1" (var "j_1*"))
(dom "j_2" (var "j_2*"))
)
)
)
(iter (proj (uncase (var "i") "%") 0) list (dom "i" (var "i*")))
)
)
)
)
(def
"ivextunop__"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "sx" (var "sx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
list
)
)
(exp
"c'_1*"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(def "f_")
(exp (var "sx"))
(exp (var "v_1"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp (var "v_1"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c'_1") list (dom "c'_1" (var "c'_1*")))
(iter
(call
"extend__"
(exp
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (var "sx"))
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(call
"f_"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (iter (var "c'_1") list (dom "c'_1" (var "c'_1*"))))
)
)
)
)
)
(def
"vextunop__"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextunop__"
(var "vextunop__" (exp (var "ishape_1")) (exp (var "ishape_2")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(exp (case "EXTADD_PAIRWISE%" (tup (var "sx"))))
(exp (var "v_1"))
(call
"ivextunop__"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(def "ivadd_pairwise_")
(exp (var "sx"))
(exp (var "v_1"))
)
)
)
(def
"ivdot_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
(clause
(exp "N" (var "N"))
(exp "i_1*" (iter (var "iN" (exp (var "N"))) list))
(exp "i_2*" (iter (var "iN" (exp (var "N"))) list))
(exp "j_1*" (iter (var "iN" (exp (var "N"))) list))
(exp "j_2*" (iter (var "iN" (exp (var "N"))) list))
(exp (var "N"))
(exp (iter (var "i_1") list (dom "i_1" (var "i_1*"))))
(exp (iter (var "i_2") list (dom "i_2" (var "i_2*"))))
(iter
(call "iadd_" (exp (var "N")) (exp (var "j_1")) (exp (var "j_2")))
list
(dom "j_1" (var "j_1*"))
(dom "j_2" (var "j_2*"))
)
(if
(cmp
eq
bool
(call
"concat_"
(typ (var "iN" (exp (var "N"))))
(exp
(iter
(list (var "j_1") (var "j_2"))
list
(dom "j_1" (var "j_1*"))
(dom "j_2" (var "j_2*"))
)
)
)
(iter
(call "imul_" (exp (var "N")) (exp (var "i_1")) (exp (var "i_2")))
list
(dom "i_1" (var "i_1*"))
(dom "i_2" (var "i_2*"))
)
)
)
)
)
(def
"ivdot_sat_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
(clause
(exp "N" (var "N"))
(exp "i_1*" (iter (var "iN" (exp (var "N"))) list))
(exp "i_2*" (iter (var "iN" (exp (var "N"))) list))
(exp "j_1*" (iter (var "iN" (exp (var "N"))) list))
(exp "j_2*" (iter (var "iN" (exp (var "N"))) list))
(exp (var "N"))
(exp (iter (var "i_1") list (dom "i_1" (var "i_1*"))))
(exp (iter (var "i_2") list (dom "i_2" (var "i_2*"))))
(iter
(call
"iadd_sat_"
(exp (var "N"))
(exp (case "S" (tup)))
(exp (var "j_1"))
(exp (var "j_2"))
)
list
(dom "j_1" (var "j_1*"))
(dom "j_2" (var "j_2*"))
)
(if
(cmp
eq
bool
(call
"concat_"
(typ (var "iN" (exp (var "N"))))
(exp
(iter
(list (var "j_1") (var "j_2"))
list
(dom "j_1" (var "j_1*"))
(dom "j_2" (var "j_2*"))
)
)
)
(iter
(call "imul_" (exp (var "N")) (exp (var "i_1")) (exp (var "i_2")))
list
(dom "i_1" (var "i_1*"))
(dom "i_2" (var "i_2*"))
)
)
)
)
)
(def
"ivextbinop__"
(exp "shape_1" (var "shape"))
(exp "shape_2" (var "shape"))
(def
"f_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "sx" (var "sx"))
(exp "sx" (var "sx"))
(exp "laneidx" (var "laneidx"))
(exp "laneidx" (var "laneidx"))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(def
"f_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
)
(exp "sx_1" (var "sx"))
(exp "sx_2" (var "sx"))
(exp "i" (var "laneidx"))
(exp "k" (var "laneidx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
"c*"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
"c_1*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
list
)
)
(exp
"c_2*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
)
list
)
)
(exp
"c'_1*"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
"c'_2*"
(iter
(var
"iN"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
)
list
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(def "f_")
(exp (var "sx_1"))
(exp (var "sx_2"))
(exp (var "i"))
(exp (var "k"))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (iter (var "c") list (dom "c" (var "c*"))))
)
(if
(cmp
eq
bool
(iter (var "c_1") list (dom "c_1" (var "c_1*")))
(slice
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp (var "v_1"))
)
(proj (uncase (var "i") "%") 0)
(proj (uncase (var "k") "%") 0)
)
)
)
(if
(cmp
eq
bool
(iter (var "c_2") list (dom "c_2" (var "c_2*")))
(slice
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp (var "v_2"))
)
(proj (uncase (var "i") "%") 0)
(proj (uncase (var "k") "%") 0)
)
)
)
(if
(cmp
eq
bool
(iter (var "c'_1") list (dom "c'_1" (var "c'_1*")))
(iter
(call
"extend__"
(exp
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (var "sx_1"))
(exp (var "c_1"))
)
list
(dom "c_1" (var "c_1*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c'_2") list (dom "c'_2" (var "c'_2*")))
(iter
(call
"extend__"
(exp
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (var "sx_2"))
(exp (var "c_2"))
)
list
(dom "c_2" (var "c_2*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "c") list (dom "c" (var "c*")))
(call
"f_"
(exp
(call
"lsizenn2"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_2")))
)
)
(exp (iter (var "c'_1") list (dom "c'_1" (var "c'_1*"))))
(exp (iter (var "c'_2") list (dom "c'_2" (var "c'_2*"))))
)
)
)
)
)
(def
"ivmul_"
(exp "N" (var "N"))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(exp "_" (iter (var "iN" (exp (var "N"))) list))
(iter (var "iN" (exp (var "N"))) list)
(clause
(exp "N" (var "N"))
(exp "i_1*" (iter (var "iN" (exp (var "N"))) list))
(exp "i_2*" (iter (var "iN" (exp (var "N"))) list))
(exp (var "N"))
(exp (iter (var "i_1") list (dom "i_1" (var "i_1*"))))
(exp (iter (var "i_2") list (dom "i_2" (var "i_2*"))))
(iter
(call "imul_" (exp (var "N")) (exp (var "i_1")) (exp (var "i_2")))
list
(dom "i_1" (var "i_1*"))
(dom "i_2" (var "i_2*"))
)
)
)
(def
"vextbinop__"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextbinop__"
(var "vextbinop__" (exp (var "ishape_1")) (exp (var "ishape_2")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "half" (var "half"))
(exp "sx" (var "sx"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(exp (case "EXTMUL%%" (tup (var "half") (var "sx"))))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivextbinop__"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(def "ivmul_")
(exp (var "sx"))
(exp (var "sx"))
(exp
(case
"%"
(tup
(call
"half"
(exp (var "half"))
(exp (num (nat 0)))
(exp (var "M_2"))
)
)
)
)
(exp (case "%" (tup (var "M_2"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(exp (case "DOTS" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivextbinop__"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(def "ivdot_")
(exp (case "S" (tup)))
(exp (case "S" (tup)))
(exp (case "%" (tup (num (nat 0)))))
(exp (case "%" (tup (var "M_1"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "v_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "v_2" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(exp (case "RELAXED_DOTS" (tup)))
(exp (var "v_1"))
(exp (var "v_2"))
(call
"ivextbinop__"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(def "ivdot_sat_")
(exp (case "S" (tup)))
(exp
(call
"relaxed2"
(exp (call "R_idot"))
(typ (var "sx"))
(exp (case "S" (tup)))
(exp (case "U" (tup)))
)
)
(exp (case "%" (tup (num (nat 0)))))
(exp (case "%" (tup (var "M_1"))))
(exp (var "v_1"))
(exp (var "v_2"))
)
)
)
(def
"vextternop__"
(exp "ishape_1" (var "ishape"))
(exp "ishape_2" (var "ishape"))
(exp
"vextternop__"
(var "vextternop__" (exp (var "ishape_1")) (exp (var "ishape_2")))
)
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(exp "vec_" (var "vec_" (exp (case "V128" (tup)))))
(var "vec_" (exp (case "V128" (tup))))
(clause
(exp "Jnn_1" (var "Jnn"))
(exp "M_1" (var "M"))
(exp "Jnn_2" (var "Jnn"))
(exp "M_2" (var "M"))
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_3" (var "vec_" (exp (case "V128" (tup)))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "c'" (var "vec_" (exp (case "V128" (tup)))))
(exp "c''" (var "vec_" (exp (case "V128" (tup)))))
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(exp (case "RELAXED_DOT_ADDS" (tup)))
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
(var "c")
(if
(cmp
eq
bool
(call "jsizenn" (exp (var "Jnn")))
(bin
mul
nat
(num (nat 2))
(call
"lsizenn1"
(exp (sub (var "Jnn") (var "lanetype") (var "Jnn_1")))
)
)
)
)
(if (cmp eq bool (var "M") (bin mul nat (num (nat 2)) (var "M_2"))))
(if
(cmp
eq
bool
(var "c'")
(call
"vextbinop__"
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_1"))
(case "%" (tup (var "M_1")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
(exp (case "RELAXED_DOTS" (tup)))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
(if
(cmp
eq
bool
(var "c''")
(call
"vextunop__"
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
(exp
(case
"%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
)
)
(exp (case "EXTADD_PAIRWISE%" (tup (case "S" (tup)))))
(exp (var "c'"))
)
)
)
(if
(mem
(var "c")
(call
"vbinop_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn_2"))
(case "%" (tup (var "M_2")))
)
)
)
(exp (case "ADD" (tup)))
(exp (var "c''"))
(exp (var "c_3"))
)
)
)
)
)
(typ
"num"
(inst
(variant
(case
"CONST%%"
(exp "numtype" (var "numtype"))
(exp "num_" (var "num_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "num_") (var "num_" (exp (var "numtype"))))
)
)
)
)
)
(typ
"vec"
(inst
(variant
(case
"VCONST%%"
(exp "vectype" (var "vectype"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vec_") (var "vec_" (exp (var "vectype"))))
)
)
)
)
)
(typ
"ref"
(inst
(variant
(case
"REF.I31_NUM%"
(exp "u31" (var "u31"))
(tup (bind (var "u31") (var "u31")))
)
(case
"REF.STRUCT_ADDR%"
(exp "structaddr" (var "structaddr"))
(tup (bind (var "structaddr") (var "structaddr")))
)
(case
"REF.ARRAY_ADDR%"
(exp "arrayaddr" (var "arrayaddr"))
(tup (bind (var "arrayaddr") (var "arrayaddr")))
)
(case
"REF.FUNC_ADDR%"
(exp "funcaddr" (var "funcaddr"))
(tup (bind (var "funcaddr") (var "funcaddr")))
)
(case
"REF.EXN_ADDR%"
(exp "exnaddr" (var "exnaddr"))
(tup (bind (var "exnaddr") (var "exnaddr")))
)
(case
"REF.HOST_ADDR%"
(exp "hostaddr" (var "hostaddr"))
(tup (bind (var "hostaddr") (var "hostaddr")))
)
(case
"REF.EXTERN%"
(exp "addrref" (var "addrref"))
(tup (bind (var "addrref") (var "addrref")))
)
(case
"REF.NULL%"
(exp "heaptype" (var "heaptype"))
(tup (bind (var "heaptype") (var "heaptype")))
)
)
)
)
(typ
"result"
(inst
(variant
(case
"_VALS%"
(exp "val*" (iter (var "val") list))
(tup
(bind
(iter (var "val") list (dom "val" (var "val*")))
(iter (var "val") list)
)
)
)
(case
"(REF.EXN_ADDR%)THROW_REF"
(exp "exnaddr" (var "exnaddr"))
(tup (bind (var "exnaddr") (var "exnaddr")))
)
(case "TRAP" (tup))
)
)
)
(typ "hostfunc" (inst (variant (case "..." (tup)))))
(typ
"funccode"
(inst
(variant
(case
"FUNC%%%"
(exp "typeidx" (var "typeidx"))
(exp "local*" (iter (var "local") list))
(exp "expr" (var "expr"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind
(iter (var "local") list (dom "local" (var "local*")))
(iter (var "local") list)
)
(bind (var "expr") (var "expr"))
)
)
(case "..." (tup))
)
)
)
(typ
"taginst"
(inst (struct (field "TYPE" (exp "tagtype" (var "tagtype")) (var "tagtype"))))
)
(typ
"globalinst"
(inst
(struct
(field "TYPE" (exp "globaltype" (var "globaltype")) (var "globaltype"))
(field "VALUE" (exp "val" (var "val")) (var "val"))
)
)
)
(typ
"meminst"
(inst
(struct
(field "TYPE" (exp "memtype" (var "memtype")) (var "memtype"))
(field
"BYTES"
(exp "byte*" (iter (var "byte") list))
(iter (var "byte") list)
)
)
)
)
(typ
"tableinst"
(inst
(struct
(field "TYPE" (exp "tabletype" (var "tabletype")) (var "tabletype"))
(field
"REFS"
(exp "ref*" (iter (var "ref") list))
(iter (var "ref") list)
)
)
)
)
(typ
"funcinst"
(inst
(struct
(field "TYPE" (exp "deftype" (var "deftype")) (var "deftype"))
(field "MODULE" (exp "moduleinst" (var "moduleinst")) (var "moduleinst"))
(field "CODE" (exp "funccode" (var "funccode")) (var "funccode"))
)
)
)
(typ
"datainst"
(inst
(struct
(field
"BYTES"
(exp "byte*" (iter (var "byte") list))
(iter (var "byte") list)
)
)
)
)
(typ
"eleminst"
(inst
(struct
(field "TYPE" (exp "elemtype" (var "elemtype")) (var "elemtype"))
(field
"REFS"
(exp "ref*" (iter (var "ref") list))
(iter (var "ref") list)
)
)
)
)
(typ
"packval"
(inst
(variant
(case
"PACK%%"
(exp "packtype" (var "packtype"))
(exp "iN" (var "iN" (exp (call "psizenn" (exp (var "packtype"))))))
(tup
(bind (var "packtype") (var "packtype"))
(bind
(var "iN")
(var "iN" (exp (call "psizenn" (exp (var "packtype")))))
)
)
)
)
)
)
(typ
"fieldval"
(inst
(variant
(case
"CONST%%"
(exp "numtype" (var "numtype"))
(exp "num_" (var "num_" (exp (var "numtype"))))
(tup
(bind (var "numtype") (var "numtype"))
(bind (var "num_") (var "num_" (exp (var "numtype"))))
)
)
(case
"VCONST%%"
(exp "vectype" (var "vectype"))
(exp "vec_" (var "vec_" (exp (var "vectype"))))
(tup
(bind (var "vectype") (var "vectype"))
(bind (var "vec_") (var "vec_" (exp (var "vectype"))))
)
)
(case
"REF.NULL%"
(exp "heaptype" (var "heaptype"))
(tup (bind (var "heaptype") (var "heaptype")))
)
(case
"REF.I31_NUM%"
(exp "u31" (var "u31"))
(tup (bind (var "u31") (var "u31")))
)
(case
"REF.STRUCT_ADDR%"
(exp "structaddr" (var "structaddr"))
(tup (bind (var "structaddr") (var "structaddr")))
)
(case
"REF.ARRAY_ADDR%"
(exp "arrayaddr" (var "arrayaddr"))
(tup (bind (var "arrayaddr") (var "arrayaddr")))
)
(case
"REF.FUNC_ADDR%"
(exp "funcaddr" (var "funcaddr"))
(tup (bind (var "funcaddr") (var "funcaddr")))
)
(case
"REF.EXN_ADDR%"
(exp "exnaddr" (var "exnaddr"))
(tup (bind (var "exnaddr") (var "exnaddr")))
)
(case
"REF.HOST_ADDR%"
(exp "hostaddr" (var "hostaddr"))
(tup (bind (var "hostaddr") (var "hostaddr")))
)
(case
"REF.EXTERN%"
(exp "addrref" (var "addrref"))
(tup (bind (var "addrref") (var "addrref")))
)
(case
"PACK%%"
(exp "packtype" (var "packtype"))
(exp "iN" (var "iN" (exp (call "psizenn" (exp (var "packtype"))))))
(tup
(bind (var "packtype") (var "packtype"))
(bind
(var "iN")
(var "iN" (exp (call "psizenn" (exp (var "packtype")))))
)
)
)
)
)
)
(typ
"structinst"
(inst
(struct
(field "TYPE" (exp "deftype" (var "deftype")) (var "deftype"))
(field
"FIELDS"
(exp "fieldval*" (iter (var "fieldval") list))
(iter (var "fieldval") list)
)
)
)
)
(typ
"arrayinst"
(inst
(struct
(field "TYPE" (exp "deftype" (var "deftype")) (var "deftype"))
(field
"FIELDS"
(exp "fieldval*" (iter (var "fieldval") list))
(iter (var "fieldval") list)
)
)
)
)
(typ
"exninst"
(inst
(struct
(field "TAG" (exp "tagaddr" (var "tagaddr")) (var "tagaddr"))
(field
"FIELDS"
(exp "val*" (iter (var "val") list))
(iter (var "val") list)
)
)
)
)
(typ
"store"
(inst
(struct
(field
"TAGS"
(exp "taginst*" (iter (var "taginst") list))
(iter (var "taginst") list)
)
(field
"GLOBALS"
(exp "globalinst*" (iter (var "globalinst") list))
(iter (var "globalinst") list)
)
(field
"MEMS"
(exp "meminst*" (iter (var "meminst") list))
(iter (var "meminst") list)
)
(field
"TABLES"
(exp "tableinst*" (iter (var "tableinst") list))
(iter (var "tableinst") list)
)
(field
"FUNCS"
(exp "funcinst*" (iter (var "funcinst") list))
(iter (var "funcinst") list)
)
(field
"DATAS"
(exp "datainst*" (iter (var "datainst") list))
(iter (var "datainst") list)
)
(field
"ELEMS"
(exp "eleminst*" (iter (var "eleminst") list))
(iter (var "eleminst") list)
)
(field
"STRUCTS"
(exp "structinst*" (iter (var "structinst") list))
(iter (var "structinst") list)
)
(field
"ARRAYS"
(exp "arrayinst*" (iter (var "arrayinst") list))
(iter (var "arrayinst") list)
)
(field
"EXNS"
(exp "exninst*" (iter (var "exninst") list))
(iter (var "exninst") list)
)
)
)
)
(typ
"state"
(inst
(variant
(case
"%;%"
(exp "store" (var "store"))
(exp "frame" (var "frame"))
(tup
(bind (var "store") (var "store"))
(bind (var "frame") (var "frame"))
)
)
)
)
)
(typ
"config"
(inst
(variant
(case
"%;%"
(exp "state" (var "state"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "state") (var "state"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
)
)
)
(def "Ki" nat (clause (num (nat 1024))))
(def
"packfield_"
(exp "storagetype" (var "storagetype"))
(exp "val" (var "val"))
(var "fieldval")
(clause
(exp "valtype" (var "valtype"))
(exp "val" (var "val"))
(exp (sub (var "valtype") (var "storagetype") (var "valtype")))
(exp (var "val"))
(sub (var "val") (var "fieldval") (var "val"))
)
(clause
(exp "packtype" (var "packtype"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(exp (case "CONST%%" (tup (case "I32" (tup)) (var "i"))))
(case
"PACK%%"
(tup
(var "packtype")
(call
"wrap__"
(exp (num (nat 32)))
(exp (call "psize" (exp (var "packtype"))))
(exp (var "i"))
)
)
)
)
)
(def
"unpackfield_"
(exp "storagetype" (var "storagetype"))
(exp "_" (iter (var "sx") opt))
(exp "fieldval" (var "fieldval"))
(var "val")
(clause
(exp "valtype" (var "valtype"))
(exp "val" (var "val"))
(exp (sub (var "valtype") (var "storagetype") (var "valtype")))
(exp (opt))
(exp (sub (var "val") (var "fieldval") (var "val")))
(var "val")
)
(clause
(exp "packtype" (var "packtype"))
(exp "sx" (var "sx"))
(exp "i" (var "iN" (exp (call "psizenn" (exp (var "packtype"))))))
(exp (sub (var "packtype") (var "storagetype") (var "packtype")))
(exp (opt (var "sx")))
(exp (case "PACK%%" (tup (var "packtype") (var "i"))))
(case
"CONST%%"
(tup
(case "I32" (tup))
(call
"extend__"
(exp (call "psize" (exp (var "packtype"))))
(exp (num (nat 32)))
(exp (var "sx"))
(exp (var "i"))
)
)
)
)
)
(rec
(def
"tagsxa"
(exp "_" (iter (var "externaddr") list))
(iter (var "tagaddr") list)
(clause (exp (list)) (list))
(clause
(exp "a" (var "addr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (case "TAG%" (tup (var "a"))))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(cat
(list (var "a"))
(call "tagsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
)
)
(clause
(exp "externaddr" (var "externaddr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (var "externaddr"))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(call "tagsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
else
)
)
)
(rec
(def
"globalsxa"
(exp "_" (iter (var "externaddr") list))
(iter (var "globaladdr") list)
(clause (exp (list)) (list))
(clause
(exp "a" (var "addr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (case "GLOBAL%" (tup (var "a"))))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(cat
(list (var "a"))
(call "globalsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
)
)
(clause
(exp "externaddr" (var "externaddr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (var "externaddr"))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(call "globalsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
else
)
)
)
(rec
(def
"memsxa"
(exp "_" (iter (var "externaddr") list))
(iter (var "memaddr") list)
(clause (exp (list)) (list))
(clause
(exp "a" (var "addr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (case "MEM%" (tup (var "a"))))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(cat
(list (var "a"))
(call "memsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
)
)
(clause
(exp "externaddr" (var "externaddr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (var "externaddr"))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(call "memsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
else
)
)
)
(rec
(def
"tablesxa"
(exp "_" (iter (var "externaddr") list))
(iter (var "tableaddr") list)
(clause (exp (list)) (list))
(clause
(exp "a" (var "addr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (case "TABLE%" (tup (var "a"))))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(cat
(list (var "a"))
(call "tablesxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
)
)
(clause
(exp "externaddr" (var "externaddr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (var "externaddr"))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(call "tablesxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
else
)
)
)
(rec
(def
"funcsxa"
(exp "_" (iter (var "externaddr") list))
(iter (var "funcaddr") list)
(clause (exp (list)) (list))
(clause
(exp "a" (var "addr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (case "FUNC%" (tup (var "a"))))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(cat
(list (var "a"))
(call "funcsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
)
)
(clause
(exp "externaddr" (var "externaddr"))
(exp "xa*" (iter (var "externaddr") list))
(exp
(cat
(list (var "externaddr"))
(iter (var "xa") list (dom "xa" (var "xa*")))
)
)
(call "funcsxa" (exp (iter (var "xa") list (dom "xa" (var "xa*")))))
else
)
)
)
(def
"store"
(exp "state" (var "state"))
(var "store")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(var "s")
)
)
(def
"frame"
(exp "state" (var "state"))
(var "frame")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(var "f")
)
)
(def
"tagaddr"
(exp "state" (var "state"))
(iter (var "tagaddr") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (dot (var "f") "MODULE") "TAGS")
)
)
(def
"moduleinst"
(exp "state" (var "state"))
(var "moduleinst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "f") "MODULE")
)
)
(def
"taginst"
(exp "state" (var "state"))
(iter (var "taginst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "TAGS")
)
)
(def
"globalinst"
(exp "state" (var "state"))
(iter (var "globalinst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "GLOBALS")
)
)
(def
"meminst"
(exp "state" (var "state"))
(iter (var "meminst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "MEMS")
)
)
(def
"tableinst"
(exp "state" (var "state"))
(iter (var "tableinst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "TABLES")
)
)
(def
"funcinst"
(exp "state" (var "state"))
(iter (var "funcinst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "FUNCS")
)
)
(def
"datainst"
(exp "state" (var "state"))
(iter (var "datainst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "DATAS")
)
)
(def
"eleminst"
(exp "state" (var "state"))
(iter (var "eleminst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "ELEMS")
)
)
(def
"structinst"
(exp "state" (var "state"))
(iter (var "structinst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "STRUCTS")
)
)
(def
"arrayinst"
(exp "state" (var "state"))
(iter (var "arrayinst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "ARRAYS")
)
)
(def
"exninst"
(exp "state" (var "state"))
(iter (var "exninst") list)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(dot (var "s") "EXNS")
)
)
(def
"type"
(exp "state" (var "state"))
(exp "typeidx" (var "typeidx"))
(var "deftype")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx (dot (dot (var "f") "MODULE") "TYPES") (proj (uncase (var "x") "%") 0))
)
)
(def
"tag"
(exp "state" (var "state"))
(exp "tagidx" (var "tagidx"))
(var "taginst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "TAGS")
(idx
(dot (dot (var "f") "MODULE") "TAGS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"global"
(exp "state" (var "state"))
(exp "globalidx" (var "globalidx"))
(var "globalinst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "GLOBALS")
(idx
(dot (dot (var "f") "MODULE") "GLOBALS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"mem"
(exp "state" (var "state"))
(exp "memidx" (var "memidx"))
(var "meminst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "MEMS")
(idx
(dot (dot (var "f") "MODULE") "MEMS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"table"
(exp "state" (var "state"))
(exp "tableidx" (var "tableidx"))
(var "tableinst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "TABLES")
(idx
(dot (dot (var "f") "MODULE") "TABLES")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"func"
(exp "state" (var "state"))
(exp "funcidx" (var "funcidx"))
(var "funcinst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "FUNCS")
(idx
(dot (dot (var "f") "MODULE") "FUNCS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"data"
(exp "state" (var "state"))
(exp "dataidx" (var "dataidx"))
(var "datainst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "DATAS")
(idx
(dot (dot (var "f") "MODULE") "DATAS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"elem"
(exp "state" (var "state"))
(exp "tableidx" (var "tableidx"))
(var "eleminst")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx
(dot (var "s") "ELEMS")
(idx
(dot (dot (var "f") "MODULE") "ELEMS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
(def
"local"
(exp "state" (var "state"))
(exp "localidx" (var "localidx"))
(iter (var "val") opt)
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(idx (dot (var "f") "LOCALS") (proj (uncase (var "x") "%") 0))
)
)
(def
"with_local"
(exp "state" (var "state"))
(exp "localidx" (var "localidx"))
(exp "val" (var "val"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "v" (var "val"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (var "v"))
(case
"%;%"
(tup
(var "s")
(upd
(var "f")
(idx (dot root "LOCALS") (proj (uncase (var "x") "%") 0))
(opt (var "v"))
)
)
)
)
)
(def
"with_global"
(exp "state" (var "state"))
(exp "globalidx" (var "globalidx"))
(exp "val" (var "val"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "v" (var "val"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (var "v"))
(case
"%;%"
(tup
(upd
(var "s")
(dot
(idx
(dot root "GLOBALS")
(idx
(dot (dot (var "f") "MODULE") "GLOBALS")
(proj (uncase (var "x") "%") 0)
)
)
"VALUE"
)
(var "v")
)
(var "f")
)
)
)
)
(def
"with_table"
(exp "state" (var "state"))
(exp "tableidx" (var "tableidx"))
(exp "nat" nat)
(exp "ref" (var "ref"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "i" nat)
(exp "r" (var "ref"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (var "i"))
(exp (var "r"))
(case
"%;%"
(tup
(upd
(var "s")
(idx
(dot
(idx
(dot root "TABLES")
(idx
(dot (dot (var "f") "MODULE") "TABLES")
(proj (uncase (var "x") "%") 0)
)
)
"REFS"
)
(var "i")
)
(var "r")
)
(var "f")
)
)
)
)
(def
"with_tableinst"
(exp "state" (var "state"))
(exp "tableidx" (var "tableidx"))
(exp "tableinst" (var "tableinst"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "ti" (var "tableinst"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (var "ti"))
(case
"%;%"
(tup
(upd
(var "s")
(idx
(dot root "TABLES")
(idx
(dot (dot (var "f") "MODULE") "TABLES")
(proj (uncase (var "x") "%") 0)
)
)
(var "ti")
)
(var "f")
)
)
)
)
(def
"with_mem"
(exp "state" (var "state"))
(exp "memidx" (var "memidx"))
(exp "nat" nat)
(exp "nat" nat)
(exp "_" (iter (var "byte") list))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "i" nat)
(exp "j" nat)
(exp "b*" (iter (var "byte") list))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (var "i"))
(exp (var "j"))
(exp (iter (var "b") list (dom "b" (var "b*"))))
(case
"%;%"
(tup
(upd
(var "s")
(slice
(dot
(idx
(dot root "MEMS")
(idx
(dot (dot (var "f") "MODULE") "MEMS")
(proj (uncase (var "x") "%") 0)
)
)
"BYTES"
)
(var "i")
(var "j")
)
(iter (var "b") list (dom "b" (var "b*")))
)
(var "f")
)
)
)
)
(def
"with_meminst"
(exp "state" (var "state"))
(exp "memidx" (var "memidx"))
(exp "meminst" (var "meminst"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "mi" (var "meminst"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (var "mi"))
(case
"%;%"
(tup
(upd
(var "s")
(idx
(dot root "MEMS")
(idx
(dot (dot (var "f") "MODULE") "MEMS")
(proj (uncase (var "x") "%") 0)
)
)
(var "mi")
)
(var "f")
)
)
)
)
(def
"with_elem"
(exp "state" (var "state"))
(exp "elemidx" (var "elemidx"))
(exp "_" (iter (var "ref") list))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "r*" (iter (var "ref") list))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (iter (var "r") list (dom "r" (var "r*"))))
(case
"%;%"
(tup
(upd
(var "s")
(dot
(idx
(dot root "ELEMS")
(idx
(dot (dot (var "f") "MODULE") "ELEMS")
(proj (uncase (var "x") "%") 0)
)
)
"REFS"
)
(iter (var "r") list (dom "r" (var "r*")))
)
(var "f")
)
)
)
)
(def
"with_data"
(exp "state" (var "state"))
(exp "dataidx" (var "dataidx"))
(exp "_" (iter (var "byte") list))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "x" (var "idx"))
(exp "b*" (iter (var "byte") list))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "x"))
(exp (iter (var "b") list (dom "b" (var "b*"))))
(case
"%;%"
(tup
(upd
(var "s")
(dot
(idx
(dot root "DATAS")
(idx
(dot (dot (var "f") "MODULE") "DATAS")
(proj (uncase (var "x") "%") 0)
)
)
"BYTES"
)
(iter (var "b") list (dom "b" (var "b*")))
)
(var "f")
)
)
)
)
(def
"with_struct"
(exp "state" (var "state"))
(exp "structaddr" (var "structaddr"))
(exp "nat" nat)
(exp "fieldval" (var "fieldval"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "a" (var "addr"))
(exp "i" nat)
(exp "fv" (var "fieldval"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "a"))
(exp (var "i"))
(exp (var "fv"))
(case
"%;%"
(tup
(upd
(var "s")
(idx (dot (idx (dot root "STRUCTS") (var "a")) "FIELDS") (var "i"))
(var "fv")
)
(var "f")
)
)
)
)
(def
"with_array"
(exp "state" (var "state"))
(exp "arrayaddr" (var "arrayaddr"))
(exp "nat" nat)
(exp "fieldval" (var "fieldval"))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "a" (var "addr"))
(exp "i" nat)
(exp "fv" (var "fieldval"))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (var "a"))
(exp (var "i"))
(exp (var "fv"))
(case
"%;%"
(tup
(upd
(var "s")
(idx (dot (idx (dot root "ARRAYS") (var "a")) "FIELDS") (var "i"))
(var "fv")
)
(var "f")
)
)
)
)
(def
"add_structinst"
(exp "state" (var "state"))
(exp "_" (iter (var "structinst") list))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "si*" (iter (var "structinst") list))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (iter (var "si") list (dom "si" (var "si*"))))
(case
"%;%"
(tup
(ext
(var "s")
(dot root "STRUCTS")
(iter (var "si") list (dom "si" (var "si*")))
)
(var "f")
)
)
)
)
(def
"add_arrayinst"
(exp "state" (var "state"))
(exp "_" (iter (var "arrayinst") list))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ai*" (iter (var "arrayinst") list))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (iter (var "ai") list (dom "ai" (var "ai*"))))
(case
"%;%"
(tup
(ext
(var "s")
(dot root "ARRAYS")
(iter (var "ai") list (dom "ai" (var "ai*")))
)
(var "f")
)
)
)
)
(def
"add_exninst"
(exp "state" (var "state"))
(exp "_" (iter (var "exninst") list))
(var "state")
(clause
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "exn*" (iter (var "exninst") list))
(exp (case "%;%" (tup (var "s") (var "f"))))
(exp (iter (var "exn") list (dom "exn" (var "exn*"))))
(case
"%;%"
(tup
(ext
(var "s")
(dot root "EXNS")
(iter (var "exn") list (dom "exn" (var "exn*")))
)
(var "f")
)
)
)
)
(def
"growtable"
(exp "tableinst" (var "tableinst"))
(exp "nat" nat)
(exp "ref" (var "ref"))
(var "tableinst")
(clause
(exp "tableinst" (var "tableinst"))
(exp "n" (var "n"))
(exp "r" (var "ref"))
(exp "tableinst'" (var "tableinst"))
(exp "at" (var "addrtype"))
(exp "i" (var "u64"))
(exp "j?" (iter (var "u64") opt))
(exp "rt" (var "reftype"))
(exp "r'*" (iter (var "ref") list))
(exp "i'" (var "u64"))
(exp (var "tableinst"))
(exp (var "n"))
(exp (var "r"))
(var "tableinst'")
(if
(cmp
eq
bool
(var "tableinst")
(struct
(field
"TYPE"
(case
"%%%"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i") (iter (var "j") opt (dom "j" (var "j?"))))
)
(var "rt")
)
)
)
(field "REFS" (iter (var "r'") list (dom "r'" (var "r'*"))))
)
)
)
(if
(cmp
eq
bool
(var "tableinst'")
(struct
(field
"TYPE"
(case
"%%%"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i'") (iter (var "j") opt (dom "j" (var "j?"))))
)
(var "rt")
)
)
)
(field
"REFS"
(cat
(iter (var "r'") list (dom "r'" (var "r'*")))
(iter (var "r") (listn (var "n")))
)
)
)
)
)
(if
(cmp
eq
bool
(proj (uncase (var "i'") "%") 0)
(bin
add
nat
(len (iter (var "r'") list (dom "r'" (var "r'*"))))
(var "n")
)
)
)
(iter
(if
(cmp
le
nat
(proj (uncase (var "i'") "%") 0)
(proj (uncase (var "j") "%") 0)
)
)
opt
(dom "j" (var "j?"))
)
)
)
(def
"growmem"
(exp "meminst" (var "meminst"))
(exp "nat" nat)
(var "meminst")
(clause
(exp "meminst" (var "meminst"))
(exp "n" (var "n"))
(exp "meminst'" (var "meminst"))
(exp "at" (var "addrtype"))
(exp "i" (var "u64"))
(exp "j?" (iter (var "u64") opt))
(exp "b*" (iter (var "byte") list))
(exp "i'" (var "u64"))
(exp (var "meminst"))
(exp (var "n"))
(var "meminst'")
(if
(cmp
eq
bool
(var "meminst")
(struct
(field
"TYPE"
(case
"%%PAGE"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i") (iter (var "j") opt (dom "j" (var "j?"))))
)
)
)
)
(field "BYTES" (iter (var "b") list (dom "b" (var "b*"))))
)
)
)
(if
(cmp
eq
bool
(var "meminst'")
(struct
(field
"TYPE"
(case
"%%PAGE"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i'") (iter (var "j") opt (dom "j" (var "j?"))))
)
)
)
)
(field
"BYTES"
(cat
(iter (var "b") list (dom "b" (var "b*")))
(iter
(case "%" (tup (num (nat 0))))
(listn
(bin
mul
nat
(var "n")
(bin mul nat (num (nat 64)) (call "Ki"))
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(cvt nat rat (proj (uncase (var "i'") "%") 0))
(bin
add
rat
(bin
div
rat
(cvt nat rat (len (iter (var "b") list (dom "b" (var "b*")))))
(cvt nat rat (bin mul nat (num (nat 64)) (call "Ki")))
)
(cvt nat rat (var "n"))
)
)
)
(iter
(if
(cmp
le
nat
(proj (uncase (var "i'") "%") 0)
(proj (uncase (var "j") "%") 0)
)
)
opt
(dom "j" (var "j?"))
)
)
)
(rel
"Num_ok"
"%|-%:%"
(tup
(bind (var "_") (var "store"))
(bind (var "_") (var "num"))
(bind (var "_") (var "numtype"))
)
(rule
""
(exp "s" (var "store"))
(exp "nt" (var "numtype"))
(exp "c" (var "num_" (exp (var "nt"))))
"%|-%:%"
(tup (var "s") (case "CONST%%" (tup (var "nt") (var "c"))) (var "nt"))
)
)
(rel
"Vec_ok"
"%|-%:%"
(tup
(bind (var "_") (var "store"))
(bind (var "_") (var "vec"))
(bind (var "_") (var "vectype"))
)
(rule
""
(exp "s" (var "store"))
(exp "vt" (var "vectype"))
(exp "c" (var "vec_" (exp (var "vt"))))
"%|-%:%"
(tup (var "s") (case "VCONST%%" (tup (var "vt") (var "c"))) (var "vt"))
)
)
(rec
(rel
"Ref_ok"
"%|-%:%"
(tup
(bind (var "_") (var "store"))
(bind (var "_") (var "ref"))
(bind (var "_") (var "reftype"))
)
(rule
"null"
(exp "s" (var "store"))
(exp "ht" (var "heaptype"))
(exp "ht'" (var "heaptype"))
"%|-%:%"
(tup
(var "s")
(case "REF.NULL%" (tup (var "ht")))
(case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht'")))
)
(rule
"Heaptype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "ht'")
(var "ht")
)
)
)
(rule
"i31"
(exp "s" (var "store"))
(exp "i" (var "u31"))
"%|-%:%"
(tup
(var "s")
(case "REF.I31_NUM%" (tup (var "i")))
(case "REF%%" (tup (opt) (case "I31" (tup))))
)
)
(rule
"struct"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "dt" (var "deftype"))
"%|-%:%"
(tup
(var "s")
(case "REF.STRUCT_ADDR%" (tup (var "a")))
(case
"REF%%"
(tup (opt) (sub (var "deftype") (var "heaptype") (var "dt")))
)
)
(if
(cmp
eq
bool
(dot (idx (dot (var "s") "STRUCTS") (var "a")) "TYPE")
(var "dt")
)
)
)
(rule
"array"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "dt" (var "deftype"))
"%|-%:%"
(tup
(var "s")
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case
"REF%%"
(tup (opt) (sub (var "deftype") (var "heaptype") (var "dt")))
)
)
(if
(cmp
eq
bool
(dot (idx (dot (var "s") "ARRAYS") (var "a")) "TYPE")
(var "dt")
)
)
)
(rule
"func"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "dt" (var "deftype"))
"%|-%:%"
(tup
(var "s")
(case "REF.FUNC_ADDR%" (tup (var "a")))
(case
"REF%%"
(tup (opt) (sub (var "deftype") (var "heaptype") (var "dt")))
)
)
(if
(cmp
eq
bool
(dot (idx (dot (var "s") "FUNCS") (var "a")) "TYPE")
(var "dt")
)
)
)
(rule
"exn"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "exn" (var "exninst"))
"%|-%:%"
(tup
(var "s")
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "REF%%" (tup (opt) (case "EXN" (tup))))
)
(if (cmp eq bool (idx (dot (var "s") "EXNS") (var "a")) (var "exn")))
)
(rule
"host"
(exp "s" (var "store"))
(exp "a" (var "addr"))
"%|-%:%"
(tup
(var "s")
(case "REF.HOST_ADDR%" (tup (var "a")))
(case "REF%%" (tup (opt) (case "ANY" (tup))))
)
)
(rule
"extern"
(exp "s" (var "store"))
(exp "addrref" (var "addrref"))
"%|-%:%"
(tup
(var "s")
(case "REF.EXTERN%" (tup (var "addrref")))
(case "REF%%" (tup (opt) (case "EXTERN" (tup))))
)
(rule
"Ref_ok"
"%|-%:%"
(tup
(var "s")
(sub (var "addrref") (var "ref") (var "addrref"))
(case "REF%%" (tup (opt) (case "ANY" (tup))))
)
)
)
(rule
"sub"
(exp "s" (var "store"))
(exp "ref" (var "ref"))
(exp "rt" (var "reftype"))
(exp "rt'" (var "reftype"))
"%|-%:%"
(tup (var "s") (var "ref") (var "rt"))
(rule "Ref_ok" "%|-%:%" (tup (var "s") (var "ref") (var "rt'")))
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "rt'")
(var "rt")
)
)
)
)
)
(rel
"Val_ok"
"%|-%:%"
(tup
(bind (var "_") (var "store"))
(bind (var "_") (var "val"))
(bind (var "_") (var "valtype"))
)
(rule
"num"
(exp "s" (var "store"))
(exp "num" (var "num"))
(exp "nt" (var "numtype"))
"%|-%:%"
(tup
(var "s")
(sub (var "num") (var "val") (var "num"))
(sub (var "numtype") (var "valtype") (var "nt"))
)
(rule "Num_ok" "%|-%:%" (tup (var "s") (var "num") (var "nt")))
)
(rule
"vec"
(exp "s" (var "store"))
(exp "vec" (var "vec"))
(exp "vt" (var "vectype"))
"%|-%:%"
(tup
(var "s")
(sub (var "vec") (var "val") (var "vec"))
(sub (var "vectype") (var "valtype") (var "vt"))
)
(rule "Vec_ok" "%|-%:%" (tup (var "s") (var "vec") (var "vt")))
)
(rule
"ref"
(exp "s" (var "store"))
(exp "ref" (var "ref"))
(exp "rt" (var "reftype"))
"%|-%:%"
(tup
(var "s")
(sub (var "ref") (var "val") (var "ref"))
(sub (var "reftype") (var "valtype") (var "rt"))
)
(rule "Ref_ok" "%|-%:%" (tup (var "s") (var "ref") (var "rt")))
)
)
(rec
(rel
"Externaddr_ok"
"%|-%:%"
(tup
(bind (var "_") (var "store"))
(bind (var "_") (var "externaddr"))
(bind (var "_") (var "externtype"))
)
(rule
"tag"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "taginst" (var "taginst"))
"%|-%:%"
(tup
(var "s")
(case "TAG%" (tup (var "a")))
(case "TAG%" (tup (dot (var "taginst") "TYPE")))
)
(if (cmp eq bool (idx (dot (var "s") "TAGS") (var "a")) (var "taginst")))
)
(rule
"global"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "globalinst" (var "globalinst"))
"%|-%:%"
(tup
(var "s")
(case "GLOBAL%" (tup (var "a")))
(case "GLOBAL%" (tup (dot (var "globalinst") "TYPE")))
)
(if
(cmp
eq
bool
(idx (dot (var "s") "GLOBALS") (var "a"))
(var "globalinst")
)
)
)
(rule
"mem"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "meminst" (var "meminst"))
"%|-%:%"
(tup
(var "s")
(case "MEM%" (tup (var "a")))
(case "MEM%" (tup (dot (var "meminst") "TYPE")))
)
(if (cmp eq bool (idx (dot (var "s") "MEMS") (var "a")) (var "meminst")))
)
(rule
"table"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "tableinst" (var "tableinst"))
"%|-%:%"
(tup
(var "s")
(case "TABLE%" (tup (var "a")))
(case "TABLE%" (tup (dot (var "tableinst") "TYPE")))
)
(if
(cmp eq bool (idx (dot (var "s") "TABLES") (var "a")) (var "tableinst"))
)
)
(rule
"func"
(exp "s" (var "store"))
(exp "a" (var "addr"))
(exp "funcinst" (var "funcinst"))
"%|-%:%"
(tup
(var "s")
(case "FUNC%" (tup (var "a")))
(case
"FUNC%"
(tup
(sub (var "deftype") (var "typeuse") (dot (var "funcinst") "TYPE"))
)
)
)
(if
(cmp eq bool (idx (dot (var "s") "FUNCS") (var "a")) (var "funcinst"))
)
)
(rule
"sub"
(exp "s" (var "store"))
(exp "externaddr" (var "externaddr"))
(exp "xt" (var "externtype"))
(exp "xt'" (var "externtype"))
"%|-%:%"
(tup (var "s") (var "externaddr") (var "xt"))
(rule
"Externaddr_ok"
"%|-%:%"
(tup (var "s") (var "externaddr") (var "xt'"))
)
(rule
"Externtype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "xt'")
(var "xt")
)
)
)
)
)
(def
"inst_valtype"
(exp "moduleinst" (var "moduleinst"))
(exp "valtype" (var "valtype"))
(var "valtype")
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "t" (var "valtype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "moduleinst"))
(exp (var "t"))
(call
"subst_all_valtype"
(exp (var "t"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(dot (var "moduleinst") "TYPES")
)
)
)
)
(def
"inst_reftype"
(exp "moduleinst" (var "moduleinst"))
(exp "reftype" (var "reftype"))
(var "reftype")
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "rt" (var "reftype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "moduleinst"))
(exp (var "rt"))
(call
"subst_all_reftype"
(exp (var "rt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(dot (var "moduleinst") "TYPES")
)
)
)
)
(def
"inst_globaltype"
(exp "moduleinst" (var "moduleinst"))
(exp "globaltype" (var "globaltype"))
(var "globaltype")
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "gt" (var "globaltype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "moduleinst"))
(exp (var "gt"))
(call
"subst_all_globaltype"
(exp (var "gt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(dot (var "moduleinst") "TYPES")
)
)
)
)
(def
"inst_memtype"
(exp "moduleinst" (var "moduleinst"))
(exp "memtype" (var "memtype"))
(var "memtype")
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "mt" (var "memtype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "moduleinst"))
(exp (var "mt"))
(call
"subst_all_memtype"
(exp (var "mt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(dot (var "moduleinst") "TYPES")
)
)
)
)
(def
"inst_tabletype"
(exp "moduleinst" (var "moduleinst"))
(exp "tabletype" (var "tabletype"))
(var "tabletype")
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "tt" (var "tabletype"))
(exp "dt*" (iter (var "deftype") list))
(exp (var "moduleinst"))
(exp (var "tt"))
(call
"subst_all_tabletype"
(exp (var "tt"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(dot (var "moduleinst") "TYPES")
)
)
)
)
(rel
"Step_pure"
"%~>%"
(tup
(bind (var "_") (iter (var "instr") list))
(bind (var "_") (iter (var "instr") list))
)
(rule
"unreachable"
"%~>%"
(tup (list (case "UNREACHABLE" (tup))) (list (case "TRAP" (tup))))
)
(rule "nop" "%~>%" (tup (list (case "NOP" (tup))) (list)))
(rule
"drop"
(exp "val" (var "val"))
"%~>%"
(tup
(list (sub (var "val") (var "instr") (var "val")) (case "DROP" (tup)))
(list)
)
)
(rule
"select-true"
(exp "val_1" (var "val"))
(exp "val_2" (var "val"))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp "t*?" (iter (iter (var "valtype") list) opt))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val_1"))
(sub (var "val") (var "instr") (var "val_2"))
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
(case
"SELECT%"
(tup
(iter
(iter (var "t") list (dom "t" (var "t*")))
opt
(dom "t*" (var "t*?"))
)
)
)
)
(list (sub (var "val") (var "instr") (var "val_1")))
)
(if (cmp ne bool (proj (uncase (var "c") "%") 0) (num (nat 0))))
)
(rule
"select-false"
(exp "val_1" (var "val"))
(exp "val_2" (var "val"))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp "t*?" (iter (iter (var "valtype") list) opt))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val_1"))
(sub (var "val") (var "instr") (var "val_2"))
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
(case
"SELECT%"
(tup
(iter
(iter (var "t") list (dom "t" (var "t*")))
opt
(dom "t*" (var "t*?"))
)
)
)
)
(list (sub (var "val") (var "instr") (var "val_2")))
)
(if (cmp eq bool (proj (uncase (var "c") "%") 0) (num (nat 0))))
)
(rule
"if-true"
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp "bt" (var "blocktype"))
(exp "instr_1*" (iter (var "instr") list))
(exp "instr_2*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
(case
"IF%%ELSE%"
(tup
(var "bt")
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
)
)
)
(list
(case
"BLOCK%%"
(tup
(var "bt")
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
)
)
)
)
(if (cmp ne bool (proj (uncase (var "c") "%") 0) (num (nat 0))))
)
(rule
"if-false"
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp "bt" (var "blocktype"))
(exp "instr_1*" (iter (var "instr") list))
(exp "instr_2*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
(case
"IF%%ELSE%"
(tup
(var "bt")
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
)
)
)
(list
(case
"BLOCK%%"
(tup
(var "bt")
(iter (var "instr_2") list (dom "instr_2" (var "instr_2*")))
)
)
)
)
(if (cmp eq bool (proj (uncase (var "c") "%") 0) (num (nat 0))))
)
(rule
"label-vals"
(exp "n" (var "n"))
(exp "instr*" (iter (var "instr") list))
(exp "val*" (iter (var "val") list))
"%~>%"
(tup
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
)
)
)
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
)
)
(rule
"br-label-zero"
(exp "n" (var "n"))
(exp "instr'*" (iter (var "instr") list))
(exp "val'*" (iter (var "val") list))
(exp "val*" (iter (var "val") list))
(exp "l" (var "labelidx"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val'"))
list
(dom "val'" (var "val'*"))
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(cat
(list (case "BR%" (tup (var "l"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
(if (cmp eq bool (proj (uncase (var "l") "%") 0) (num (nat 0))))
)
(rule
"br-label-succ"
(exp "n" (var "n"))
(exp "instr'*" (iter (var "instr") list))
(exp "val*" (iter (var "val") list))
(exp "l" (var "labelidx"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "BR%" (tup (var "l"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list
(case
"BR%"
(tup
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (proj (uncase (var "l") "%") 0))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
)
(if (cmp gt nat (proj (uncase (var "l") "%") 0) (num (nat 0))))
)
(rule
"br-handler"
(exp "n" (var "n"))
(exp "catch*" (iter (var "catch") list))
(exp "val*" (iter (var "val") list))
(exp "l" (var "labelidx"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(iter (var "catch") list (dom "catch" (var "catch*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "BR%" (tup (var "l"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "BR%" (tup (var "l"))))
)
)
)
(rule
"br_if-true"
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp "l" (var "labelidx"))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
(case "BR_IF%" (tup (var "l")))
)
(list (case "BR%" (tup (var "l"))))
)
(if (cmp ne bool (proj (uncase (var "c") "%") 0) (num (nat 0))))
)
(rule
"br_if-false"
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp "l" (var "labelidx"))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
(case "BR_IF%" (tup (var "l")))
)
(list)
)
(if (cmp eq bool (proj (uncase (var "c") "%") 0) (num (nat 0))))
)
(rule
"br_table-lt"
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "l*" (iter (var "labelidx") list))
(exp "l'" (var "labelidx"))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case
"BR_TABLE%%"
(tup (iter (var "l") list (dom "l" (var "l*"))) (var "l'"))
)
)
(list
(case
"BR%"
(tup
(idx
(iter (var "l") list (dom "l" (var "l*")))
(proj (uncase (var "i") "%") 0)
)
)
)
)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(len (iter (var "l") list (dom "l" (var "l*"))))
)
)
)
(rule
"br_table-ge"
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "l*" (iter (var "labelidx") list))
(exp "l'" (var "labelidx"))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case
"BR_TABLE%%"
(tup (iter (var "l") list (dom "l" (var "l*"))) (var "l'"))
)
)
(list (case "BR%" (tup (var "l'"))))
)
(if
(cmp
ge
nat
(proj (uncase (var "i") "%") 0)
(len (iter (var "l") list (dom "l" (var "l*"))))
)
)
)
(rule
"br_on_null-null"
(exp "val" (var "val"))
(exp "l" (var "labelidx"))
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val"))
(case "BR_ON_NULL%" (tup (var "l")))
)
(list (case "BR%" (tup (var "l"))))
)
(if (cmp eq bool (var "val") (case "REF.NULL%" (tup (var "ht")))))
)
(rule
"br_on_null-addr"
(exp "val" (var "val"))
(exp "l" (var "labelidx"))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val"))
(case "BR_ON_NULL%" (tup (var "l")))
)
(list (sub (var "val") (var "instr") (var "val")))
)
else
)
(rule
"br_on_non_null-null"
(exp "val" (var "val"))
(exp "l" (var "labelidx"))
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val"))
(case "BR_ON_NON_NULL%" (tup (var "l")))
)
(list)
)
(if (cmp eq bool (var "val") (case "REF.NULL%" (tup (var "ht")))))
)
(rule
"br_on_non_null-addr"
(exp "val" (var "val"))
(exp "l" (var "labelidx"))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val"))
(case "BR_ON_NON_NULL%" (tup (var "l")))
)
(list
(sub (var "val") (var "instr") (var "val"))
(case "BR%" (tup (var "l")))
)
)
else
)
(rule
"call_indirect"
(exp "x" (var "idx"))
(exp "yy" (var "typeuse"))
"%~>%"
(tup
(list (case "CALL_INDIRECT%%" (tup (var "x") (var "yy"))))
(list
(case "TABLE.GET%" (tup (var "x")))
(case
"REF.CAST%"
(tup
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(sub (var "typeuse") (var "heaptype") (var "yy"))
)
)
)
)
(case "CALL_REF%" (tup (var "yy")))
)
)
)
(rule
"return_call_indirect"
(exp "x" (var "idx"))
(exp "yy" (var "typeuse"))
"%~>%"
(tup
(list (case "RETURN_CALL_INDIRECT%%" (tup (var "x") (var "yy"))))
(list
(case "TABLE.GET%" (tup (var "x")))
(case
"REF.CAST%"
(tup
(case
"REF%%"
(tup
(opt (case "NULL" (tup)))
(sub (var "typeuse") (var "heaptype") (var "yy"))
)
)
)
)
(case "RETURN_CALL_REF%" (tup (var "yy")))
)
)
)
(rule
"frame-vals"
(exp "n" (var "n"))
(exp "f" (var "frame"))
(exp "val*" (iter (var "val") list))
"%~>%"
(tup
(list
(case
"FRAME_%{%}%"
(tup
(var "n")
(var "f")
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
)
)
)
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
)
)
(rule
"return-frame"
(exp "n" (var "n"))
(exp "f" (var "frame"))
(exp "val'*" (iter (var "val") list))
(exp "val*" (iter (var "val") list))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"FRAME_%{%}%"
(tup
(var "n")
(var "f")
(cat
(iter
(sub (var "val") (var "instr") (var "val'"))
list
(dom "val'" (var "val'*"))
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(cat
(list (case "RETURN" (tup)))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
)
)
(rule
"return-label"
(exp "n" (var "n"))
(exp "instr'*" (iter (var "instr") list))
(exp "val*" (iter (var "val") list))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "RETURN" (tup)))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "RETURN" (tup)))
)
)
)
(rule
"return-handler"
(exp "n" (var "n"))
(exp "catch*" (iter (var "catch") list))
(exp "val*" (iter (var "val") list))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(iter (var "catch") list (dom "catch" (var "catch*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "RETURN" (tup)))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "RETURN" (tup)))
)
)
)
(rule
"handler-vals"
(exp "n" (var "n"))
(exp "catch*" (iter (var "catch") list))
(exp "val*" (iter (var "val") list))
"%~>%"
(tup
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(iter (var "catch") list (dom "catch" (var "catch*")))
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
)
)
)
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
)
)
(rule
"trap-instrs"
(exp "val*" (iter (var "val") list))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "TRAP" (tup)))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(list (case "TRAP" (tup)))
)
(if
(bin
or
bool
(cmp ne bool (iter (var "val") list (dom "val" (var "val*"))) (list))
(cmp
ne
bool
(iter (var "instr") list (dom "instr" (var "instr*")))
(list)
)
)
)
)
(rule
"trap-label"
(exp "n" (var "n"))
(exp "instr'*" (iter (var "instr") list))
"%~>%"
(tup
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(list (case "TRAP" (tup)))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"trap-frame"
(exp "n" (var "n"))
(exp "f" (var "frame"))
"%~>%"
(tup
(list
(case
"FRAME_%{%}%"
(tup (var "n") (var "f") (list (case "TRAP" (tup))))
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"local.tee"
(exp "val" (var "val"))
(exp "x" (var "idx"))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val"))
(case "LOCAL.TEE%" (tup (var "x")))
)
(list
(sub (var "val") (var "instr") (var "val"))
(sub (var "val") (var "instr") (var "val"))
(case "LOCAL.SET%" (tup (var "x")))
)
)
)
(rule
"ref.i31"
(exp "i" (var "num_" (exp (case "I32" (tup)))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "REF.I31" (tup))
)
(list
(case
"REF.I31_NUM%"
(tup
(call
"wrap__"
(exp (num (nat 32)))
(exp (num (nat 31)))
(exp (var "i"))
)
)
)
)
)
)
(rule
"ref.is_null-true"
(exp "ref" (var "ref"))
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.IS_NULL" (tup))
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 1))))))
)
)
(if (cmp eq bool (var "ref") (case "REF.NULL%" (tup (var "ht")))))
)
(rule
"ref.is_null-false"
(exp "ref" (var "ref"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.IS_NULL" (tup))
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 0))))))
)
)
else
)
(rule
"ref.as_non_null-null"
(exp "ref" (var "ref"))
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.AS_NON_NULL" (tup))
)
(list (case "TRAP" (tup)))
)
(if (cmp eq bool (var "ref") (case "REF.NULL%" (tup (var "ht")))))
)
(rule
"ref.as_non_null-addr"
(exp "ref" (var "ref"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.AS_NON_NULL" (tup))
)
(list (sub (var "ref") (var "instr") (var "ref")))
)
else
)
(rule
"ref.eq-null"
(exp "ref_1" (var "ref"))
(exp "ref_2" (var "ref"))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref_1"))
(sub (var "ref") (var "instr") (var "ref_2"))
(case "REF.EQ" (tup))
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 1))))))
)
)
(if
(bin
and
bool
(cmp eq bool (var "ref_1") (case "REF.NULL%" (tup (var "ht_1"))))
(cmp eq bool (var "ref_2") (case "REF.NULL%" (tup (var "ht_2"))))
)
)
)
(rule
"ref.eq-true"
(exp "ref_1" (var "ref"))
(exp "ref_2" (var "ref"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref_1"))
(sub (var "ref") (var "instr") (var "ref_2"))
(case "REF.EQ" (tup))
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 1))))))
)
)
else
(if (cmp eq bool (var "ref_1") (var "ref_2")))
)
(rule
"ref.eq-false"
(exp "ref_1" (var "ref"))
(exp "ref_2" (var "ref"))
"%~>%"
(tup
(list
(sub (var "ref") (var "instr") (var "ref_1"))
(sub (var "ref") (var "instr") (var "ref_2"))
(case "REF.EQ" (tup))
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 0))))))
)
)
else
)
(rule
"i31.get-null"
(exp "ht" (var "heaptype"))
(exp "sx" (var "sx"))
"%~>%"
(tup
(list
(case "REF.NULL%" (tup (var "ht")))
(case "I31.GET%" (tup (var "sx")))
)
(list (case "TRAP" (tup)))
)
)
(rule
"i31.get-num"
(exp "i" (var "u31"))
(exp "sx" (var "sx"))
"%~>%"
(tup
(list
(case "REF.I31_NUM%" (tup (var "i")))
(case "I31.GET%" (tup (var "sx")))
)
(list
(case
"CONST%%"
(tup
(case "I32" (tup))
(call
"extend__"
(exp (num (nat 31)))
(exp (num (nat 32)))
(exp (var "sx"))
(exp (var "i"))
)
)
)
)
)
)
(rule
"array.new"
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(list
(sub (var "val") (var "instr") (var "val"))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.NEW%" (tup (var "x")))
)
(cat
(iter (sub (var "val") (var "instr") (var "val")) (listn (var "n")))
(list
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
)
)
)
(rule
"extern.convert_any-null"
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(list
(case "REF.NULL%" (tup (var "ht")))
(case "EXTERN.CONVERT_ANY" (tup))
)
(list (case "REF.NULL%" (tup (case "EXTERN" (tup)))))
)
)
(rule
"extern.convert_any-addr"
(exp "addrref" (var "addrref"))
"%~>%"
(tup
(list
(sub (var "addrref") (var "instr") (var "addrref"))
(case "EXTERN.CONVERT_ANY" (tup))
)
(list (case "REF.EXTERN%" (tup (var "addrref"))))
)
)
(rule
"any.convert_extern-null"
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(list
(case "REF.NULL%" (tup (var "ht")))
(case "ANY.CONVERT_EXTERN" (tup))
)
(list (case "REF.NULL%" (tup (case "ANY" (tup)))))
)
)
(rule
"any.convert_extern-addr"
(exp "addrref" (var "addrref"))
"%~>%"
(tup
(list
(case "REF.EXTERN%" (tup (var "addrref")))
(case "ANY.CONVERT_EXTERN" (tup))
)
(list (sub (var "addrref") (var "instr") (var "addrref")))
)
)
(rule
"unop-val"
(exp "nt" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt"))))
(exp "unop" (var "unop_" (exp (var "nt"))))
(exp "c" (var "num_" (exp (var "nt"))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt") (var "c_1")))
(case "UNOP%%" (tup (var "nt") (var "unop")))
)
(list (case "CONST%%" (tup (var "nt") (var "c"))))
)
(if
(mem
(var "c")
(call "unop_" (exp (var "nt")) (exp (var "unop")) (exp (var "c_1")))
)
)
)
(rule
"unop-trap"
(exp "nt" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt"))))
(exp "unop" (var "unop_" (exp (var "nt"))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt") (var "c_1")))
(case "UNOP%%" (tup (var "nt") (var "unop")))
)
(list (case "TRAP" (tup)))
)
(if
(cmp
eq
bool
(call "unop_" (exp (var "nt")) (exp (var "unop")) (exp (var "c_1")))
(list)
)
)
)
(rule
"binop-val"
(exp "nt" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt"))))
(exp "c_2" (var "num_" (exp (var "nt"))))
(exp "binop" (var "binop_" (exp (var "nt"))))
(exp "c" (var "num_" (exp (var "nt"))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt") (var "c_1")))
(case "CONST%%" (tup (var "nt") (var "c_2")))
(case "BINOP%%" (tup (var "nt") (var "binop")))
)
(list (case "CONST%%" (tup (var "nt") (var "c"))))
)
(if
(mem
(var "c")
(call
"binop_"
(exp (var "nt"))
(exp (var "binop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"binop-trap"
(exp "nt" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt"))))
(exp "c_2" (var "num_" (exp (var "nt"))))
(exp "binop" (var "binop_" (exp (var "nt"))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt") (var "c_1")))
(case "CONST%%" (tup (var "nt") (var "c_2")))
(case "BINOP%%" (tup (var "nt") (var "binop")))
)
(list (case "TRAP" (tup)))
)
(if
(cmp
eq
bool
(call
"binop_"
(exp (var "nt"))
(exp (var "binop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
(list)
)
)
)
(rule
"testop"
(exp "nt" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt"))))
(exp "testop" (var "testop_" (exp (var "nt"))))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt") (var "c_1")))
(case "TESTOP%%" (tup (var "nt") (var "testop")))
)
(list (case "CONST%%" (tup (case "I32" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call "testop_" (exp (var "nt")) (exp (var "testop")) (exp (var "c_1")))
)
)
)
(rule
"relop"
(exp "nt" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt"))))
(exp "c_2" (var "num_" (exp (var "nt"))))
(exp "relop" (var "relop_" (exp (var "nt"))))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt") (var "c_1")))
(case "CONST%%" (tup (var "nt") (var "c_2")))
(case "RELOP%%" (tup (var "nt") (var "relop")))
)
(list (case "CONST%%" (tup (case "I32" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"relop_"
(exp (var "nt"))
(exp (var "relop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"cvtop-val"
(exp "nt_1" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt_1"))))
(exp "nt_2" (var "numtype"))
(exp "cvtop" (var "cvtop__" (exp (var "nt_1")) (exp (var "nt_2"))))
(exp "c" (var "num_" (exp (var "nt_2"))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt_1") (var "c_1")))
(case "CVTOP%%%" (tup (var "nt_2") (var "nt_1") (var "cvtop")))
)
(list (case "CONST%%" (tup (var "nt_2") (var "c"))))
)
(if
(mem
(var "c")
(call
"cvtop__"
(exp (var "nt_1"))
(exp (var "nt_2"))
(exp (var "cvtop"))
(exp (var "c_1"))
)
)
)
)
(rule
"cvtop-trap"
(exp "nt_1" (var "numtype"))
(exp "c_1" (var "num_" (exp (var "nt_1"))))
(exp "nt_2" (var "numtype"))
(exp "cvtop" (var "cvtop__" (exp (var "nt_1")) (exp (var "nt_2"))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (var "nt_1") (var "c_1")))
(case "CVTOP%%%" (tup (var "nt_2") (var "nt_1") (var "cvtop")))
)
(list (case "TRAP" (tup)))
)
(if
(cmp
eq
bool
(call
"cvtop__"
(exp (var "nt_1"))
(exp (var "nt_2"))
(exp (var "cvtop"))
(exp (var "c_1"))
)
(list)
)
)
)
(rule
"vvunop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "vvunop" (var "vvunop"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VVUNOP%%" (tup (case "V128" (tup)) (var "vvunop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(mem
(var "c")
(call
"vvunop_"
(exp (case "V128" (tup)))
(exp (var "vvunop"))
(exp (var "c_1"))
)
)
)
)
(rule
"vvbinop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "vvbinop" (var "vvbinop"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VVBINOP%%" (tup (case "V128" (tup)) (var "vvbinop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(mem
(var "c")
(call
"vvbinop_"
(exp (case "V128" (tup)))
(exp (var "vvbinop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"vvternop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_3" (var "vec_" (exp (case "V128" (tup)))))
(exp "vvternop" (var "vvternop"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_3")))
(case "VVTERNOP%%" (tup (case "V128" (tup)) (var "vvternop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(mem
(var "c")
(call
"vvternop_"
(exp (case "V128" (tup)))
(exp (var "vvternop"))
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
)
)
)
)
(rule
"vvtestop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VVTESTOP%%" (tup (case "V128" (tup)) (case "ANY_TRUE" (tup))))
)
(list (case "CONST%%" (tup (case "I32" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"inez_"
(exp (call "vsize" (exp (case "V128" (tup)))))
(exp (var "c_1"))
)
)
)
)
(rule
"vunop-val"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vunop" (var "vunop_" (exp (var "sh"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VUNOP%%" (tup (var "sh") (var "vunop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(mem
(var "c")
(call "vunop_" (exp (var "sh")) (exp (var "vunop")) (exp (var "c_1")))
)
)
)
(rule
"vunop-trap"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vunop" (var "vunop_" (exp (var "sh"))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VUNOP%%" (tup (var "sh") (var "vunop")))
)
(list (case "TRAP" (tup)))
)
(if
(cmp
eq
bool
(call "vunop_" (exp (var "sh")) (exp (var "vunop")) (exp (var "c_1")))
(list)
)
)
)
(rule
"vbinop-val"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vbinop" (var "vbinop_" (exp (var "sh"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VBINOP%%" (tup (var "sh") (var "vbinop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(mem
(var "c")
(call
"vbinop_"
(exp (var "sh"))
(exp (var "vbinop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"vbinop-trap"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vbinop" (var "vbinop_" (exp (var "sh"))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VBINOP%%" (tup (var "sh") (var "vbinop")))
)
(list (case "TRAP" (tup)))
)
(if
(cmp
eq
bool
(call
"vbinop_"
(exp (var "sh"))
(exp (var "vbinop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
(list)
)
)
)
(rule
"vternop-val"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_3" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vternop" (var "vternop_" (exp (var "sh"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_3")))
(case "VTERNOP%%" (tup (var "sh") (var "vternop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(mem
(var "c")
(call
"vternop_"
(exp (var "sh"))
(exp (var "vternop"))
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
)
)
)
)
(rule
"vternop-trap"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_3" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vternop" (var "vternop_" (exp (var "sh"))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_3")))
(case "VTERNOP%%" (tup (var "sh") (var "vternop")))
)
(list (case "TRAP" (tup)))
)
(if
(cmp
eq
bool
(call
"vternop_"
(exp (var "sh"))
(exp (var "vternop"))
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
)
(list)
)
)
)
(rule
"vtestop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
(exp
"i*"
(iter
(var
"lane_"
(exp
(call
"lanetype"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
)
)
)
list
)
)
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case
"VTESTOP%%"
(tup
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
(case "ALL_TRUE" (tup))
)
)
)
(list (case "CONST%%" (tup (case "I32" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(iter (var "i") list (dom "i" (var "i*")))
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "c_1"))
)
)
)
(if
(cmp
eq
bool
(proj (uncase (var "c") "%") 0)
(call
"prod"
(exp
(iter
(proj
(uncase
(call
"inez_"
(exp (call "jsizenn" (exp (var "Jnn"))))
(exp (var "i"))
)
"%"
)
0
)
list
(dom "i" (var "i*"))
)
)
)
)
)
)
(rule
"vrelop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "shape"))
(exp "vrelop" (var "vrelop_" (exp (var "sh"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VRELOP%%" (tup (var "sh") (var "vrelop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"vrelop_"
(exp (var "sh"))
(exp (var "vrelop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"vshiftop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "sh" (var "ishape"))
(exp "vshiftop" (var "vshiftop_" (exp (var "sh"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "VSHIFTOP%%" (tup (var "sh") (var "vshiftop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"vshiftop_"
(exp (var "sh"))
(exp (var "vshiftop"))
(exp (var "c_1"))
(exp (var "i"))
)
)
)
)
(rule
"vbitmask"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "ishape"))
(exp "c" (var "num_" (exp (case "I32" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VBITMASK%" (tup (var "sh")))
)
(list (case "CONST%%" (tup (case "I32" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call "vbitmaskop_" (exp (var "sh")) (exp (var "c_1")))
)
)
)
(rule
"vswizzlop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "bshape"))
(exp "swizzlop" (var "vswizzlop_" (exp (var "sh"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VSWIZZLOP%%" (tup (var "sh") (var "swizzlop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"vswizzlop_"
(exp (var "sh"))
(exp (var "swizzlop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"vshuffle"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh" (var "bshape"))
(exp "i*" (iter (var "laneidx") list))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case
"VSHUFFLE%%"
(tup (var "sh") (iter (var "i") list (dom "i" (var "i*"))))
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"vshufflop_"
(exp (var "sh"))
(exp (iter (var "i") list (dom "i" (var "i*"))))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"vsplat"
(exp "Lnn" (var "Lnn"))
(exp "c_1" (var "num_" (exp (call "lunpack" (exp (var "Lnn"))))))
(exp "M" (var "M"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "CONST%%" (tup (call "lunpack" (exp (var "Lnn"))) (var "c_1")))
(case
"VSPLAT%"
(tup (case "%X%" (tup (var "Lnn") (case "%" (tup (var "M"))))))
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"inv_lanes_"
(exp (case "%X%" (tup (var "Lnn") (case "%" (tup (var "M"))))))
(exp
(iter
(call "lpacknum_" (exp (var "Lnn")) (exp (var "c_1")))
(listn (var "M"))
)
)
)
)
)
)
(rule
"vextract_lane-num"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "nt" (var "numtype"))
(exp "M" (var "M"))
(exp "i" (var "laneidx"))
(exp "c_2" (var "num_" (exp (var "nt"))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case
"VEXTRACT_LANE%%%"
(tup
(case
"%X%"
(tup
(sub (var "numtype") (var "lanetype") (var "nt"))
(case "%" (tup (var "M")))
)
)
(opt)
(var "i")
)
)
)
(list (case "CONST%%" (tup (var "nt") (var "c_2"))))
)
(if
(cmp
eq
bool
(var "c_2")
(idx
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "numtype") (var "lanetype") (var "nt"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "c_1"))
)
(proj (uncase (var "i") "%") 0)
)
)
)
)
(rule
"vextract_lane-pack"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "pt" (var "packtype"))
(exp "M" (var "M"))
(exp "sx" (var "sx"))
(exp "i" (var "laneidx"))
(exp "c_2" (var "num_" (exp (case "I32" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case
"VEXTRACT_LANE%%%"
(tup
(case
"%X%"
(tup
(sub (var "packtype") (var "lanetype") (var "pt"))
(case "%" (tup (var "M")))
)
)
(opt (var "sx"))
(var "i")
)
)
)
(list (case "CONST%%" (tup (case "I32" (tup)) (var "c_2"))))
)
(if
(cmp
eq
bool
(var "c_2")
(call
"extend__"
(exp (call "psize" (exp (var "pt"))))
(exp (num (nat 32)))
(exp (var "sx"))
(exp
(idx
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "packtype") (var "lanetype") (var "pt"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "c_1"))
)
(proj (uncase (var "i") "%") 0)
)
)
)
)
)
)
(rule
"vreplace_lane"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "Lnn" (var "Lnn"))
(exp "c_2" (var "num_" (exp (call "lunpack" (exp (var "Lnn"))))))
(exp "M" (var "M"))
(exp "i" (var "laneidx"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "CONST%%" (tup (call "lunpack" (exp (var "Lnn"))) (var "c_2")))
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (var "Lnn") (case "%" (tup (var "M")))))
(var "i")
)
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"inv_lanes_"
(exp (case "%X%" (tup (var "Lnn") (case "%" (tup (var "M"))))))
(exp
(upd
(call
"lanes_"
(exp (case "%X%" (tup (var "Lnn") (case "%" (tup (var "M"))))))
(exp (var "c_1"))
)
(idx root (proj (uncase (var "i") "%") 0))
(call "lpacknum_" (exp (var "Lnn")) (exp (var "c_2")))
)
)
)
)
)
)
(rule
"vextunop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh_2" (var "ishape"))
(exp "sh_1" (var "ishape"))
(exp "vextunop" (var "vextunop__" (exp (var "sh_1")) (exp (var "sh_2"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VEXTUNOP%%%" (tup (var "sh_2") (var "sh_1") (var "vextunop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call
"vextunop__"
(exp (var "sh_1"))
(exp (var "sh_2"))
(exp (var "vextunop"))
(exp (var "c_1"))
)
(var "c")
)
)
)
(rule
"vextbinop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh_2" (var "ishape"))
(exp "sh_1" (var "ishape"))
(exp "vextbinop" (var "vextbinop__" (exp (var "sh_1")) (exp (var "sh_2"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VEXTBINOP%%%" (tup (var "sh_2") (var "sh_1") (var "vextbinop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call
"vextbinop__"
(exp (var "sh_1"))
(exp (var "sh_2"))
(exp (var "vextbinop"))
(exp (var "c_1"))
(exp (var "c_2"))
)
(var "c")
)
)
)
(rule
"vextternop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_3" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh_2" (var "ishape"))
(exp "sh_1" (var "ishape"))
(exp
"vextternop"
(var "vextternop__" (exp (var "sh_1")) (exp (var "sh_2")))
)
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_3")))
(case
"VEXTTERNOP%%%"
(tup (var "sh_2") (var "sh_1") (var "vextternop"))
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call
"vextternop__"
(exp (var "sh_1"))
(exp (var "sh_2"))
(exp (var "vextternop"))
(exp (var "c_1"))
(exp (var "c_2"))
(exp (var "c_3"))
)
(var "c")
)
)
)
(rule
"vnarrow"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "c_2" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh_2" (var "ishape"))
(exp "sh_1" (var "ishape"))
(exp "sx" (var "sx"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_2")))
(case "VNARROW%%%" (tup (var "sh_2") (var "sh_1") (var "sx")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"vnarrowop__"
(exp (proj (uncase (var "sh_1") "%") 0))
(exp (proj (uncase (var "sh_2") "%") 0))
(exp (var "sx"))
(exp (var "c_1"))
(exp (var "c_2"))
)
)
)
)
(rule
"vcvtop"
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "sh_2" (var "shape"))
(exp "sh_1" (var "shape"))
(exp "vcvtop" (var "vcvtop__" (exp (var "sh_1")) (exp (var "sh_2"))))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(list
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case "VCVTOP%%%" (tup (var "sh_2") (var "sh_1") (var "vcvtop")))
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(var "c")
(call
"vcvtop__"
(exp (var "sh_1"))
(exp (var "sh_2"))
(exp (var "vcvtop"))
(exp (var "c_1"))
)
)
)
)
)
(def
"blocktype_"
(exp "state" (var "state"))
(exp "blocktype" (var "blocktype"))
(var "instrtype")
(clause
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp (var "z"))
(exp (case "_IDX%" (tup (var "x"))))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
(clause
(exp "z" (var "state"))
(exp "t?" (iter (var "valtype") opt))
(exp (var "z"))
(exp (case "_RESULT%" (tup (iter (var "t") opt (dom "t" (var "t?"))))))
(case
"%->_%%"
(tup
(case "%" (tup (list)))
(list)
(case "%" (tup (lift (iter (var "t") opt (dom "t" (var "t?"))))))
)
)
)
)
(rel
"Step_read"
"%~>%"
(tup
(bind (var "_") (var "config"))
(bind (var "_") (iter (var "instr") list))
)
(rule
"block"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "m" (var "m"))
(exp "bt" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp "n" (var "n"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "m"))
(dom "val" (var "val*"))
)
(list
(case
"BLOCK%%"
(tup
(var "bt")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(list)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "m"))
(dom "val" (var "val*"))
)
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(if
(cmp
eq
bool
(call "blocktype_" (exp (var "z")) (exp (var "bt")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(iter (var "t_1") (listn (var "m")) (dom "t_1" (var "t_1*")))
)
)
(list)
(case
"%"
(tup
(iter (var "t_2") (listn (var "n")) (dom "t_2" (var "t_2*")))
)
)
)
)
)
)
)
(rule
"loop"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "m" (var "m"))
(exp "bt" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "n" (var "n"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "m"))
(dom "val" (var "val*"))
)
(list
(case
"LOOP%%"
(tup
(var "bt")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
(list
(case
"LABEL_%{%}%"
(tup
(var "m")
(list
(case
"LOOP%%"
(tup
(var "bt")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "m"))
(dom "val" (var "val*"))
)
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(if
(cmp
eq
bool
(call "blocktype_" (exp (var "z")) (exp (var "bt")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(iter (var "t_1") (listn (var "m")) (dom "t_1" (var "t_1*")))
)
)
(list)
(case
"%"
(tup
(iter (var "t_2") (listn (var "n")) (dom "t_2" (var "t_2*")))
)
)
)
)
)
)
)
(rule
"br_on_cast-succeed"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
(exp "rt" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "BR_ON_CAST%%%" (tup (var "l") (var "rt_1") (var "rt_2")))
)
)
)
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "BR%" (tup (var "l")))
)
)
(rule "Ref_ok" "%|-%:%" (tup (var "s") (var "ref") (var "rt")))
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "rt")
(call "inst_reftype" (exp (dot (var "f") "MODULE")) (exp (var "rt_2")))
)
)
)
(rule
"br_on_cast-fail"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "BR_ON_CAST%%%" (tup (var "l") (var "rt_1") (var "rt_2")))
)
)
)
(list (sub (var "ref") (var "instr") (var "ref")))
)
else
)
(rule
"br_on_cast_fail-succeed"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
(exp "rt" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case
"BR_ON_CAST_FAIL%%%"
(tup (var "l") (var "rt_1") (var "rt_2"))
)
)
)
)
(list (sub (var "ref") (var "instr") (var "ref")))
)
(rule "Ref_ok" "%|-%:%" (tup (var "s") (var "ref") (var "rt")))
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "rt")
(call "inst_reftype" (exp (dot (var "f") "MODULE")) (exp (var "rt_2")))
)
)
)
(rule
"br_on_cast_fail-fail"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case
"BR_ON_CAST_FAIL%%%"
(tup (var "l") (var "rt_1") (var "rt_2"))
)
)
)
)
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "BR%" (tup (var "l")))
)
)
else
)
(rule
"call"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "a" (var "addr"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "CALL%" (tup (var "x"))))))
(list
(case "REF.FUNC_ADDR%" (tup (var "a")))
(case
"CALL_REF%"
(tup
(sub
(var "deftype")
(var "typeuse")
(dot (idx (call "funcinst" (exp (var "z"))) (var "a")) "TYPE")
)
)
)
)
)
(if
(cmp
eq
bool
(idx
(dot (call "moduleinst" (exp (var "z"))) "FUNCS")
(proj (uncase (var "x") "%") 0)
)
(var "a")
)
)
)
(rule
"call_ref-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "yy" (var "typeuse"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case "CALL_REF%" (tup (var "yy")))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"call_ref-func"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "n" (var "n"))
(exp "a" (var "addr"))
(exp "yy" (var "typeuse"))
(exp "m" (var "m"))
(exp "f" (var "frame"))
(exp "instr*" (iter (var "instr") list))
(exp "fi" (var "funcinst"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "x" (var "idx"))
(exp "t*" (iter (var "valtype") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(list
(case "REF.FUNC_ADDR%" (tup (var "a")))
(case "CALL_REF%" (tup (var "yy")))
)
)
)
)
(list
(case
"FRAME_%{%}%"
(tup
(var "m")
(var "f")
(list
(case
"LABEL_%{%}%"
(tup
(var "m")
(list)
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
)
(if
(cmp eq bool (idx (call "funcinst" (exp (var "z"))) (var "a")) (var "fi"))
)
(rule
"Expand"
"%~~%"
(tup
(dot (var "fi") "TYPE")
(case
"FUNC%->%"
(tup
(case
"%"
(tup
(iter (var "t_1") (listn (var "n")) (dom "t_1" (var "t_1*")))
)
)
(case
"%"
(tup
(iter (var "t_2") (listn (var "m")) (dom "t_2" (var "t_2*")))
)
)
)
)
)
)
(if
(cmp
eq
bool
(dot (var "fi") "CODE")
(case
"FUNC%%%"
(tup
(var "x")
(iter (case "LOCAL%" (tup (var "t"))) list (dom "t" (var "t*")))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
(if
(cmp
eq
bool
(var "f")
(struct
(field
"LOCALS"
(cat
(iter
(opt (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(iter (call "default_" (exp (var "t"))) list (dom "t" (var "t*")))
)
)
(field "MODULE" (dot (var "fi") "MODULE"))
)
)
)
)
(rule
"return_call"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "a" (var "addr"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "RETURN_CALL%" (tup (var "x"))))))
(list
(case "REF.FUNC_ADDR%" (tup (var "a")))
(case
"RETURN_CALL_REF%"
(tup
(sub
(var "deftype")
(var "typeuse")
(dot (idx (call "funcinst" (exp (var "z"))) (var "a")) "TYPE")
)
)
)
)
)
(if
(cmp
eq
bool
(idx
(dot (call "moduleinst" (exp (var "z"))) "FUNCS")
(proj (uncase (var "x") "%") 0)
)
(var "a")
)
)
)
(rule
"return_call_ref-label"
(exp "z" (var "state"))
(exp "k" (var "n"))
(exp "instr'*" (iter (var "instr") list))
(exp "val*" (iter (var "val") list))
(exp "yy" (var "typeuse"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"LABEL_%{%}%"
(tup
(var "k")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "RETURN_CALL_REF%" (tup (var "yy"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "RETURN_CALL_REF%" (tup (var "yy"))))
)
)
)
(rule
"return_call_ref-handler"
(exp "z" (var "state"))
(exp "k" (var "n"))
(exp "catch*" (iter (var "catch") list))
(exp "val*" (iter (var "val") list))
(exp "yy" (var "typeuse"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "k")
(iter (var "catch") list (dom "catch" (var "catch*")))
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "RETURN_CALL_REF%" (tup (var "yy"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "RETURN_CALL_REF%" (tup (var "yy"))))
)
)
)
(rule
"return_call_ref-frame-null"
(exp "z" (var "state"))
(exp "k" (var "n"))
(exp "f" (var "frame"))
(exp "val*" (iter (var "val") list))
(exp "ht" (var "heaptype"))
(exp "yy" (var "typeuse"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"FRAME_%{%}%"
(tup
(var "k")
(var "f")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "REF.NULL%" (tup (var "ht"))))
(cat
(list (case "RETURN_CALL_REF%" (tup (var "yy"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"return_call_ref-frame-addr"
(exp "z" (var "state"))
(exp "k" (var "n"))
(exp "f" (var "frame"))
(exp "val'*" (iter (var "val") list))
(exp "val*" (iter (var "val") list))
(exp "n" (var "n"))
(exp "a" (var "addr"))
(exp "yy" (var "typeuse"))
(exp "instr*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp "m" (var "m"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"FRAME_%{%}%"
(tup
(var "k")
(var "f")
(cat
(iter
(sub (var "val") (var "instr") (var "val'"))
list
(dom "val'" (var "val'*"))
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(cat
(list (case "REF.FUNC_ADDR%" (tup (var "a"))))
(cat
(list (case "RETURN_CALL_REF%" (tup (var "yy"))))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(list
(case "REF.FUNC_ADDR%" (tup (var "a")))
(case "CALL_REF%" (tup (var "yy")))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(dot (idx (call "funcinst" (exp (var "z"))) (var "a")) "TYPE")
(case
"FUNC%->%"
(tup
(case
"%"
(tup
(iter (var "t_1") (listn (var "n")) (dom "t_1" (var "t_1*")))
)
)
(case
"%"
(tup
(iter (var "t_2") (listn (var "m")) (dom "t_2" (var "t_2*")))
)
)
)
)
)
)
)
(rule
"throw_ref-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list (case "REF.NULL%" (tup (var "ht"))) (case "THROW_REF" (tup)))
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"throw_ref-instrs"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "a" (var "addr"))
(exp "instr*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(list (case "REF.EXN_ADDR%" (tup (var "a"))))
(cat
(list (case "THROW_REF" (tup)))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(list (case "REF.EXN_ADDR%" (tup (var "a"))) (case "THROW_REF" (tup)))
)
(if
(bin
or
bool
(cmp ne bool (iter (var "val") list (dom "val" (var "val*"))) (list))
(cmp
ne
bool
(iter (var "instr") list (dom "instr" (var "instr*")))
(list)
)
)
)
)
(rule
"throw_ref-label"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "instr'*" (iter (var "instr") list))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(list (case "REF.EXN_ADDR%" (tup (var "a"))) (case "THROW_REF" (tup)))
)
)
(rule
"throw_ref-frame"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "f" (var "frame"))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"FRAME_%{%}%"
(tup
(var "n")
(var "f")
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(list (case "REF.EXN_ADDR%" (tup (var "a"))) (case "THROW_REF" (tup)))
)
)
(rule
"throw_ref-handler-empty"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(list)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(list (case "REF.EXN_ADDR%" (tup (var "a"))) (case "THROW_REF" (tup)))
)
)
(rule
"throw_ref-handler-catch"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(exp "catch'*" (iter (var "catch") list))
(exp "a" (var "addr"))
(exp "val*" (iter (var "val") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(cat
(list (case "CATCH%%" (tup (var "x") (var "l"))))
(iter (var "catch'") list (dom "catch'" (var "catch'*")))
)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "BR%" (tup (var "l"))))
)
)
(if
(cmp
eq
bool
(dot (idx (call "exninst" (exp (var "z"))) (var "a")) "TAG")
(idx (call "tagaddr" (exp (var "z"))) (proj (uncase (var "x") "%") 0))
)
)
(if
(cmp
eq
bool
(iter (var "val") list (dom "val" (var "val*")))
(dot (idx (call "exninst" (exp (var "z"))) (var "a")) "FIELDS")
)
)
)
(rule
"throw_ref-handler-catch_ref"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(exp "catch'*" (iter (var "catch") list))
(exp "a" (var "addr"))
(exp "val*" (iter (var "val") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(cat
(list (case "CATCH_REF%%" (tup (var "x") (var "l"))))
(iter (var "catch'") list (dom "catch'" (var "catch'*")))
)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "BR%" (tup (var "l")))
)
)
)
(if
(cmp
eq
bool
(dot (idx (call "exninst" (exp (var "z"))) (var "a")) "TAG")
(idx (call "tagaddr" (exp (var "z"))) (proj (uncase (var "x") "%") 0))
)
)
(if
(cmp
eq
bool
(iter (var "val") list (dom "val" (var "val*")))
(dot (idx (call "exninst" (exp (var "z"))) (var "a")) "FIELDS")
)
)
)
(rule
"throw_ref-handler-catch_all"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "l" (var "labelidx"))
(exp "catch'*" (iter (var "catch") list))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(cat
(list (case "CATCH_ALL%" (tup (var "l"))))
(iter (var "catch'") list (dom "catch'" (var "catch'*")))
)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(list (case "BR%" (tup (var "l"))))
)
)
(rule
"throw_ref-handler-catch_all_ref"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "l" (var "labelidx"))
(exp "catch'*" (iter (var "catch") list))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(cat
(list (case "CATCH_ALL_REF%" (tup (var "l"))))
(iter (var "catch'") list (dom "catch'" (var "catch'*")))
)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(list (case "REF.EXN_ADDR%" (tup (var "a"))) (case "BR%" (tup (var "l"))))
)
)
(rule
"throw_ref-handler-next"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "catch" (var "catch"))
(exp "catch'*" (iter (var "catch") list))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(cat
(list (var "catch"))
(iter (var "catch'") list (dom "catch'" (var "catch'*")))
)
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
)
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(iter (var "catch'") list (dom "catch'" (var "catch'*")))
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
)
else
)
(rule
"try_table"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "m" (var "m"))
(exp "bt" (var "blocktype"))
(exp "catch*" (iter (var "catch") list))
(exp "instr*" (iter (var "instr") list))
(exp "n" (var "n"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "m"))
(dom "val" (var "val*"))
)
(list
(case
"TRY_TABLE%%%"
(tup
(var "bt")
(case
"%"
(tup (iter (var "catch") list (dom "catch" (var "catch*"))))
)
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
(list
(case
"HANDLER_%{%}%"
(tup
(var "n")
(iter (var "catch") list (dom "catch" (var "catch*")))
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(list)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "m"))
(dom "val" (var "val*"))
)
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(call "blocktype_" (exp (var "z")) (exp (var "bt")))
(case
"%->_%%"
(tup
(case
"%"
(tup
(iter (var "t_1") (listn (var "m")) (dom "t_1" (var "t_1*")))
)
)
(list)
(case
"%"
(tup
(iter (var "t_2") (listn (var "n")) (dom "t_2" (var "t_2*")))
)
)
)
)
)
)
)
(rule
"local.get"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "val" (var "val"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "LOCAL.GET%" (tup (var "x"))))))
(list (sub (var "val") (var "instr") (var "val")))
)
(if
(cmp
eq
bool
(call "local" (exp (var "z")) (exp (var "x")))
(opt (var "val"))
)
)
)
(rule
"global.get"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "val" (var "val"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "GLOBAL.GET%" (tup (var "x"))))))
(list (sub (var "val") (var "instr") (var "val")))
)
(if
(cmp
eq
bool
(dot (call "global" (exp (var "z")) (exp (var "x"))) "VALUE")
(var "val")
)
)
)
(rule
"table.get-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "TABLE.GET%" (tup (var "x")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
ge
nat
(proj (uncase (var "i") "%") 0)
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
)
)
)
(rule
"table.get-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "TABLE.GET%" (tup (var "x")))
)
)
)
(list
(sub
(var "ref")
(var "instr")
(idx
(dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS")
(proj (uncase (var "i") "%") 0)
)
)
)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
)
)
)
(rule
"table.size"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "n" (var "n"))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "TABLE.SIZE%" (tup (var "x"))))))
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
)
)
(if
(cmp
eq
bool
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
(var "n")
)
)
(if
(cmp
eq
bool
(dot (call "table" (exp (var "z")) (exp (var "x"))) "TYPE")
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
)
(rule
"table.fill-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.FILL%" (tup (var "x")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
)
)
)
(rule
"table.fill-zero"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.FILL%" (tup (var "x")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"table.fill-succ"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.FILL%" (tup (var "x")))
)
)
)
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case "TABLE.SET%" (tup (var "x")))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "TABLE.FILL%" (tup (var "x")))
)
)
else
)
(rule
"table.copy-oob"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(bin
or
bool
(cmp
gt
nat
(bin add nat (proj (uncase (var "i_1") "%") 0) (var "n"))
(len (dot (call "table" (exp (var "z")) (exp (var "x_1"))) "REFS"))
)
(cmp
gt
nat
(bin add nat (proj (uncase (var "i_2") "%") 0) (var "n"))
(len (dot (call "table" (exp (var "z")) (exp (var "x_2"))) "REFS"))
)
)
)
)
(rule
"table.copy-zero"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.COPY%%" (tup (var "x") (var "y")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"table.copy-le"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.COPY%%" (tup (var "x") (var "y")))
)
)
)
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_1")) (var "i_1"))
)
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_2")) (var "i_2"))
)
(case "TABLE.GET%" (tup (var "y")))
(case "TABLE.SET%" (tup (var "x")))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(case
"%"
(tup
(bin add nat (proj (uncase (var "i_1") "%") 0) (num (nat 1)))
)
)
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(case
"%"
(tup
(bin add nat (proj (uncase (var "i_2") "%") 0) (num (nat 1)))
)
)
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "TABLE.COPY%%" (tup (var "x") (var "y")))
)
)
else
(if
(cmp
le
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
(rule
"table.copy-gt"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.COPY%%" (tup (var "x") (var "y")))
)
)
)
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt
nat
int
(bin add nat (proj (uncase (var "i_1") "%") 0) (var "n"))
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt
nat
int
(bin add nat (proj (uncase (var "i_2") "%") 0) (var "n"))
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "TABLE.GET%" (tup (var "y")))
(case "TABLE.SET%" (tup (var "x")))
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_1")) (var "i_1"))
)
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_2")) (var "i_2"))
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "TABLE.COPY%%" (tup (var "x") (var "y")))
)
)
else
)
(rule
"table.init-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(bin
or
bool
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
)
(cmp
gt
nat
(bin add nat (proj (uncase (var "j") "%") 0) (var "n"))
(len (dot (call "elem" (exp (var "z")) (exp (var "y"))) "REFS"))
)
)
)
)
(rule
"table.init-zero"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"table.init-succ"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
)
)
)
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub
(var "ref")
(var "instr")
(idx
(dot (call "elem" (exp (var "z")) (exp (var "y"))) "REFS")
(proj (uncase (var "j") "%") 0)
)
)
(case "TABLE.SET%" (tup (var "x")))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup (bin add nat (proj (uncase (var "j") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
)
)
else
)
(rule
"load-num-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "nt" (var "numtype"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "LOAD%%%%" (tup (var "nt") (opt) (var "x") (var "ao")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "size" (exp (var "nt"))))
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"load-num-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "nt" (var "numtype"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "c" (var "num_" (exp (var "nt"))))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "LOAD%%%%" (tup (var "nt") (opt) (var "x") (var "ao")))
)
)
)
(list (case "CONST%%" (tup (var "nt") (var "c"))))
)
(if
(cmp
eq
bool
(call "nbytes_" (exp (var "nt")) (exp (var "c")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "size" (exp (var "nt"))))
(cvt nat rat (num (nat 8)))
)
)
)
)
)
)
(rule
"load-pack-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "Inn" (var "Inn"))
(exp "n" (var "n"))
(exp "sx" (var "sx"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"LOAD%%%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(opt (case "%_%" (tup (case "%" (tup (var "n"))) (var "sx"))))
(var "x")
(var "ao")
)
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "n")) (cvt nat rat (num (nat 8))))
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"load-pack-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "Inn" (var "Inn"))
(exp "n" (var "n"))
(exp "sx" (var "sx"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "c" (var "iN" (exp (var "n"))))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"LOAD%%%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(opt (case "%_%" (tup (case "%" (tup (var "n"))) (var "sx"))))
(var "x")
(var "ao")
)
)
)
)
)
(list
(case
"CONST%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(call
"extend__"
(exp (var "n"))
(exp
(call
"size"
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
)
)
(exp (var "sx"))
(exp (var "c"))
)
)
)
)
)
(if
(cmp
eq
bool
(call "ibytes_" (exp (var "n")) (exp (var "c")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "n")) (cvt nat rat (num (nat 8))))
)
)
)
)
)
(rule
"vload-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup (case "V128" (tup)) (opt) (var "x") (var "ao"))
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "vsize" (exp (case "V128" (tup)))))
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vload-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup (case "V128" (tup)) (opt) (var "x") (var "ao"))
)
)
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call "vbytes_" (exp (case "V128" (tup))) (exp (var "c")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "vsize" (exp (case "V128" (tup)))))
(cvt nat rat (num (nat 8)))
)
)
)
)
)
)
(rule
"vload-pack-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "M" (var "M"))
(exp "K" (var "K"))
(exp "sx" (var "sx"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (var "M"))) (var "K") (var "sx"))
)
)
(var "x")
(var "ao")
)
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (bin mul nat (var "M") (var "K")))
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vload-pack-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "M" (var "M"))
(exp "K" (var "K"))
(exp "sx" (var "sx"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "j*" (iter (var "iN" (exp (var "M"))) list))
(exp "k*" (iter nat list))
(exp "Jnn" (var "Jnn"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (var "M"))) (var "K") (var "sx"))
)
)
(var "x")
(var "ao")
)
)
)
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(iter
(if
(cmp
eq
bool
(call "ibytes_" (exp (var "M")) (exp (var "j")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (bin mul nat (var "k") (var "M")))
(cvt nat rat (num (nat 8)))
)
)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "M")) (cvt nat rat (num (nat 8))))
)
)
)
)
(listn (var "K") "k")
(dom "j" (var "j*"))
(dom "k" (var "k*"))
)
(if
(bin
and
bool
(cmp
eq
bool
(var "c")
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "K")))
)
)
)
(exp
(iter
(call
"extend__"
(exp (var "M"))
(exp (call "jsizenn" (exp (var "Jnn"))))
(exp (var "sx"))
(exp (var "j"))
)
(listn (var "K"))
(dom "j" (var "j*"))
)
)
)
)
(cmp
eq
bool
(call "jsizenn" (exp (var "Jnn")))
(bin mul nat (var "M") (num (nat 2)))
)
)
)
)
(rule
"vload-splat-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (var "N"))))))
(var "x")
(var "ao")
)
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vload-splat-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "j" (var "iN" (exp (var "N"))))
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (var "N"))))))
(var "x")
(var "ao")
)
)
)
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call "ibytes_" (exp (var "N")) (exp (var "j")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
)
)
(if (cmp eq bool (var "N") (call "jsize" (exp (var "Jnn")))))
(if
(cmp
eq
bool
(cvt nat rat (var "M"))
(bin div rat (cvt nat rat (num (nat 128))) (cvt nat rat (var "N")))
)
)
(if
(cmp
eq
bool
(var "c")
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp
(iter
(case "%" (tup (proj (uncase (var "j") "%") 0)))
(listn (var "M"))
)
)
)
)
)
)
(rule
"vload-zero-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (var "N"))))))
(var "x")
(var "ao")
)
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vload-zero-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "j" (var "iN" (exp (var "N"))))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (var "N"))))))
(var "x")
(var "ao")
)
)
)
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call "ibytes_" (exp (var "N")) (exp (var "j")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
)
)
(if
(cmp
eq
bool
(var "c")
(call
"extend__"
(exp (var "N"))
(exp (num (nat 128)))
(exp (case "U" (tup)))
(exp (var "j"))
)
)
)
)
(rule
"vload_lane-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "j" (var "laneidx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (var "N")))
(var "x")
(var "ao")
(var "j")
)
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vload_lane-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "c_1" (var "vec_" (exp (case "V128" (tup)))))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "j" (var "laneidx"))
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "k" (var "iN" (exp (var "N"))))
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "VCONST%%" (tup (case "V128" (tup)) (var "c_1")))
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (var "N")))
(var "x")
(var "ao")
(var "j")
)
)
)
)
)
(list (case "VCONST%%" (tup (case "V128" (tup)) (var "c"))))
)
(if
(cmp
eq
bool
(call "ibytes_" (exp (var "N")) (exp (var "k")))
(slice
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES")
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
)
)
(if (cmp eq bool (var "N") (call "jsize" (exp (var "Jnn")))))
(if
(cmp
eq
bool
(cvt nat rat (var "M"))
(bin
div
rat
(cvt nat rat (call "vsize" (exp (case "V128" (tup)))))
(cvt nat rat (var "N"))
)
)
)
(if
(cmp
eq
bool
(var "c")
(call
"inv_lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp
(upd
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "c_1"))
)
(idx root (proj (uncase (var "j") "%") 0))
(case "%" (tup (proj (uncase (var "k") "%") 0)))
)
)
)
)
)
)
(rule
"memory.size"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "at" (var "addrtype"))
(exp "n" (var "n"))
(exp "lim" (var "limits"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "MEMORY.SIZE%" (tup (var "x"))))))
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
)
)
(if
(cmp
eq
bool
(bin mul nat (var "n") (bin mul nat (num (nat 64)) (call "Ki")))
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
(if
(cmp
eq
bool
(dot (call "mem" (exp (var "z")) (exp (var "x"))) "TYPE")
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
)
(rule
"memory.fill-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.FILL%" (tup (var "x")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"memory.fill-zero"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.FILL%" (tup (var "x")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"memory.fill-succ"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.FILL%" (tup (var "x")))
)
)
)
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(sub (var "val") (var "instr") (var "val"))
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(call "memarg0")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "MEMORY.FILL%" (tup (var "x")))
)
)
else
)
(rule
"memory.copy-oob"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(bin
or
bool
(cmp
gt
nat
(bin add nat (proj (uncase (var "i_1") "%") 0) (var "n"))
(len (dot (call "mem" (exp (var "z")) (exp (var "x_1"))) "BYTES"))
)
(cmp
gt
nat
(bin add nat (proj (uncase (var "i_2") "%") 0) (var "n"))
(len (dot (call "mem" (exp (var "z")) (exp (var "x_2"))) "BYTES"))
)
)
)
)
(rule
"memory.copy-zero"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"memory.copy-le"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_1")) (var "i_1"))
)
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_2")) (var "i_2"))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "U" (tup))))
)
(var "x_2")
(call "memarg0")
)
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x_1")
(call "memarg0")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(case
"%"
(tup
(bin add nat (proj (uncase (var "i_1") "%") 0) (num (nat 1)))
)
)
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(case
"%"
(tup
(bin add nat (proj (uncase (var "i_2") "%") 0) (num (nat 1)))
)
)
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
else
(if
(cmp
le
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
)
)
(rule
"memory.copy-gt"
(exp "z" (var "state"))
(exp "at_1" (var "addrtype"))
(exp
"i_1"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_1"))))
)
(exp "at_2" (var "addrtype"))
(exp
"i_2"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at_2"))))
)
(exp "at'" (var "addrtype"))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(var "i_1")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(var "i_2")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_1"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt
nat
int
(bin add nat (proj (uncase (var "i_1") "%") 0) (var "n"))
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at_2"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt
nat
int
(bin add nat (proj (uncase (var "i_2") "%") 0) (var "n"))
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "U" (tup))))
)
(var "x_2")
(call "memarg0")
)
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x_1")
(call "memarg0")
)
)
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_1")) (var "i_1"))
)
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at_2")) (var "i_2"))
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at'"))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
else
)
(rule
"memory.init-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(bin
or
bool
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
(cmp
gt
nat
(bin add nat (proj (uncase (var "j") "%") 0) (var "n"))
(len (dot (call "data" (exp (var "z")) (exp (var "y"))) "BYTES"))
)
)
)
)
(rule
"memory.init-zero"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"memory.init-succ"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
)
)
)
(list
(case
"CONST%%"
(tup (sub (var "addrtype") (var "numtype") (var "at")) (var "i"))
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(proj
(uncase
(idx
(dot
(call "data" (exp (var "z")) (exp (var "y")))
"BYTES"
)
(proj (uncase (var "j") "%") 0)
)
"%"
)
0
)
)
)
)
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(call "memarg0")
)
)
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup (bin add nat (proj (uncase (var "j") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
)
)
else
)
(rule
"ref.null-idx"
(exp "z" (var "state"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list (case "REF.NULL%" (tup (case "_IDX%" (tup (var "x"))))))
)
)
(list
(case
"REF.NULL%"
(tup
(sub
(var "deftype")
(var "heaptype")
(call "type" (exp (var "z")) (exp (var "x")))
)
)
)
)
)
)
(rule
"ref.func"
(exp "z" (var "state"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "REF.FUNC%" (tup (var "x"))))))
(list
(case
"REF.FUNC_ADDR%"
(tup
(idx
(dot (call "moduleinst" (exp (var "z"))) "FUNCS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
)
)
(rule
"ref.test-true"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "rt" (var "reftype"))
(exp "rt'" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.TEST%" (tup (var "rt")))
)
)
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 1))))))
)
)
(rule "Ref_ok" "%|-%:%" (tup (var "s") (var "ref") (var "rt'")))
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "rt'")
(call "inst_reftype" (exp (dot (var "f") "MODULE")) (exp (var "rt")))
)
)
)
(rule
"ref.test-false"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "rt" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.TEST%" (tup (var "rt")))
)
)
)
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 0))))))
)
)
else
)
(rule
"ref.cast-succeed"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "rt" (var "reftype"))
(exp "rt'" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.CAST%" (tup (var "rt")))
)
)
)
(list (sub (var "ref") (var "instr") (var "ref")))
)
(rule "Ref_ok" "%|-%:%" (tup (var "s") (var "ref") (var "rt'")))
(rule
"Reftype_sub"
"%|-%<:%"
(tup
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "rt'")
(call "inst_reftype" (exp (dot (var "f") "MODULE")) (exp (var "rt")))
)
)
)
(rule
"ref.cast-fail"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "ref" (var "ref"))
(exp "rt" (var "reftype"))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "REF.CAST%" (tup (var "rt")))
)
)
)
(list (case "TRAP" (tup)))
)
else
)
(rule
"struct.new_default"
(exp "z" (var "state"))
(exp "x" (var "idx"))
(exp "val*" (iter (var "val") list))
(exp "mut?*" (iter (iter (var "mut") opt) list))
(exp "zt*" (iter (var "storagetype") list))
"%~>%"
(tup
(case
"%;%"
(tup (var "z") (list (case "STRUCT.NEW_DEFAULT%" (tup (var "x")))))
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list (case "STRUCT.NEW%" (tup (var "x"))))
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt")
)
)
list
(dom "mut?" (var "mut?*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
)
(iter
(if
(cmp
eq
bool
(call "default_" (exp (call "unpack" (exp (var "zt")))))
(opt (var "val"))
)
)
list
(dom "val" (var "val*"))
(dom "zt" (var "zt*"))
)
)
(rule
"struct.get-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
(exp "i" (var "u32"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case
"STRUCT.GET%%%"
(tup
(iter (var "sx") opt (dom "sx" (var "sx?")))
(var "x")
(var "i")
)
)
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"struct.get-struct"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(exp "zt*" (iter (var "storagetype") list))
(exp "mut?*" (iter (iter (var "mut") opt) list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.STRUCT_ADDR%" (tup (var "a")))
(case
"STRUCT.GET%%%"
(tup
(iter (var "sx") opt (dom "sx" (var "sx?")))
(var "x")
(var "i")
)
)
)
)
)
(list
(sub
(var "val")
(var "instr")
(call
"unpackfield_"
(exp
(idx
(iter (var "zt") list (dom "zt" (var "zt*")))
(proj (uncase (var "i") "%") 0)
)
)
(exp (iter (var "sx") opt (dom "sx" (var "sx?"))))
(exp
(idx
(dot
(idx (call "structinst" (exp (var "z"))) (var "a"))
"FIELDS"
)
(proj (uncase (var "i") "%") 0)
)
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt")
)
)
list
(dom "mut?" (var "mut?*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
)
)
(rule
"array.new_default"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "val" (var "val"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.NEW_DEFAULT%" (tup (var "x")))
)
)
)
(cat
(iter (sub (var "val") (var "instr") (var "val")) (listn (var "n")))
(list
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(cmp
eq
bool
(call "default_" (exp (call "unpack" (exp (var "zt")))))
(opt (var "val"))
)
)
)
(rule
"array.new_elem-oob"
(exp "z" (var "state"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.NEW_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (call "elem" (exp (var "z")) (exp (var "y"))) "REFS"))
)
)
)
(rule
"array.new_elem-alloc"
(exp "z" (var "state"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "ref*" (iter (var "ref") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.NEW_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(cat
(iter
(sub (var "ref") (var "instr") (var "ref"))
(listn (var "n"))
(dom "ref" (var "ref*"))
)
(list
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
)
)
(if
(cmp
eq
bool
(iter (var "ref") (listn (var "n")) (dom "ref" (var "ref*")))
(slice
(dot (call "elem" (exp (var "z")) (exp (var "y"))) "REFS")
(proj (uncase (var "i") "%") 0)
(var "n")
)
)
)
)
(rule
"array.new_data-oob"
(exp "z" (var "state"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.NEW_DATA%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(cmp
gt
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(cvt
rat
nat
(bin
div
rat
(cvt
nat
rat
(bin mul nat (var "n") (call "zsize" (exp (var "zt"))))
)
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "data" (exp (var "z")) (exp (var "y"))) "BYTES"))
)
)
)
(rule
"array.new_data-num"
(exp "z" (var "state"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "c*" (iter (var "lit_" (exp (var "zt"))) list))
(exp "mut?" (iter (var "mut") opt))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.NEW_DATA%%" (tup (var "x") (var "y")))
)
)
)
(cat
(iter
(call
"const"
(exp (call "cunpack" (exp (var "zt"))))
(exp (call "cunpacknum_" (exp (var "zt")) (exp (var "c"))))
)
(listn (var "n"))
(dom "c" (var "c*"))
)
(list
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(cmp
eq
bool
(call
"concatn_"
(typ (var "byte"))
(exp
(iter
(call "zbytes_" (exp (var "zt")) (exp (var "c")))
(listn (var "n"))
(dom "c" (var "c*"))
)
)
(exp
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "zsize" (exp (var "zt"))))
(cvt nat rat (num (nat 8)))
)
)
)
)
(slice
(dot (call "data" (exp (var "z")) (exp (var "y"))) "BYTES")
(proj (uncase (var "i") "%") 0)
(cvt
rat
nat
(bin
div
rat
(cvt
nat
rat
(bin mul nat (var "n") (call "zsize" (exp (var "zt"))))
)
(cvt nat rat (num (nat 8)))
)
)
)
)
)
)
(rule
"array.get-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x"))
)
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.get-oob"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x"))
)
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
ge
nat
(proj (uncase (var "i") "%") 0)
(len (dot (idx (call "arrayinst" (exp (var "z"))) (var "a")) "FIELDS"))
)
)
)
(rule
"array.get-array"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "sx?" (iter (var "sx") opt))
(exp "x" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x"))
)
)
)
)
(list
(sub
(var "val")
(var "instr")
(call
"unpackfield_"
(exp (var "zt"))
(exp (iter (var "sx") opt (dom "sx" (var "sx?"))))
(exp
(idx
(dot
(idx (call "arrayinst" (exp (var "z"))) (var "a"))
"FIELDS"
)
(proj (uncase (var "i") "%") 0)
)
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
)
(rule
"array.len-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list (case "REF.NULL%" (tup (var "ht"))) (case "ARRAY.LEN" (tup)))
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.len-array"
(exp "z" (var "state"))
(exp "a" (var "addr"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "ARRAY.LEN" (tup))
)
)
)
(list
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(len
(dot
(idx (call "arrayinst" (exp (var "z"))) (var "a"))
"FIELDS"
)
)
)
)
)
)
)
)
)
(rule
"array.fill-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.FILL%" (tup (var "x")))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.fill-oob"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.FILL%" (tup (var "x")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (idx (call "arrayinst" (exp (var "z"))) (var "a")) "FIELDS"))
)
)
)
(rule
"array.fill-zero"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.FILL%" (tup (var "x")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"array.fill-succ"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.FILL%" (tup (var "x")))
)
)
)
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "ARRAY.SET%" (tup (var "x")))
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(sub (var "val") (var "instr") (var "val"))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "ARRAY.FILL%" (tup (var "x")))
)
)
else
)
(rule
"array.copy-null1"
(exp "z" (var "state"))
(exp "ht_1" (var "heaptype"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "ref" (var "ref"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(sub (var "ref") (var "instr") (var "ref"))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.copy-null2"
(exp "z" (var "state"))
(exp "ref" (var "ref"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "ht_2" (var "heaptype"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(sub (var "ref") (var "instr") (var "ref"))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.NULL%" (tup (var "ht_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.copy-oob1"
(exp "z" (var "state"))
(exp "a_1" (var "addr"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "a_2" (var "addr"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i_1") "%") 0) (var "n"))
(len
(dot (idx (call "arrayinst" (exp (var "z"))) (var "a_1")) "FIELDS")
)
)
)
)
(rule
"array.copy-oob2"
(exp "z" (var "state"))
(exp "a_1" (var "addr"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "a_2" (var "addr"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i_2") "%") 0) (var "n"))
(len
(dot (idx (call "arrayinst" (exp (var "z"))) (var "a_2")) "FIELDS")
)
)
)
)
(rule
"array.copy-zero"
(exp "z" (var "state"))
(exp "a_1" (var "addr"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "a_2" (var "addr"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"array.copy-le"
(exp "z" (var "state"))
(exp "a_1" (var "addr"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "a_2" (var "addr"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(exp "sx?" (iter (var "sx") opt))
(exp "mut?" (iter (var "mut") opt))
(exp "zt_2" (var "storagetype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x_2"))
)
(case "ARRAY.SET%" (tup (var "x_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(bin add nat (proj (uncase (var "i_1") "%") 0) (num (nat 1)))
)
)
)
)
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(bin add nat (proj (uncase (var "i_2") "%") 0) (num (nat 1)))
)
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
else
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x_2")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt_2"))
)
)
)
)
)
(if
(bin
and
bool
(cmp
le
nat
(proj (uncase (var "i_1") "%") 0)
(proj (uncase (var "i_2") "%") 0)
)
(cmp
eq
bool
(iter (var "sx") opt (dom "sx" (var "sx?")))
(call "sx" (exp (var "zt_2")))
)
)
)
)
(rule
"array.copy-gt"
(exp "z" (var "state"))
(exp "a_1" (var "addr"))
(exp "i_1" (var "num_" (exp (case "I32" (tup)))))
(exp "a_2" (var "addr"))
(exp "i_2" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(exp "sx?" (iter (var "sx") opt))
(exp "mut?" (iter (var "mut") opt))
(exp "zt_2" (var "storagetype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
)
(list
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt
nat
int
(bin add nat (proj (uncase (var "i_1") "%") 0) (var "n"))
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt
nat
int
(bin add nat (proj (uncase (var "i_2") "%") 0) (var "n"))
)
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case
"ARRAY.GET%%"
(tup (iter (var "sx") opt (dom "sx" (var "sx?"))) (var "x_2"))
)
(case "ARRAY.SET%" (tup (var "x_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_1")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_1")))
(case "REF.ARRAY_ADDR%" (tup (var "a_2")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i_2")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
)
else
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x_2")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt_2"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "sx") opt (dom "sx" (var "sx?")))
(call "sx" (exp (var "zt_2")))
)
)
)
(rule
"array.init_elem-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.init_elem-oob1"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (idx (call "arrayinst" (exp (var "z"))) (var "a")) "FIELDS"))
)
)
)
(rule
"array.init_elem-oob2"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "j") "%") 0) (var "n"))
(len (dot (call "elem" (exp (var "z")) (exp (var "y"))) "REFS"))
)
)
)
(rule
"array.init_elem-zero"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"array.init_elem-succ"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "ref" (var "ref"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
)
)
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "ref") (var "instr") (var "ref"))
(case "ARRAY.SET%" (tup (var "x")))
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup (bin add nat (proj (uncase (var "j") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
)
else
(if
(cmp
eq
bool
(var "ref")
(idx
(dot (call "elem" (exp (var "z")) (exp (var "y"))) "REFS")
(proj (uncase (var "j") "%") 0)
)
)
)
)
(rule
"array.init_data-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
)
(rule
"array.init_data-oob1"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(if
(cmp
gt
nat
(bin add nat (proj (uncase (var "i") "%") 0) (var "n"))
(len (dot (idx (call "arrayinst" (exp (var "z"))) (var "a")) "FIELDS"))
)
)
)
(rule
"array.init_data-oob2"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
)
)
(list (case "TRAP" (tup)))
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(cmp
gt
nat
(bin
add
nat
(proj (uncase (var "j") "%") 0)
(cvt
rat
nat
(bin
div
rat
(cvt
nat
rat
(bin mul nat (var "n") (call "zsize" (exp (var "zt"))))
)
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "data" (exp (var "z")) (exp (var "y"))) "BYTES"))
)
)
)
(rule
"array.init_data-zero"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
)
)
(list)
)
else
(if (cmp eq bool (var "n") (num (nat 0))))
)
(rule
"array.init_data-num"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "j" (var "num_" (exp (case "I32" (tup)))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "c" (var "lit_" (exp (var "zt"))))
(exp "mut?" (iter (var "mut") opt))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(case "CONST%%" (tup (case "I32" (tup)) (var "j")))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
)
)
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(call
"const"
(exp (call "cunpack" (exp (var "zt"))))
(exp (call "cunpacknum_" (exp (var "zt")) (exp (var "c"))))
)
(case "ARRAY.SET%" (tup (var "x")))
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup (bin add nat (proj (uncase (var "i") "%") 0) (num (nat 1))))
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(bin
add
nat
(proj (uncase (var "j") "%") 0)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "zsize" (exp (var "zt"))))
(cvt nat rat (num (nat 8)))
)
)
)
)
)
)
)
(case
"CONST%%"
(tup
(case "I32" (tup))
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
)
else
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(cmp
eq
bool
(call "zbytes_" (exp (var "zt")) (exp (var "c")))
(slice
(dot (call "data" (exp (var "z")) (exp (var "y"))) "BYTES")
(proj (uncase (var "j") "%") 0)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "zsize" (exp (var "zt"))))
(cvt nat rat (num (nat 8)))
)
)
)
)
)
)
)
(rec
(rel
"Step"
"%~>%"
(tup (bind (var "_") (var "config")) (bind (var "_") (var "config")))
(rule
"pure"
(exp "z" (var "state"))
(exp "instr*" (iter (var "instr") list))
(exp "instr'*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup (var "z") (iter (var "instr") list (dom "instr" (var "instr*"))))
)
(case
"%;%"
(tup
(var "z")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
(rule
"Step_pure"
"%~>%"
(tup
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
(rule
"read"
(exp "z" (var "state"))
(exp "instr*" (iter (var "instr") list))
(exp "instr'*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup (var "z") (iter (var "instr") list (dom "instr" (var "instr*"))))
)
(case
"%;%"
(tup
(var "z")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
(rule
"Step_read"
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
(rule
"ctxt-instrs"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "instr*" (iter (var "instr") list))
(exp "instr_1*" (iter (var "instr") list))
(exp "z'" (var "state"))
(exp "instr'*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
)
)
)
)
(case
"%;%"
(tup
(var "z'")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(cat
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
)
)
)
)
)
(rule
"Step"
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%;%"
(tup
(var "z'")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
)
(if
(bin
or
bool
(cmp ne bool (iter (var "val") list (dom "val" (var "val*"))) (list))
(cmp
ne
bool
(iter (var "instr_1") list (dom "instr_1" (var "instr_1*")))
(list)
)
)
)
)
(rule
"ctxt-label"
(exp "z" (var "state"))
(exp "n" (var "n"))
(exp "instr_0*" (iter (var "instr") list))
(exp "instr*" (iter (var "instr") list))
(exp "z'" (var "state"))
(exp "instr'*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr_0") list (dom "instr_0" (var "instr_0*")))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(case
"%;%"
(tup
(var "z'")
(list
(case
"LABEL_%{%}%"
(tup
(var "n")
(iter (var "instr_0") list (dom "instr_0" (var "instr_0*")))
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
)
)
)
(rule
"Step"
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%;%"
(tup
(var "z'")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
)
)
(rule
"ctxt-frame"
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "n" (var "n"))
(exp "f'" (var "frame"))
(exp "instr*" (iter (var "instr") list))
(exp "s'" (var "store"))
(exp "f''" (var "frame"))
(exp "instr'*" (iter (var "instr") list))
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f")))
(list
(case
"FRAME_%{%}%"
(tup
(var "n")
(var "f'")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(case
"%;%"
(tup
(case "%;%" (tup (var "s'") (var "f")))
(list
(case
"FRAME_%{%}%"
(tup
(var "n")
(var "f''")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
)
)
)
(rule
"Step"
"%~>%"
(tup
(case
"%;%"
(tup
(case "%;%" (tup (var "s") (var "f'")))
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%;%"
(tup
(case "%;%" (tup (var "s'") (var "f''")))
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
)
)
(rule
"throw"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "exn" (var "exninst"))
(exp "a" (var "addr"))
(exp "t*" (iter (var "valtype") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(list (case "THROW%" (tup (var "x"))))
)
)
)
(case
"%;%"
(tup
(call "add_exninst" (exp (var "z")) (exp (list (var "exn"))))
(list
(case "REF.EXN_ADDR%" (tup (var "a")))
(case "THROW_REF" (tup))
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call
"as_deftype"
(exp (dot (call "tag" (exp (var "z")) (exp (var "x"))) "TYPE"))
)
(case
"FUNC%->%"
(tup
(case
"%"
(tup (iter (var "t") (listn (var "n")) (dom "t" (var "t*"))))
)
(case "%" (tup (list)))
)
)
)
)
(if (cmp eq bool (var "a") (len (call "exninst" (exp (var "z"))))))
(if
(cmp
eq
bool
(var "exn")
(struct
(field
"TAG"
(idx
(call "tagaddr" (exp (var "z")))
(proj (uncase (var "x") "%") 0)
)
)
(field
"FIELDS"
(iter (var "val") (listn (var "n")) (dom "val" (var "val*")))
)
)
)
)
)
(rule
"local.set"
(exp "z" (var "state"))
(exp "val" (var "val"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(sub (var "val") (var "instr") (var "val"))
(case "LOCAL.SET%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(call
"with_local"
(exp (var "z"))
(exp (var "x"))
(exp (var "val"))
)
(list)
)
)
)
)
(rule
"global.set"
(exp "z" (var "state"))
(exp "val" (var "val"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(sub (var "val") (var "instr") (var "val"))
(case "GLOBAL.SET%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(call
"with_global"
(exp (var "z"))
(exp (var "x"))
(exp (var "val"))
)
(list)
)
)
)
)
(rule
"table.set-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "ref" (var "ref"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(sub (var "ref") (var "instr") (var "ref"))
(case "TABLE.SET%" (tup (var "x")))
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
(if
(cmp
ge
nat
(proj (uncase (var "i") "%") 0)
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
)
)
)
(rule
"table.set-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "ref" (var "ref"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(sub (var "ref") (var "instr") (var "ref"))
(case "TABLE.SET%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(call
"with_table"
(exp (var "z"))
(exp (var "x"))
(exp (proj (uncase (var "i") "%") 0))
(exp (var "ref"))
)
(list)
)
)
)
(if
(cmp
lt
nat
(proj (uncase (var "i") "%") 0)
(len (dot (call "table" (exp (var "z")) (exp (var "x"))) "REFS"))
)
)
)
(rule
"table.grow-succeed"
(exp "z" (var "state"))
(exp "ref" (var "ref"))
(exp "at" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "ti" (var "tableinst"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(sub (var "ref") (var "instr") (var "ref"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.GROW%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(call
"with_tableinst"
(exp (var "z"))
(exp (var "x"))
(exp (var "ti"))
)
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup
(len
(dot
(call "table" (exp (var "z")) (exp (var "x")))
"REFS"
)
)
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(var "ti")
(call
"growtable"
(exp (call "table" (exp (var "z")) (exp (var "x"))))
(exp (var "n"))
(exp (var "ref"))
)
)
)
)
(rule
"table.grow-fail"
(exp "z" (var "state"))
(exp "ref" (var "ref"))
(exp "at" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(sub (var "ref") (var "instr") (var "ref"))
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "TABLE.GROW%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup
(call
"inv_signed_"
(exp
(call
"size"
(exp
(sub (var "addrtype") (var "numtype") (var "at"))
)
)
)
(exp (un minus int (cvt nat int (num (nat 1)))))
)
)
)
)
)
)
)
)
)
)
(rule
"elem.drop"
(exp "z" (var "state"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "ELEM.DROP%" (tup (var "x"))))))
(case
"%;%"
(tup
(call "with_elem" (exp (var "z")) (exp (var "x")) (exp (list)))
(list)
)
)
)
)
(rule
"store-num-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "nt" (var "numtype"))
(exp "c" (var "num_" (exp (var "nt"))))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case "CONST%%" (tup (var "nt") (var "c")))
(case "STORE%%%%" (tup (var "nt") (opt) (var "x") (var "ao")))
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "size" (exp (var "nt"))))
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"store-num-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "nt" (var "numtype"))
(exp "c" (var "num_" (exp (var "nt"))))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "b*" (iter (var "byte") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case "CONST%%" (tup (var "nt") (var "c")))
(case "STORE%%%%" (tup (var "nt") (opt) (var "x") (var "ao")))
)
)
)
(case
"%;%"
(tup
(call
"with_mem"
(exp (var "z"))
(exp (var "x"))
(exp
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
)
(exp
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "size" (exp (var "nt"))))
(cvt nat rat (num (nat 8)))
)
)
)
(exp (iter (var "b") list (dom "b" (var "b*"))))
)
(list)
)
)
)
(if
(cmp
eq
bool
(iter (var "b") list (dom "b" (var "b*")))
(call "nbytes_" (exp (var "nt")) (exp (var "c")))
)
)
)
(rule
"store-pack-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "Inn" (var "Inn"))
(exp "c" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case
"CONST%%"
(tup (sub (var "Inn") (var "numtype") (var "Inn")) (var "c"))
)
(case
"STORE%%%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(opt (case "%" (tup (case "%" (tup (var "n"))))))
(var "x")
(var "ao")
)
)
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin div rat (cvt nat rat (var "n")) (cvt nat rat (num (nat 8))))
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"store-pack-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "Inn" (var "Inn"))
(exp "c" (var "num_" (exp (sub (var "Inn") (var "numtype") (var "Inn")))))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "b*" (iter (var "byte") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case
"CONST%%"
(tup (sub (var "Inn") (var "numtype") (var "Inn")) (var "c"))
)
(case
"STORE%%%%"
(tup
(sub (var "Inn") (var "numtype") (var "Inn"))
(opt (case "%" (tup (case "%" (tup (var "n"))))))
(var "x")
(var "ao")
)
)
)
)
)
(case
"%;%"
(tup
(call
"with_mem"
(exp (var "z"))
(exp (var "x"))
(exp
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
)
(exp
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (var "n"))
(cvt nat rat (num (nat 8)))
)
)
)
(exp (iter (var "b") list (dom "b" (var "b*"))))
)
(list)
)
)
)
(if
(cmp
eq
bool
(iter (var "b") list (dom "b" (var "b*")))
(call
"ibytes_"
(exp (var "n"))
(exp
(call
"wrap__"
(exp
(call
"size"
(exp (sub (var "Inn") (var "numtype") (var "Inn")))
)
)
(exp (var "n"))
(exp (var "c"))
)
)
)
)
)
)
(rule
"vstore-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case "VCONST%%" (tup (case "V128" (tup)) (var "c")))
(case "VSTORE%%%" (tup (case "V128" (tup)) (var "x") (var "ao")))
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "vsize" (exp (case "V128" (tup)))))
(cvt nat rat (num (nat 8)))
)
)
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vstore-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "b*" (iter (var "byte") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case "VCONST%%" (tup (case "V128" (tup)) (var "c")))
(case "VSTORE%%%" (tup (case "V128" (tup)) (var "x") (var "ao")))
)
)
)
(case
"%;%"
(tup
(call
"with_mem"
(exp (var "z"))
(exp (var "x"))
(exp
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
)
(exp
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (call "vsize" (exp (case "V128" (tup)))))
(cvt nat rat (num (nat 8)))
)
)
)
(exp (iter (var "b") list (dom "b" (var "b*"))))
)
(list)
)
)
)
(if
(cmp
eq
bool
(iter (var "b") list (dom "b" (var "b*")))
(call "vbytes_" (exp (case "V128" (tup))) (exp (var "c")))
)
)
)
(rule
"vstore_lane-oob"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "j" (var "laneidx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case "VCONST%%" (tup (case "V128" (tup)) (var "c")))
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (var "N")))
(var "x")
(var "ao")
(var "j")
)
)
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
(if
(cmp
gt
nat
(bin
add
nat
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
(var "N")
)
(len (dot (call "mem" (exp (var "z")) (exp (var "x"))) "BYTES"))
)
)
)
(rule
"vstore_lane-val"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp
"i"
(var "num_" (exp (sub (var "addrtype") (var "numtype") (var "at"))))
)
(exp "c" (var "vec_" (exp (case "V128" (tup)))))
(exp "N" (var "N"))
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "j" (var "laneidx"))
(exp "b*" (iter (var "byte") list))
(exp "Jnn" (var "Jnn"))
(exp "M" (var "M"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(var "i")
)
)
(case "VCONST%%" (tup (case "V128" (tup)) (var "c")))
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (var "N")))
(var "x")
(var "ao")
(var "j")
)
)
)
)
)
(case
"%;%"
(tup
(call
"with_mem"
(exp (var "z"))
(exp (var "x"))
(exp
(bin
add
nat
(proj (uncase (var "i") "%") 0)
(proj (uncase (dot (var "ao") "OFFSET") "%") 0)
)
)
(exp
(cvt
rat
nat
(bin
div
rat
(cvt nat rat (var "N"))
(cvt nat rat (num (nat 8)))
)
)
)
(exp (iter (var "b") list (dom "b" (var "b*"))))
)
(list)
)
)
)
(if (cmp eq bool (var "N") (call "jsize" (exp (var "Jnn")))))
(if
(cmp
eq
bool
(cvt nat rat (var "M"))
(bin div rat (cvt nat rat (num (nat 128))) (cvt nat rat (var "N")))
)
)
(if
(cmp
eq
bool
(iter (var "b") list (dom "b" (var "b*")))
(call
"ibytes_"
(exp (var "N"))
(exp
(case
"%"
(tup
(proj
(uncase
(idx
(call
"lanes_"
(exp
(case
"%X%"
(tup
(sub (var "Jnn") (var "lanetype") (var "Jnn"))
(case "%" (tup (var "M")))
)
)
)
(exp (var "c"))
)
(proj (uncase (var "j") "%") 0)
)
"%"
)
0
)
)
)
)
)
)
)
)
(rule
"memory.grow-succeed"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "mi" (var "meminst"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.GROW%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(call
"with_meminst"
(exp (var "z"))
(exp (var "x"))
(exp (var "mi"))
)
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup
(cvt
rat
nat
(bin
div
rat
(cvt
nat
rat
(len
(dot
(call "mem" (exp (var "z")) (exp (var "x")))
"BYTES"
)
)
)
(cvt nat rat (bin mul nat (num (nat 64)) (call "Ki")))
)
)
)
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(var "mi")
(call
"growmem"
(exp (call "mem" (exp (var "z")) (exp (var "x"))))
(exp (var "n"))
)
)
)
)
(rule
"memory.grow-fail"
(exp "z" (var "state"))
(exp "at" (var "addrtype"))
(exp "n" (var "n"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case "%" (tup (var "n")))
)
)
(case "MEMORY.GROW%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(var "z")
(list
(case
"CONST%%"
(tup
(sub (var "addrtype") (var "numtype") (var "at"))
(case
"%"
(tup
(call
"inv_signed_"
(exp
(call
"size"
(exp
(sub (var "addrtype") (var "numtype") (var "at"))
)
)
)
(exp (un minus int (cvt nat int (num (nat 1)))))
)
)
)
)
)
)
)
)
)
)
(rule
"data.drop"
(exp "z" (var "state"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case "%;%" (tup (var "z") (list (case "DATA.DROP%" (tup (var "x"))))))
(case
"%;%"
(tup
(call "with_data" (exp (var "z")) (exp (var "x")) (exp (list)))
(list)
)
)
)
)
(rule
"struct.new"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "si" (var "structinst"))
(exp "a" (var "addr"))
(exp "mut?*" (iter (iter (var "mut") opt) list))
(exp "zt*" (iter (var "storagetype") list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(list (case "STRUCT.NEW%" (tup (var "x"))))
)
)
)
(case
"%;%"
(tup
(call "add_structinst" (exp (var "z")) (exp (list (var "si"))))
(list (case "REF.STRUCT_ADDR%" (tup (var "a"))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt")
)
)
(listn (var "n"))
(dom "mut?" (var "mut?*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
)
(if (cmp eq bool (var "a") (len (call "structinst" (exp (var "z"))))))
(if
(cmp
eq
bool
(var "si")
(struct
(field "TYPE" (call "type" (exp (var "z")) (exp (var "x"))))
(field
"FIELDS"
(iter
(call "packfield_" (exp (var "zt")) (exp (var "val")))
(listn (var "n"))
(dom "val" (var "val*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
(rule
"struct.set-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "val" (var "val"))
(exp "x" (var "idx"))
(exp "i" (var "u32"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(sub (var "val") (var "instr") (var "val"))
(case "STRUCT.SET%%" (tup (var "x") (var "i")))
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
)
(rule
"struct.set-struct"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "val" (var "val"))
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(exp "zt*" (iter (var "storagetype") list))
(exp "mut?*" (iter (iter (var "mut") opt) list))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.STRUCT_ADDR%" (tup (var "a")))
(sub (var "val") (var "instr") (var "val"))
(case "STRUCT.SET%%" (tup (var "x") (var "i")))
)
)
)
(case
"%;%"
(tup
(call
"with_struct"
(exp (var "z"))
(exp (var "a"))
(exp (proj (uncase (var "i") "%") 0))
(exp
(call
"packfield_"
(exp
(idx
(iter (var "zt") list (dom "zt" (var "zt*")))
(proj (uncase (var "i") "%") 0)
)
)
(exp (var "val"))
)
)
)
(list)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"STRUCT%"
(tup
(case
"%"
(tup
(iter
(case
"%%"
(tup
(iter (var "mut") opt (dom "mut" (var "mut?")))
(var "zt")
)
)
list
(dom "mut?" (var "mut?*"))
(dom "zt" (var "zt*"))
)
)
)
)
)
)
)
)
(rule
"array.new_fixed"
(exp "z" (var "state"))
(exp "val*" (iter (var "val") list))
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "ai" (var "arrayinst"))
(exp "a" (var "addr"))
(exp "mut?" (iter (var "mut") opt))
(exp "zt" (var "storagetype"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
(listn (var "n"))
(dom "val" (var "val*"))
)
(list
(case
"ARRAY.NEW_FIXED%%"
(tup (var "x") (case "%" (tup (var "n"))))
)
)
)
)
)
(case
"%;%"
(tup
(call "add_arrayinst" (exp (var "z")) (exp (list (var "ai"))))
(list (case "REF.ARRAY_ADDR%" (tup (var "a"))))
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
(if
(bin
and
bool
(cmp eq bool (var "a") (len (call "arrayinst" (exp (var "z")))))
(cmp
eq
bool
(var "ai")
(struct
(field "TYPE" (call "type" (exp (var "z")) (exp (var "x"))))
(field
"FIELDS"
(iter
(call "packfield_" (exp (var "zt")) (exp (var "val")))
(listn (var "n"))
(dom "val" (var "val*"))
)
)
)
)
)
)
)
(rule
"array.set-null"
(exp "z" (var "state"))
(exp "ht" (var "heaptype"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.NULL%" (tup (var "ht")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "ARRAY.SET%" (tup (var "x")))
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
)
(rule
"array.set-oob"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "x" (var "idx"))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "ARRAY.SET%" (tup (var "x")))
)
)
)
(case "%;%" (tup (var "z") (list (case "TRAP" (tup)))))
)
(if
(cmp
ge
nat
(proj (uncase (var "i") "%") 0)
(len
(dot (idx (call "arrayinst" (exp (var "z"))) (var "a")) "FIELDS")
)
)
)
)
(rule
"array.set-array"
(exp "z" (var "state"))
(exp "a" (var "addr"))
(exp "i" (var "num_" (exp (case "I32" (tup)))))
(exp "val" (var "val"))
(exp "x" (var "idx"))
(exp "zt" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(list
(case "REF.ARRAY_ADDR%" (tup (var "a")))
(case "CONST%%" (tup (case "I32" (tup)) (var "i")))
(sub (var "val") (var "instr") (var "val"))
(case "ARRAY.SET%" (tup (var "x")))
)
)
)
(case
"%;%"
(tup
(call
"with_array"
(exp (var "z"))
(exp (var "a"))
(exp (proj (uncase (var "i") "%") 0))
(exp (call "packfield_" (exp (var "zt")) (exp (var "val"))))
)
(list)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(call "type" (exp (var "z")) (exp (var "x")))
(case
"ARRAY%"
(tup
(case
"%%"
(tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt"))
)
)
)
)
)
)
)
)
(rec
(rel
"Steps"
"%~>*%"
(tup (bind (var "_") (var "config")) (bind (var "_") (var "config")))
(rule
"refl"
(exp "z" (var "state"))
(exp "instr*" (iter (var "instr") list))
"%~>*%"
(tup
(case
"%;%"
(tup (var "z") (iter (var "instr") list (dom "instr" (var "instr*"))))
)
(case
"%;%"
(tup (var "z") (iter (var "instr") list (dom "instr" (var "instr*"))))
)
)
)
(rule
"trans"
(exp "z" (var "state"))
(exp "instr*" (iter (var "instr") list))
(exp "z''" (var "state"))
(exp "instr''*" (iter (var "instr") list))
(exp "z'" (var "state"))
(exp "instr'*" (iter (var "instr") list))
"%~>*%"
(tup
(case
"%;%"
(tup (var "z") (iter (var "instr") list (dom "instr" (var "instr*"))))
)
(case
"%;%"
(tup
(var "z''")
(iter (var "instr''") list (dom "instr''" (var "instr''*")))
)
)
)
(rule
"Step"
"%~>%"
(tup
(case
"%;%"
(tup
(var "z")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
(case
"%;%"
(tup
(var "z'")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
)
)
(rule
"Steps"
"%~>*%"
(tup
(case
"%;%"
(tup
(var "z'")
(iter (var "instr'") list (dom "instr'" (var "instr'*")))
)
)
(case
"%;%"
(tup
(var "z''")
(iter (var "instr''") list (dom "instr''" (var "instr''*")))
)
)
)
)
)
)
)
(rel
"Eval_expr"
"%;%~>*%;%"
(tup
(bind (var "_") (var "state"))
(bind (var "_") (var "expr"))
(bind (var "_") (var "state"))
(bind (var "_") (iter (var "val") list))
)
(rule
""
(exp "z" (var "state"))
(exp "instr*" (iter (var "instr") list))
(exp "z'" (var "state"))
(exp "val*" (iter (var "val") list))
"%;%~>*%;%"
(tup
(var "z")
(iter (var "instr") list (dom "instr" (var "instr*")))
(var "z'")
(iter (var "val") list (dom "val" (var "val*")))
)
(rule
"Steps"
"%~>*%"
(tup
(case
"%;%"
(tup (var "z") (iter (var "instr") list (dom "instr" (var "instr*"))))
)
(case
"%;%"
(tup
(var "z'")
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
)
)
)
)
)
)
(rec
(def
"alloctypes"
(exp "_" (iter (var "type") list))
(iter (var "deftype") list)
(clause (exp (list)) (list))
(clause
(exp "type'*" (iter (var "type") list))
(exp "type" (var "type"))
(exp "deftype'*" (iter (var "deftype") list))
(exp "deftype*" (iter (var "deftype") list))
(exp "rectype" (var "rectype"))
(exp "x" (var "idx"))
(exp
(cat
(iter (var "type'") list (dom "type'" (var "type'*")))
(list (var "type"))
)
)
(cat
(iter (var "deftype'") list (dom "deftype'" (var "deftype'*")))
(iter (var "deftype") list (dom "deftype" (var "deftype*")))
)
(if
(cmp
eq
bool
(iter (var "deftype'") list (dom "deftype'" (var "deftype'*")))
(call
"alloctypes"
(exp (iter (var "type'") list (dom "type'" (var "type'*"))))
)
)
)
(if (cmp eq bool (var "type") (case "TYPE%" (tup (var "rectype")))))
(if
(cmp
eq
bool
(iter (var "deftype") list (dom "deftype" (var "deftype*")))
(call
"subst_all_deftypes"
(exp (call "rolldt" (exp (var "x")) (exp (var "rectype"))))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "deftype'"))
list
(dom "deftype'" (var "deftype'*"))
)
)
)
)
)
(if
(cmp
eq
bool
(proj (uncase (var "x") "%") 0)
(len (iter (var "deftype'") list (dom "deftype'" (var "deftype'*"))))
)
)
)
)
)
(def
"alloctag"
(exp "store" (var "store"))
(exp "tagtype" (var "tagtype"))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "tagaddr")))
(clause
(exp "s" (var "store"))
(exp "tagtype" (var "tagtype"))
(exp "taginst" (var "taginst"))
(exp (var "s"))
(exp (var "tagtype"))
(tup
(comp
(var "s")
(struct
(field "TAGS" (list (var "taginst")))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "TAGS"))
)
(if (cmp eq bool (var "taginst") (struct (field "TYPE" (var "tagtype")))))
)
)
(rec
(def
"alloctags"
(exp "store" (var "store"))
(exp "_" (iter (var "tagtype") list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "tagaddr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "tagtype" (var "tagtype"))
(exp "tagtype'*" (iter (var "tagtype") list))
(exp "s_2" (var "store"))
(exp "ja" (var "tagaddr"))
(exp "ja'*" (iter (var "tagaddr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat
(list (var "tagtype"))
(iter (var "tagtype'") list (dom "tagtype'" (var "tagtype'*")))
)
)
(tup
(var "s_2")
(cat (list (var "ja")) (iter (var "ja'") list (dom "ja'" (var "ja'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "ja"))
(call "alloctag" (exp (var "s")) (exp (var "tagtype")))
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "ja'") list (dom "ja'" (var "ja'*"))))
(call
"alloctags"
(exp (var "s_1"))
(exp
(iter (var "tagtype'") list (dom "tagtype'" (var "tagtype'*")))
)
)
)
)
)
)
)
(def
"allocglobal"
(exp "store" (var "store"))
(exp "globaltype" (var "globaltype"))
(exp "val" (var "val"))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "globaladdr")))
(clause
(exp "s" (var "store"))
(exp "globaltype" (var "globaltype"))
(exp "val" (var "val"))
(exp "globalinst" (var "globalinst"))
(exp (var "s"))
(exp (var "globaltype"))
(exp (var "val"))
(tup
(comp
(var "s")
(struct
(field "TAGS" (list))
(field "GLOBALS" (list (var "globalinst")))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "GLOBALS"))
)
(if
(cmp
eq
bool
(var "globalinst")
(struct (field "TYPE" (var "globaltype")) (field "VALUE" (var "val")))
)
)
)
)
(rec
(def
"allocglobals"
(exp "store" (var "store"))
(exp "_" (iter (var "globaltype") list))
(exp "_" (iter (var "val") list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "globaladdr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "globaltype" (var "globaltype"))
(exp "globaltype'*" (iter (var "globaltype") list))
(exp "val" (var "val"))
(exp "val'*" (iter (var "val") list))
(exp "s_2" (var "store"))
(exp "ga" (var "globaladdr"))
(exp "ga'*" (iter (var "globaladdr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat
(list (var "globaltype"))
(iter
(var "globaltype'")
list
(dom "globaltype'" (var "globaltype'*"))
)
)
)
(exp
(cat
(list (var "val"))
(iter (var "val'") list (dom "val'" (var "val'*")))
)
)
(tup
(var "s_2")
(cat (list (var "ga")) (iter (var "ga'") list (dom "ga'" (var "ga'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "ga"))
(call
"allocglobal"
(exp (var "s"))
(exp (var "globaltype"))
(exp (var "val"))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "ga'") list (dom "ga'" (var "ga'*"))))
(call
"allocglobals"
(exp (var "s_1"))
(exp
(iter
(var "globaltype'")
list
(dom "globaltype'" (var "globaltype'*"))
)
)
(exp (iter (var "val'") list (dom "val'" (var "val'*"))))
)
)
)
)
)
)
(def
"allocmem"
(exp "store" (var "store"))
(exp "memtype" (var "memtype"))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "memaddr")))
(clause
(exp "s" (var "store"))
(exp "at" (var "addrtype"))
(exp "i" (var "u64"))
(exp "j?" (iter (var "u64") opt))
(exp "meminst" (var "meminst"))
(exp (var "s"))
(exp
(case
"%%PAGE"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i") (iter (var "j") opt (dom "j" (var "j?"))))
)
)
)
)
(tup
(comp
(var "s")
(struct
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list (var "meminst")))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "MEMS"))
)
(if
(cmp
eq
bool
(var "meminst")
(struct
(field
"TYPE"
(case
"%%PAGE"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i") (iter (var "j") opt (dom "j" (var "j?"))))
)
)
)
)
(field
"BYTES"
(iter
(case "%" (tup (num (nat 0))))
(listn
(bin
mul
nat
(proj (uncase (var "i") "%") 0)
(bin mul nat (num (nat 64)) (call "Ki"))
)
)
)
)
)
)
)
)
)
(rec
(def
"allocmems"
(exp "store" (var "store"))
(exp "_" (iter (var "memtype") list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "memaddr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "memtype" (var "memtype"))
(exp "memtype'*" (iter (var "memtype") list))
(exp "s_2" (var "store"))
(exp "ma" (var "memaddr"))
(exp "ma'*" (iter (var "memaddr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat
(list (var "memtype"))
(iter (var "memtype'") list (dom "memtype'" (var "memtype'*")))
)
)
(tup
(var "s_2")
(cat (list (var "ma")) (iter (var "ma'") list (dom "ma'" (var "ma'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "ma"))
(call "allocmem" (exp (var "s")) (exp (var "memtype")))
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "ma'") list (dom "ma'" (var "ma'*"))))
(call
"allocmems"
(exp (var "s_1"))
(exp
(iter (var "memtype'") list (dom "memtype'" (var "memtype'*")))
)
)
)
)
)
)
)
(def
"alloctable"
(exp "store" (var "store"))
(exp "tabletype" (var "tabletype"))
(exp "ref" (var "ref"))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "tableaddr")))
(clause
(exp "s" (var "store"))
(exp "at" (var "addrtype"))
(exp "i" (var "u64"))
(exp "j?" (iter (var "u64") opt))
(exp "rt" (var "reftype"))
(exp "ref" (var "ref"))
(exp "tableinst" (var "tableinst"))
(exp (var "s"))
(exp
(case
"%%%"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i") (iter (var "j") opt (dom "j" (var "j?"))))
)
(var "rt")
)
)
)
(exp (var "ref"))
(tup
(comp
(var "s")
(struct
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list (var "tableinst")))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "TABLES"))
)
(if
(cmp
eq
bool
(var "tableinst")
(struct
(field
"TYPE"
(case
"%%%"
(tup
(var "at")
(case
"[%..%]"
(tup (var "i") (iter (var "j") opt (dom "j" (var "j?"))))
)
(var "rt")
)
)
)
(field
"REFS"
(iter (var "ref") (listn (proj (uncase (var "i") "%") 0)))
)
)
)
)
)
)
(rec
(def
"alloctables"
(exp "store" (var "store"))
(exp "_" (iter (var "tabletype") list))
(exp "_" (iter (var "ref") list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "tableaddr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "tabletype" (var "tabletype"))
(exp "tabletype'*" (iter (var "tabletype") list))
(exp "ref" (var "ref"))
(exp "ref'*" (iter (var "ref") list))
(exp "s_2" (var "store"))
(exp "ta" (var "tableaddr"))
(exp "ta'*" (iter (var "tableaddr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat
(list (var "tabletype"))
(iter (var "tabletype'") list (dom "tabletype'" (var "tabletype'*")))
)
)
(exp
(cat
(list (var "ref"))
(iter (var "ref'") list (dom "ref'" (var "ref'*")))
)
)
(tup
(var "s_2")
(cat (list (var "ta")) (iter (var "ta'") list (dom "ta'" (var "ta'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "ta"))
(call
"alloctable"
(exp (var "s"))
(exp (var "tabletype"))
(exp (var "ref"))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "ta'") list (dom "ta'" (var "ta'*"))))
(call
"alloctables"
(exp (var "s_1"))
(exp
(iter
(var "tabletype'")
list
(dom "tabletype'" (var "tabletype'*"))
)
)
(exp (iter (var "ref'") list (dom "ref'" (var "ref'*"))))
)
)
)
)
)
)
(def
"allocfunc"
(exp "store" (var "store"))
(exp "deftype" (var "deftype"))
(exp "funccode" (var "funccode"))
(exp "moduleinst" (var "moduleinst"))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "funcaddr")))
(clause
(exp "s" (var "store"))
(exp "deftype" (var "deftype"))
(exp "funccode" (var "funccode"))
(exp "moduleinst" (var "moduleinst"))
(exp "funcinst" (var "funcinst"))
(exp (var "s"))
(exp (var "deftype"))
(exp (var "funccode"))
(exp (var "moduleinst"))
(tup
(comp
(var "s")
(struct
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list (var "funcinst")))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "FUNCS"))
)
(if
(cmp
eq
bool
(var "funcinst")
(struct
(field "TYPE" (var "deftype"))
(field "MODULE" (var "moduleinst"))
(field "CODE" (var "funccode"))
)
)
)
)
)
(rec
(def
"allocfuncs"
(exp "store" (var "store"))
(exp "_" (iter (var "deftype") list))
(exp "_" (iter (var "funccode") list))
(exp "_" (iter (var "moduleinst") list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "funcaddr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(exp (list))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "dt" (var "deftype"))
(exp "dt'*" (iter (var "deftype") list))
(exp "funccode" (var "funccode"))
(exp "funccode'*" (iter (var "funccode") list))
(exp "moduleinst" (var "moduleinst"))
(exp "moduleinst'*" (iter (var "moduleinst") list))
(exp "s_2" (var "store"))
(exp "fa" (var "funcaddr"))
(exp "fa'*" (iter (var "funcaddr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat (list (var "dt")) (iter (var "dt'") list (dom "dt'" (var "dt'*"))))
)
(exp
(cat
(list (var "funccode"))
(iter (var "funccode'") list (dom "funccode'" (var "funccode'*")))
)
)
(exp
(cat
(list (var "moduleinst"))
(iter
(var "moduleinst'")
list
(dom "moduleinst'" (var "moduleinst'*"))
)
)
)
(tup
(var "s_2")
(cat (list (var "fa")) (iter (var "fa'") list (dom "fa'" (var "fa'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "fa"))
(call
"allocfunc"
(exp (var "s"))
(exp (var "dt"))
(exp (var "funccode"))
(exp (var "moduleinst"))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "fa'") list (dom "fa'" (var "fa'*"))))
(call
"allocfuncs"
(exp (var "s_1"))
(exp (iter (var "dt'") list (dom "dt'" (var "dt'*"))))
(exp
(iter (var "funccode'") list (dom "funccode'" (var "funccode'*")))
)
(exp
(iter
(var "moduleinst'")
list
(dom "moduleinst'" (var "moduleinst'*"))
)
)
)
)
)
)
)
)
(def
"allocdata"
(exp "store" (var "store"))
(exp "datatype" (var "datatype"))
(exp "_" (iter (var "byte") list))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "dataaddr")))
(clause
(exp "s" (var "store"))
(exp "byte*" (iter (var "byte") list))
(exp "datainst" (var "datainst"))
(exp (var "s"))
(exp (case "OK" (tup)))
(exp (iter (var "byte") list (dom "byte" (var "byte*"))))
(tup
(comp
(var "s")
(struct
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list (var "datainst")))
(field "ELEMS" (list))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "DATAS"))
)
(if
(cmp
eq
bool
(var "datainst")
(struct
(field "BYTES" (iter (var "byte") list (dom "byte" (var "byte*"))))
)
)
)
)
)
(rec
(def
"allocdatas"
(exp "store" (var "store"))
(exp "_" (iter (var "datatype") list))
(exp "_" (iter (iter (var "byte") list) list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "dataaddr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "ok" (var "datatype"))
(exp "ok'*" (iter (var "datatype") list))
(exp "b*" (iter (var "byte") list))
(exp "b'**" (iter (iter (var "byte") list) list))
(exp "s_2" (var "store"))
(exp "da" (var "dataaddr"))
(exp "da'*" (iter (var "dataaddr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat (list (var "ok")) (iter (var "ok'") list (dom "ok'" (var "ok'*"))))
)
(exp
(cat
(list (iter (var "b") list (dom "b" (var "b*"))))
(iter
(iter (var "b'") list (dom "b'" (var "b'*")))
list
(dom "b'*" (var "b'**"))
)
)
)
(tup
(var "s_2")
(cat (list (var "da")) (iter (var "da'") list (dom "da'" (var "da'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "da"))
(call
"allocdata"
(exp (var "s"))
(exp (var "ok"))
(exp (iter (var "b") list (dom "b" (var "b*"))))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "da'") list (dom "da'" (var "da'*"))))
(call
"allocdatas"
(exp (var "s_1"))
(exp (iter (var "ok'") list (dom "ok'" (var "ok'*"))))
(exp
(iter
(iter (var "b'") list (dom "b'" (var "b'*")))
list
(dom "b'*" (var "b'**"))
)
)
)
)
)
)
)
)
(def
"allocelem"
(exp "store" (var "store"))
(exp "elemtype" (var "elemtype"))
(exp "_" (iter (var "ref") list))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "elemaddr")))
(clause
(exp "s" (var "store"))
(exp "elemtype" (var "elemtype"))
(exp "ref*" (iter (var "ref") list))
(exp "eleminst" (var "eleminst"))
(exp (var "s"))
(exp (var "elemtype"))
(exp (iter (var "ref") list (dom "ref" (var "ref*"))))
(tup
(comp
(var "s")
(struct
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list (var "eleminst")))
(field "STRUCTS" (list))
(field "ARRAYS" (list))
(field "EXNS" (list))
)
)
(len (dot (var "s") "ELEMS"))
)
(if
(cmp
eq
bool
(var "eleminst")
(struct
(field "TYPE" (var "elemtype"))
(field "REFS" (iter (var "ref") list (dom "ref" (var "ref*"))))
)
)
)
)
)
(rec
(def
"allocelems"
(exp "store" (var "store"))
(exp "_" (iter (var "elemtype") list))
(exp "_" (iter (iter (var "ref") list) list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "elemaddr") list))
)
(clause
(exp "s" (var "store"))
(exp (var "s"))
(exp (list))
(exp (list))
(tup (var "s") (list))
)
(clause
(exp "s" (var "store"))
(exp "rt" (var "reftype"))
(exp "rt'*" (iter (var "reftype") list))
(exp "ref*" (iter (var "ref") list))
(exp "ref'**" (iter (iter (var "ref") list) list))
(exp "s_2" (var "store"))
(exp "ea" (var "elemaddr"))
(exp "ea'*" (iter (var "elemaddr") list))
(exp "s_1" (var "store"))
(exp (var "s"))
(exp
(cat (list (var "rt")) (iter (var "rt'") list (dom "rt'" (var "rt'*"))))
)
(exp
(cat
(list (iter (var "ref") list (dom "ref" (var "ref*"))))
(iter
(iter (var "ref'") list (dom "ref'" (var "ref'*")))
list
(dom "ref'*" (var "ref'**"))
)
)
)
(tup
(var "s_2")
(cat (list (var "ea")) (iter (var "ea'") list (dom "ea'" (var "ea'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "ea"))
(call
"allocelem"
(exp (var "s"))
(exp (var "rt"))
(exp (iter (var "ref") list (dom "ref" (var "ref*"))))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "ea'") list (dom "ea'" (var "ea'*"))))
(call
"allocelems"
(exp (var "s_1"))
(exp (iter (var "rt'") list (dom "rt'" (var "rt'*"))))
(exp
(iter
(iter (var "ref'") list (dom "ref'" (var "ref'*")))
list
(dom "ref'*" (var "ref'**"))
)
)
)
)
)
)
)
)
(def
"allocexport"
(exp "moduleinst" (var "moduleinst"))
(exp "export" (var "export"))
(var "exportinst")
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "name" (var "name"))
(exp "x" (var "idx"))
(exp (var "moduleinst"))
(exp (case "EXPORT%%" (tup (var "name") (case "TAG%" (tup (var "x"))))))
(struct
(field "NAME" (var "name"))
(field
"ADDR"
(case
"TAG%"
(tup
(idx
(dot (var "moduleinst") "TAGS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
)
)
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "name" (var "name"))
(exp "x" (var "idx"))
(exp (var "moduleinst"))
(exp (case "EXPORT%%" (tup (var "name") (case "GLOBAL%" (tup (var "x"))))))
(struct
(field "NAME" (var "name"))
(field
"ADDR"
(case
"GLOBAL%"
(tup
(idx
(dot (var "moduleinst") "GLOBALS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
)
)
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "name" (var "name"))
(exp "x" (var "idx"))
(exp (var "moduleinst"))
(exp (case "EXPORT%%" (tup (var "name") (case "MEM%" (tup (var "x"))))))
(struct
(field "NAME" (var "name"))
(field
"ADDR"
(case
"MEM%"
(tup
(idx
(dot (var "moduleinst") "MEMS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
)
)
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "name" (var "name"))
(exp "x" (var "idx"))
(exp (var "moduleinst"))
(exp (case "EXPORT%%" (tup (var "name") (case "TABLE%" (tup (var "x"))))))
(struct
(field "NAME" (var "name"))
(field
"ADDR"
(case
"TABLE%"
(tup
(idx
(dot (var "moduleinst") "TABLES")
(proj (uncase (var "x") "%") 0)
)
)
)
)
)
)
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "name" (var "name"))
(exp "x" (var "idx"))
(exp (var "moduleinst"))
(exp (case "EXPORT%%" (tup (var "name") (case "FUNC%" (tup (var "x"))))))
(struct
(field "NAME" (var "name"))
(field
"ADDR"
(case
"FUNC%"
(tup
(idx
(dot (var "moduleinst") "FUNCS")
(proj (uncase (var "x") "%") 0)
)
)
)
)
)
)
)
(def
"allocexports"
(exp "moduleinst" (var "moduleinst"))
(exp "_" (iter (var "export") list))
(iter (var "exportinst") list)
(clause
(exp "moduleinst" (var "moduleinst"))
(exp "export*" (iter (var "export") list))
(exp (var "moduleinst"))
(exp (iter (var "export") list (dom "export" (var "export*"))))
(iter
(call "allocexport" (exp (var "moduleinst")) (exp (var "export")))
list
(dom "export" (var "export*"))
)
)
)
(def
"allocmodule"
(exp "store" (var "store"))
(exp "module" (var "module"))
(exp "_" (iter (var "externaddr") list))
(exp "_" (iter (var "val") list))
(exp "_" (iter (var "ref") list))
(exp "_" (iter (iter (var "ref") list) list))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "moduleinst")))
(clause
(exp "s" (var "store"))
(exp "module" (var "module"))
(exp "externaddr*" (iter (var "externaddr") list))
(exp "val_G*" (iter (var "val") list))
(exp "ref_T*" (iter (var "ref") list))
(exp "ref_E**" (iter (iter (var "ref") list) list))
(exp "s_7" (var "store"))
(exp "moduleinst" (var "moduleinst"))
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "func*" (iter (var "func") list))
(exp "data*" (iter (var "data") list))
(exp "elem*" (iter (var "elem") list))
(exp "start?" (iter (var "start") opt))
(exp "export*" (iter (var "export") list))
(exp "tagtype*" (iter (var "tagtype") list))
(exp "globaltype*" (iter (var "globaltype") list))
(exp "expr_G*" (iter (var "expr") list))
(exp "memtype*" (iter (var "memtype") list))
(exp "tabletype*" (iter (var "tabletype") list))
(exp "expr_T*" (iter (var "expr") list))
(exp "x*" (iter (var "idx") list))
(exp "local**" (iter (iter (var "local") list) list))
(exp "expr_F*" (iter (var "expr") list))
(exp "byte**" (iter (iter (var "byte") list) list))
(exp "datamode*" (iter (var "datamode") list))
(exp "elemtype*" (iter (var "elemtype") list))
(exp "expr_E**" (iter (iter (var "expr") list) list))
(exp "elemmode*" (iter (var "elemmode") list))
(exp "aa_I*" (iter (var "tagaddr") list))
(exp "ga_I*" (iter (var "globaladdr") list))
(exp "ma_I*" (iter (var "memaddr") list))
(exp "ta_I*" (iter (var "tableaddr") list))
(exp "fa_I*" (iter (var "funcaddr") list))
(exp "dt*" (iter (var "deftype") list))
(exp "fa*" (iter nat list))
(exp "i_F*" (iter nat list))
(exp "s_1" (var "store"))
(exp "aa*" (iter (var "tagaddr") list))
(exp "s_2" (var "store"))
(exp "ga*" (iter (var "globaladdr") list))
(exp "s_3" (var "store"))
(exp "ma*" (iter (var "memaddr") list))
(exp "s_4" (var "store"))
(exp "ta*" (iter (var "tableaddr") list))
(exp "s_5" (var "store"))
(exp "da*" (iter (var "dataaddr") list))
(exp "s_6" (var "store"))
(exp "ea*" (iter (var "elemaddr") list))
(exp "xi*" (iter (var "exportinst") list))
(exp (var "s"))
(exp (var "module"))
(exp (iter (var "externaddr") list (dom "externaddr" (var "externaddr*"))))
(exp (iter (var "val_G") list (dom "val_G" (var "val_G*"))))
(exp (iter (var "ref_T") list (dom "ref_T" (var "ref_T*"))))
(exp
(iter
(iter (var "ref_E") list (dom "ref_E" (var "ref_E*")))
list
(dom "ref_E*" (var "ref_E**"))
)
)
(tup (var "s_7") (var "moduleinst"))
(if
(cmp
eq
bool
(var "module")
(case
"MODULE%%%%%%%%%%%"
(tup
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "export") list (dom "export" (var "export*")))
)
)
)
)
(if
(cmp
eq
bool
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter
(case "TAG%" (tup (var "tagtype")))
list
(dom "tagtype" (var "tagtype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "global") list (dom "global" (var "global*")))
(iter
(case "GLOBAL%%" (tup (var "globaltype") (var "expr_G")))
list
(dom "expr_G" (var "expr_G*"))
(dom "globaltype" (var "globaltype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter
(case "MEMORY%" (tup (var "memtype")))
list
(dom "memtype" (var "memtype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "table") list (dom "table" (var "table*")))
(iter
(case "TABLE%%" (tup (var "tabletype") (var "expr_T")))
list
(dom "expr_T" (var "expr_T*"))
(dom "tabletype" (var "tabletype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "func") list (dom "func" (var "func*")))
(iter
(case
"FUNC%%%"
(tup
(var "x")
(iter (var "local") list (dom "local" (var "local*")))
(var "expr_F")
)
)
list
(dom "expr_F" (var "expr_F*"))
(dom "local*" (var "local**"))
(dom "x" (var "x*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "data") list (dom "data" (var "data*")))
(iter
(case
"DATA%%"
(tup
(iter (var "byte") list (dom "byte" (var "byte*")))
(var "datamode")
)
)
list
(dom "byte*" (var "byte**"))
(dom "datamode" (var "datamode*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter
(case
"ELEM%%%"
(tup
(var "elemtype")
(iter (var "expr_E") list (dom "expr_E" (var "expr_E*")))
(var "elemmode")
)
)
list
(dom "elemmode" (var "elemmode*"))
(dom "elemtype" (var "elemtype*"))
(dom "expr_E*" (var "expr_E**"))
)
)
)
(if
(cmp
eq
bool
(iter (var "aa_I") list (dom "aa_I" (var "aa_I*")))
(call
"tagsxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "ga_I") list (dom "ga_I" (var "ga_I*")))
(call
"globalsxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "ma_I") list (dom "ma_I" (var "ma_I*")))
(call
"memsxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "ta_I") list (dom "ta_I" (var "ta_I*")))
(call
"tablesxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "fa_I") list (dom "fa_I" (var "fa_I*")))
(call
"funcsxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "dt") list (dom "dt" (var "dt*")))
(call
"alloctypes"
(exp (iter (var "type") list (dom "type" (var "type*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "fa") list (dom "fa" (var "fa*")))
(iter
(bin add nat (len (dot (var "s") "FUNCS")) (var "i_F"))
(listn
(len (iter (var "func") list (dom "func" (var "func*"))))
"i_F"
)
(dom "i_F" (var "i_F*"))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_1") (iter (var "aa") list (dom "aa" (var "aa*"))))
(call
"alloctags"
(exp (var "s"))
(exp
(iter
(call
"subst_all_tagtype"
(exp (var "tagtype"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
list
(dom "tagtype" (var "tagtype*"))
)
)
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "ga") list (dom "ga" (var "ga*"))))
(call
"allocglobals"
(exp (var "s_1"))
(exp
(iter
(call
"subst_all_globaltype"
(exp (var "globaltype"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
list
(dom "globaltype" (var "globaltype*"))
)
)
(exp (iter (var "val_G") list (dom "val_G" (var "val_G*"))))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_3") (iter (var "ma") list (dom "ma" (var "ma*"))))
(call
"allocmems"
(exp (var "s_2"))
(exp
(iter
(call
"subst_all_memtype"
(exp (var "memtype"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
list
(dom "memtype" (var "memtype*"))
)
)
)
)
)
(if
(cmp
eq
bool
(tup (var "s_4") (iter (var "ta") list (dom "ta" (var "ta*"))))
(call
"alloctables"
(exp (var "s_3"))
(exp
(iter
(call
"subst_all_tabletype"
(exp (var "tabletype"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
list
(dom "tabletype" (var "tabletype*"))
)
)
(exp (iter (var "ref_T") list (dom "ref_T" (var "ref_T*"))))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_5") (iter (var "da") list (dom "da" (var "da*"))))
(call
"allocdatas"
(exp (var "s_4"))
(exp
(iter
(case "OK" (tup))
(listn (len (iter (var "data") list (dom "data" (var "data*")))))
)
)
(exp
(iter
(iter (var "byte") list (dom "byte" (var "byte*")))
list
(dom "byte*" (var "byte**"))
)
)
)
)
)
(if
(cmp
eq
bool
(tup (var "s_6") (iter (var "ea") list (dom "ea" (var "ea*"))))
(call
"allocelems"
(exp (var "s_5"))
(exp
(iter
(call
"subst_all_reftype"
(exp (var "elemtype"))
(exp
(iter
(sub (var "deftype") (var "typeuse") (var "dt"))
list
(dom "dt" (var "dt*"))
)
)
)
list
(dom "elemtype" (var "elemtype*"))
)
)
(exp
(iter
(iter (var "ref_E") list (dom "ref_E" (var "ref_E*")))
list
(dom "ref_E*" (var "ref_E**"))
)
)
)
)
)
(if
(cmp
eq
bool
(tup (var "s_7") (iter (var "fa") list (dom "fa" (var "fa*"))))
(call
"allocfuncs"
(exp (var "s_6"))
(exp
(iter
(idx
(iter (var "dt") list (dom "dt" (var "dt*")))
(proj (uncase (var "x") "%") 0)
)
list
(dom "x" (var "x*"))
)
)
(exp
(iter
(case
"FUNC%%%"
(tup
(var "x")
(iter (var "local") list (dom "local" (var "local*")))
(var "expr_F")
)
)
list
(dom "expr_F" (var "expr_F*"))
(dom "local*" (var "local**"))
(dom "x" (var "x*"))
)
)
(exp
(iter
(var "moduleinst")
(listn (len (iter (var "func") list (dom "func" (var "func*")))))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "xi") list (dom "xi" (var "xi*")))
(call
"allocexports"
(exp
(struct
(field "TYPES" (list))
(field
"TAGS"
(cat
(iter (var "aa_I") list (dom "aa_I" (var "aa_I*")))
(iter (var "aa") list (dom "aa" (var "aa*")))
)
)
(field
"GLOBALS"
(cat
(iter (var "ga_I") list (dom "ga_I" (var "ga_I*")))
(iter (var "ga") list (dom "ga" (var "ga*")))
)
)
(field
"MEMS"
(cat
(iter (var "ma_I") list (dom "ma_I" (var "ma_I*")))
(iter (var "ma") list (dom "ma" (var "ma*")))
)
)
(field
"TABLES"
(cat
(iter (var "ta_I") list (dom "ta_I" (var "ta_I*")))
(iter (var "ta") list (dom "ta" (var "ta*")))
)
)
(field
"FUNCS"
(cat
(iter (var "fa_I") list (dom "fa_I" (var "fa_I*")))
(iter (var "fa") list (dom "fa" (var "fa*")))
)
)
(field "DATAS" (list))
(field "ELEMS" (list))
(field "EXPORTS" (list))
)
)
(exp (iter (var "export") list (dom "export" (var "export*"))))
)
)
)
(if
(cmp
eq
bool
(var "moduleinst")
(struct
(field "TYPES" (iter (var "dt") list (dom "dt" (var "dt*"))))
(field
"TAGS"
(cat
(iter (var "aa_I") list (dom "aa_I" (var "aa_I*")))
(iter (var "aa") list (dom "aa" (var "aa*")))
)
)
(field
"GLOBALS"
(cat
(iter (var "ga_I") list (dom "ga_I" (var "ga_I*")))
(iter (var "ga") list (dom "ga" (var "ga*")))
)
)
(field
"MEMS"
(cat
(iter (var "ma_I") list (dom "ma_I" (var "ma_I*")))
(iter (var "ma") list (dom "ma" (var "ma*")))
)
)
(field
"TABLES"
(cat
(iter (var "ta_I") list (dom "ta_I" (var "ta_I*")))
(iter (var "ta") list (dom "ta" (var "ta*")))
)
)
(field
"FUNCS"
(cat
(iter (var "fa_I") list (dom "fa_I" (var "fa_I*")))
(iter (var "fa") list (dom "fa" (var "fa*")))
)
)
(field "DATAS" (iter (var "da") list (dom "da" (var "da*"))))
(field "ELEMS" (iter (var "ea") list (dom "ea" (var "ea*"))))
(field "EXPORTS" (iter (var "xi") list (dom "xi" (var "xi*"))))
)
)
)
)
)
(def
"rundata_"
(exp "dataidx" (var "dataidx"))
(exp "data" (var "data"))
(iter (var "instr") list)
(clause
(exp "x" (var "idx"))
(exp "b*" (iter (var "byte") list))
(exp "n" (var "n"))
(exp (var "x"))
(exp
(case
"DATA%%"
(tup
(iter (var "b") (listn (var "n")) (dom "b" (var "b*")))
(case "PASSIVE" (tup))
)
)
)
(list)
)
(clause
(exp "x" (var "idx"))
(exp "b*" (iter (var "byte") list))
(exp "n" (var "n"))
(exp "y" (var "idx"))
(exp "instr*" (iter (var "instr") list))
(exp (var "x"))
(exp
(case
"DATA%%"
(tup
(iter (var "b") (listn (var "n")) (dom "b" (var "b*")))
(case
"ACTIVE%%"
(tup
(var "y")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(cat
(iter (var "instr") list (dom "instr" (var "instr*")))
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 0))))))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "MEMORY.INIT%%" (tup (var "y") (var "x")))
(case "DATA.DROP%" (tup (var "x")))
)
)
)
)
(def
"runelem_"
(exp "elemidx" (var "elemidx"))
(exp "elem" (var "elem"))
(iter (var "instr") list)
(clause
(exp "x" (var "idx"))
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(exp "n" (var "n"))
(exp (var "x"))
(exp
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") (listn (var "n")) (dom "e" (var "e*")))
(case "PASSIVE" (tup))
)
)
)
(list)
)
(clause
(exp "x" (var "idx"))
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(exp "n" (var "n"))
(exp (var "x"))
(exp
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") (listn (var "n")) (dom "e" (var "e*")))
(case "DECLARE" (tup))
)
)
)
(list (case "ELEM.DROP%" (tup (var "x"))))
)
(clause
(exp "x" (var "idx"))
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(exp "n" (var "n"))
(exp "y" (var "idx"))
(exp "instr*" (iter (var "instr") list))
(exp (var "x"))
(exp
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") (listn (var "n")) (dom "e" (var "e*")))
(case
"ACTIVE%%"
(tup
(var "y")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
)
)
(cat
(iter (var "instr") list (dom "instr" (var "instr*")))
(list
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 0))))))
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
(case "TABLE.INIT%%" (tup (var "y") (var "x")))
(case "ELEM.DROP%" (tup (var "x")))
)
)
)
)
(rec
(def
"evalglobals"
(exp "state" (var "state"))
(exp "_" (iter (var "globaltype") list))
(exp "_" (iter (var "expr") list))
(tup
(bind (var "_") (var "state"))
(bind (var "_") (iter (var "val") list))
)
(clause
(exp "z" (var "state"))
(exp (var "z"))
(exp (list))
(exp (list))
(tup (var "z") (list))
)
(clause
(exp "z" (var "state"))
(exp "gt" (var "globaltype"))
(exp "gt'*" (iter (var "globaltype") list))
(exp "expr" (var "expr"))
(exp "expr'*" (iter (var "expr") list))
(exp "z'" (var "state"))
(exp "val" (var "val"))
(exp "val'*" (iter (var "val") list))
(exp "s" (var "store"))
(exp "f" (var "frame"))
(exp "s'" (var "store"))
(exp "a" (var "addr"))
(exp (var "z"))
(exp
(cat (list (var "gt")) (iter (var "gt'") list (dom "gt'" (var "gt'*"))))
)
(exp
(cat
(list (var "expr"))
(iter (var "expr'") list (dom "expr'" (var "expr'*")))
)
)
(tup
(var "z'")
(cat
(list (var "val"))
(iter (var "val'") list (dom "val'" (var "val'*")))
)
)
(rule
"Eval_expr"
"%;%~>*%;%"
(tup (var "z") (var "expr") (var "z") (list (var "val")))
)
(if (cmp eq bool (var "z") (case "%;%" (tup (var "s") (var "f")))))
(if
(cmp
eq
bool
(tup (var "s'") (var "a"))
(call
"allocglobal"
(exp (var "s"))
(exp (var "gt"))
(exp (var "val"))
)
)
)
(if
(cmp
eq
bool
(tup (var "z'") (iter (var "val'") list (dom "val'" (var "val'*"))))
(call
"evalglobals"
(exp
(case
"%;%"
(tup
(var "s'")
(ext
(var "f")
(dot (dot root "MODULE") "GLOBALS")
(list (var "a"))
)
)
)
)
(exp (iter (var "gt'") list (dom "gt'" (var "gt'*"))))
(exp (iter (var "expr'") list (dom "expr'" (var "expr'*"))))
)
)
)
)
)
)
(def
"instantiate"
(exp "store" (var "store"))
(exp "module" (var "module"))
(exp "_" (iter (var "externaddr") list))
(var "config")
(clause
(exp "s" (var "store"))
(exp "module" (var "module"))
(exp "externaddr*" (iter (var "externaddr") list))
(exp "s'" (var "store"))
(exp "moduleinst" (var "moduleinst"))
(exp "instr_E*" (iter (var "instr") list))
(exp "instr_D*" (iter (var "instr") list))
(exp "instr_S?" (iter (var "instr") opt))
(exp "xt_I*" (iter (var "externtype") list))
(exp "xt_E*" (iter (var "externtype") list))
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "func*" (iter (var "func") list))
(exp "data*" (iter (var "data") list))
(exp "elem*" (iter (var "elem") list))
(exp "start?" (iter (var "start") opt))
(exp "export*" (iter (var "export") list))
(exp "globaltype*" (iter (var "globaltype") list))
(exp "expr_G*" (iter (var "expr") list))
(exp "tabletype*" (iter (var "tabletype") list))
(exp "expr_T*" (iter (var "expr") list))
(exp "byte**" (iter (iter (var "byte") list) list))
(exp "datamode*" (iter (var "datamode") list))
(exp "reftype*" (iter (var "reftype") list))
(exp "expr_E**" (iter (iter (var "expr") list) list))
(exp "elemmode*" (iter (var "elemmode") list))
(exp "x?" (iter (var "idx") opt))
(exp "moduleinst_0" (var "moduleinst"))
(exp "i_F*" (iter nat list))
(exp "z" (var "state"))
(exp "z'" (var "state"))
(exp "val_G*" (iter (var "val") list))
(exp "ref_T*" (iter (var "ref") list))
(exp "ref_E**" (iter (iter (var "ref") list) list))
(exp "i_D*" (iter nat list))
(exp "i_E*" (iter nat list))
(exp (var "s"))
(exp (var "module"))
(exp (iter (var "externaddr") list (dom "externaddr" (var "externaddr*"))))
(case
"%;%"
(tup
(case
"%;%"
(tup
(var "s'")
(struct (field "LOCALS" (list)) (field "MODULE" (var "moduleinst")))
)
)
(cat
(iter (var "instr_E") list (dom "instr_E" (var "instr_E*")))
(cat
(iter (var "instr_D") list (dom "instr_D" (var "instr_D*")))
(lift (iter (var "instr_S") opt (dom "instr_S" (var "instr_S?"))))
)
)
)
)
(rule
"Module_ok"
"|-%:%"
(tup
(var "module")
(case
"%->%"
(tup
(iter (var "xt_I") list (dom "xt_I" (var "xt_I*")))
(iter (var "xt_E") list (dom "xt_E" (var "xt_E*")))
)
)
)
)
(iter
(rule
"Externaddr_ok"
"%|-%:%"
(tup (var "s") (var "externaddr") (var "xt_I"))
)
list
(dom "externaddr" (var "externaddr*"))
(dom "xt_I" (var "xt_I*"))
)
(if
(cmp
eq
bool
(var "module")
(case
"MODULE%%%%%%%%%%%"
(tup
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "export") list (dom "export" (var "export*")))
)
)
)
)
(if
(cmp
eq
bool
(iter (var "global") list (dom "global" (var "global*")))
(iter
(case "GLOBAL%%" (tup (var "globaltype") (var "expr_G")))
list
(dom "expr_G" (var "expr_G*"))
(dom "globaltype" (var "globaltype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "table") list (dom "table" (var "table*")))
(iter
(case "TABLE%%" (tup (var "tabletype") (var "expr_T")))
list
(dom "expr_T" (var "expr_T*"))
(dom "tabletype" (var "tabletype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "data") list (dom "data" (var "data*")))
(iter
(case
"DATA%%"
(tup
(iter (var "byte") list (dom "byte" (var "byte*")))
(var "datamode")
)
)
list
(dom "byte*" (var "byte**"))
(dom "datamode" (var "datamode*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter
(case
"ELEM%%%"
(tup
(var "reftype")
(iter (var "expr_E") list (dom "expr_E" (var "expr_E*")))
(var "elemmode")
)
)
list
(dom "elemmode" (var "elemmode*"))
(dom "expr_E*" (var "expr_E**"))
(dom "reftype" (var "reftype*"))
)
)
)
(if
(cmp
eq
bool
(iter (var "start") opt (dom "start" (var "start?")))
(iter (case "START%" (tup (var "x"))) opt (dom "x" (var "x?")))
)
)
(if
(cmp
eq
bool
(var "moduleinst_0")
(struct
(field
"TYPES"
(call
"alloctypes"
(exp (iter (var "type") list (dom "type" (var "type*"))))
)
)
(field "TAGS" (list))
(field
"GLOBALS"
(call
"globalsxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
)
(field "MEMS" (list))
(field "TABLES" (list))
(field
"FUNCS"
(cat
(call
"funcsxa"
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
)
(iter
(bin add nat (len (dot (var "s") "FUNCS")) (var "i_F"))
(listn
(len (iter (var "func") list (dom "func" (var "func*"))))
"i_F"
)
(dom "i_F" (var "i_F*"))
)
)
)
(field "DATAS" (list))
(field "ELEMS" (list))
(field "EXPORTS" (list))
)
)
)
(if
(cmp
eq
bool
(var "z")
(case
"%;%"
(tup
(var "s")
(struct
(field "LOCALS" (list))
(field "MODULE" (var "moduleinst_0"))
)
)
)
)
)
(if
(cmp
eq
bool
(tup (var "z'") (iter (var "val_G") list (dom "val_G" (var "val_G*"))))
(call
"evalglobals"
(exp (var "z"))
(exp
(iter
(var "globaltype")
list
(dom "globaltype" (var "globaltype*"))
)
)
(exp (iter (var "expr_G") list (dom "expr_G" (var "expr_G*"))))
)
)
)
(iter
(rule
"Eval_expr"
"%;%~>*%;%"
(tup
(var "z'")
(var "expr_T")
(var "z'")
(list (sub (var "ref") (var "val") (var "ref_T")))
)
)
list
(dom "expr_T" (var "expr_T*"))
(dom "ref_T" (var "ref_T*"))
)
(iter
(iter
(rule
"Eval_expr"
"%;%~>*%;%"
(tup
(var "z'")
(var "expr_E")
(var "z'")
(list (sub (var "ref") (var "val") (var "ref_E")))
)
)
list
(dom "expr_E" (var "expr_E*"))
(dom "ref_E" (var "ref_E*"))
)
list
(dom "expr_E*" (var "expr_E**"))
(dom "ref_E*" (var "ref_E**"))
)
(if
(cmp
eq
bool
(tup (var "s'") (var "moduleinst"))
(call
"allocmodule"
(exp (var "s"))
(exp (var "module"))
(exp
(iter
(var "externaddr")
list
(dom "externaddr" (var "externaddr*"))
)
)
(exp (iter (var "val_G") list (dom "val_G" (var "val_G*"))))
(exp (iter (var "ref_T") list (dom "ref_T" (var "ref_T*"))))
(exp
(iter
(iter (var "ref_E") list (dom "ref_E" (var "ref_E*")))
list
(dom "ref_E*" (var "ref_E**"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "instr_D") list (dom "instr_D" (var "instr_D*")))
(call
"concat_"
(typ (var "instr"))
(exp
(iter
(call
"rundata_"
(exp (case "%" (tup (var "i_D"))))
(exp
(idx
(iter (var "data") list (dom "data" (var "data*")))
(var "i_D")
)
)
)
(listn
(len (iter (var "data") list (dom "data" (var "data*"))))
"i_D"
)
(dom "i_D" (var "i_D*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "instr_E") list (dom "instr_E" (var "instr_E*")))
(call
"concat_"
(typ (var "instr"))
(exp
(iter
(call
"runelem_"
(exp (case "%" (tup (var "i_E"))))
(exp
(idx
(iter (var "elem") list (dom "elem" (var "elem*")))
(var "i_E")
)
)
)
(listn
(len (iter (var "elem") list (dom "elem" (var "elem*"))))
"i_E"
)
(dom "i_E" (var "i_E*"))
)
)
)
)
)
(if
(cmp
eq
bool
(iter (var "instr_S") opt (dom "instr_S" (var "instr_S?")))
(iter (case "CALL%" (tup (var "x"))) opt (dom "x" (var "x?")))
)
)
)
)
(def
"invoke"
(exp "store" (var "store"))
(exp "funcaddr" (var "funcaddr"))
(exp "_" (iter (var "val") list))
(var "config")
(clause
(exp "s" (var "store"))
(exp "funcaddr" (var "funcaddr"))
(exp "val*" (iter (var "val") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(exp (var "s"))
(exp (var "funcaddr"))
(exp (iter (var "val") list (dom "val" (var "val*"))))
(case
"%;%"
(tup
(case
"%;%"
(tup
(var "s")
(struct
(field "LOCALS" (list))
(field
"MODULE"
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "EXPORTS" (list))
)
)
)
)
)
(cat
(iter
(sub (var "val") (var "instr") (var "val"))
list
(dom "val" (var "val*"))
)
(list
(case "REF.FUNC_ADDR%" (tup (var "funcaddr")))
(case
"CALL_REF%"
(tup
(sub
(var "deftype")
(var "typeuse")
(dot (idx (dot (var "s") "FUNCS") (var "funcaddr")) "TYPE")
)
)
)
)
)
)
)
(rule
"Expand"
"%~~%"
(tup
(dot (idx (dot (var "s") "FUNCS") (var "funcaddr")) "TYPE")
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(iter
(rule "Val_ok" "%|-%:%" (tup (var "s") (var "val") (var "t_1")))
list
(dom "t_1" (var "t_1*"))
(dom "val" (var "val*"))
)
)
)
(gram
"Bbyte"
(var "byte")
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (range (num 0x00) (num 0xFF)))
(case "%" (tup (var "<implicit-prod-result>")))
)
)
(rec
(gram
"BuN"
(exp "N" (var "N"))
(var "uN" (exp (var "N")))
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "Bbyte"))
(case "%" (tup (var "n")))
(if
(bin
and
bool
(cmp lt nat (var "n") (bin pow nat (num (nat 2)) (num (nat 7))))
(cmp lt nat (var "n") (bin pow nat (num (nat 2)) (var "N")))
)
)
)
(prod
(exp "n" (var "n"))
(exp "m" (var "m"))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Bbyte")))
(seq
(attr
(case "%" (tup (var "m")))
(var
"BuN"
(exp
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 7)))
)
)
)
)
)
)
)
(case
"%"
(tup
(bin
add
nat
(bin mul nat (bin pow nat (num (nat 2)) (num (nat 7))) (var "m"))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (bin pow nat (num (nat 2)) (num (nat 7))))
)
)
)
)
)
(if
(bin
and
bool
(cmp ge nat (var "n") (bin pow nat (num (nat 2)) (num (nat 7))))
(cmp gt nat (var "N") (num (nat 7)))
)
)
)
)
)
(gram
"BsN"
(exp "N" (var "N"))
(var "sN" (exp (var "N")))
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "Bbyte"))
(case "%" (tup (cvt nat int (var "n"))))
(if
(bin
and
bool
(cmp lt nat (var "n") (bin pow nat (num (nat 2)) (num (nat 6))))
(cmp
lt
nat
(var "n")
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 1))))
)
)
)
)
)
)
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "Bbyte"))
(case
"%"
(tup
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (bin pow nat (num (nat 2)) (num (nat 7))))
)
)
)
(if
(bin
and
bool
(bin
and
bool
(cmp le nat (bin pow nat (num (nat 2)) (num (nat 6))) (var "n"))
(cmp lt nat (var "n") (bin pow nat (num (nat 2)) (num (nat 7))))
)
(cmp
ge
int
(cvt nat int (var "n"))
(bin
sub
int
(cvt nat int (bin pow nat (num (nat 2)) (num (nat 7))))
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
)
(prod
(exp "n" (var "n"))
(exp
"i"
(var
"uN"
(exp
(cvt
int
nat
(bin sub int (cvt nat int (var "N")) (cvt nat int (num (nat 7))))
)
)
)
)
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Bbyte")))
(seq
(attr
(var "i")
(var
"BuN"
(exp
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 7)))
)
)
)
)
)
)
)
(case
"%"
(tup
(cvt
nat
int
(bin
add
nat
(bin
mul
nat
(bin pow nat (num (nat 2)) (num (nat 7)))
(proj (uncase (var "i") "%") 0)
)
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (bin pow nat (num (nat 2)) (num (nat 7))))
)
)
)
)
)
)
(if
(bin
and
bool
(cmp ge nat (var "n") (bin pow nat (num (nat 2)) (num (nat 7))))
(cmp gt nat (var "N") (num (nat 7)))
)
)
)
)
(gram
"BiN"
(exp "N" (var "N"))
(var "iN" (exp (var "N")))
(prod
(exp "i" (var "sN" (exp (var "N"))))
(attr (var "i") (var "BsN" (exp (var "N"))))
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp (proj (uncase (var "i") "%") 0))
)
)
)
)
)
(gram
"BfN"
(exp "N" (var "N"))
(var "fN" (exp (var "N")))
(prod
(exp "b*" (iter (var "byte") list))
(attr
(iter (var "b") list (dom "b" (var "b*")))
(iter
(var "Bbyte")
(listn
(cvt
rat
nat
(bin div rat (cvt nat rat (var "N")) (cvt nat rat (num (nat 8))))
)
)
)
)
(call
"inv_fbytes_"
(exp (var "N"))
(exp (iter (var "b") list (dom "b" (var "b*"))))
)
)
)
(gram
"Bu32"
(var "u32")
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "BuN" (exp (num (nat 32)))))
(case "%" (tup (var "n")))
)
)
(gram
"Bu64"
(var "u64")
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "BuN" (exp (num (nat 64)))))
(case "%" (tup (var "n")))
)
)
(gram
"Bs33"
(var "s33")
(prod
(exp "i" (var "sN" (exp (num (nat 33)))))
(attr (var "i") (var "BsN" (exp (num (nat 33)))))
(var "i")
)
)
(gram
"Bf32"
(var "f32")
(prod
(exp "p" (var "fN" (exp (num (nat 32)))))
(attr (var "p") (var "BfN" (exp (num (nat 32)))))
(var "p")
)
)
(gram
"Bf64"
(var "f64")
(prod
(exp "p" (var "fN" (exp (num (nat 64)))))
(attr (var "p") (var "BfN" (exp (num (nat 64)))))
(var "p")
)
)
(gram
"Blist"
(typ "el")
(gram "BX" (var "el"))
(iter (var "el") list)
(prod
(exp "n" (var "n"))
(exp "el*" (iter (var "el") list))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Bu32")))
(seq
(iter
(attr (var "el") (var "BX"))
(listn (var "n"))
(dom "el" (var "el*"))
)
)
)
(iter (var "el") (listn (var "n")) (dom "el" (var "el*")))
)
)
(gram
"Bname"
(var "name")
(prod
(exp "b*" (iter (var "byte") list))
(exp "name" (var "name"))
(attr
(iter (var "b") list (dom "b" (var "b*")))
(var "Blist" (typ (var "byte")) (gram (var "Bbyte")))
)
(var "name")
(if
(cmp
eq
bool
(call "utf8" (exp (proj (uncase (var "name") "%") 0)))
(iter (var "b") list (dom "b" (var "b*")))
)
)
)
)
(gram
"Btypeidx"
(var "typeidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Btagidx"
(var "tagidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Bglobalidx"
(var "globalidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Bmemidx"
(var "memidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Btableidx"
(var "tableidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Bfuncidx"
(var "funcidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Bdataidx"
(var "dataidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Belemidx"
(var "elemidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Blocalidx"
(var "localidx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Bu32")) (var "x"))
)
(gram
"Blabelidx"
(var "labelidx")
(prod (exp "l" (var "labelidx")) (attr (var "l") (var "Bu32")) (var "l"))
)
(gram
"Bexternidx"
(var "externidx")
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x00)) (seq (attr (var "x") (var "Bfuncidx"))))
(case "FUNC%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x01)) (seq (attr (var "x") (var "Btableidx"))))
(case "TABLE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x02)) (seq (attr (var "x") (var "Bmemidx"))))
(case "MEM%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x03)) (seq (attr (var "x") (var "Bglobalidx"))))
(case "GLOBAL%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x04)) (seq (attr (var "x") (var "Btagidx"))))
(case "TAG%" (tup (var "x")))
)
)
(gram
"Bnumtype"
(var "numtype")
(prod (num 0x7C) (case "F64" (tup)))
(prod (num 0x7D) (case "F32" (tup)))
(prod (num 0x7E) (case "I64" (tup)))
(prod (num 0x7F) (case "I32" (tup)))
)
(gram "Bvectype" (var "vectype") (prod (num 0x7B) (case "V128" (tup))))
(gram
"Babsheaptype"
(var "heaptype")
(prod (num 0x69) (case "EXN" (tup)))
(prod (num 0x6A) (case "ARRAY" (tup)))
(prod (num 0x6B) (case "STRUCT" (tup)))
(prod (num 0x6C) (case "I31" (tup)))
(prod (num 0x6D) (case "EQ" (tup)))
(prod (num 0x6E) (case "ANY" (tup)))
(prod (num 0x6F) (case "EXTERN" (tup)))
(prod (num 0x70) (case "FUNC" (tup)))
(prod (num 0x71) (case "NONE" (tup)))
(prod (num 0x72) (case "NOEXTERN" (tup)))
(prod (num 0x73) (case "NOFUNC" (tup)))
(prod (num 0x74) (case "NOEXN" (tup)))
)
(gram
"Bheaptype"
(var "heaptype")
(prod
(exp "ht" (var "heaptype"))
(attr (var "ht") (var "Babsheaptype"))
(var "ht")
)
(prod
(exp "x33" (var "s33"))
(attr (var "x33") (var "Bs33"))
(case "_IDX%" (tup (call "s33_to_u32" (exp (var "x33")))))
(if
(cmp ge int (proj (uncase (var "x33") "%") 0) (cvt nat int (num (nat 0))))
)
)
)
(gram
"Breftype"
(var "reftype")
(prod
(exp "ht" (var "heaptype"))
(seq (seq (num 0x63)) (seq (attr (var "ht") (var "Bheaptype"))))
(case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht")))
)
(prod
(exp "ht" (var "heaptype"))
(seq (seq (num 0x64)) (seq (attr (var "ht") (var "Bheaptype"))))
(case "REF%%" (tup (opt) (var "ht")))
)
(prod
(exp "ht" (var "heaptype"))
(attr (var "ht") (var "Babsheaptype"))
(case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht")))
)
)
(gram
"Bvaltype"
(var "valtype")
(prod
(exp "nt" (var "numtype"))
(attr (var "nt") (var "Bnumtype"))
(sub (var "numtype") (var "valtype") (var "nt"))
)
(prod
(exp "vt" (var "vectype"))
(attr (var "vt") (var "Bvectype"))
(sub (var "vectype") (var "valtype") (var "vt"))
)
(prod
(exp "rt" (var "reftype"))
(attr (var "rt") (var "Breftype"))
(sub (var "reftype") (var "valtype") (var "rt"))
)
)
(gram
"Bresulttype"
(var "resulttype")
(prod
(exp "t*" (iter (var "valtype") list))
(attr
(iter (var "t") list (dom "t" (var "t*")))
(var "Blist" (typ (var "valtype")) (gram (var "Bvaltype")))
)
(case "%" (tup (iter (var "t") list (dom "t" (var "t*")))))
)
)
(gram
"Bmut"
(iter (var "mut") opt)
(prod (num 0x00) (opt))
(prod (num 0x01) (opt (case "MUT" (tup))))
)
(gram
"Bpacktype"
(var "packtype")
(prod (num 0x77) (case "I16" (tup)))
(prod (num 0x78) (case "I8" (tup)))
)
(gram
"Bstoragetype"
(var "storagetype")
(prod
(exp "t" (var "valtype"))
(attr (var "t") (var "Bvaltype"))
(sub (var "valtype") (var "storagetype") (var "t"))
)
(prod
(exp "pt" (var "packtype"))
(attr (var "pt") (var "Bpacktype"))
(sub (var "packtype") (var "storagetype") (var "pt"))
)
)
(gram
"Bfieldtype"
(var "fieldtype")
(prod
(exp "zt" (var "storagetype"))
(exp "mut?" (iter (var "mut") opt))
(seq
(seq (attr (var "zt") (var "Bstoragetype")))
(seq (attr (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "Bmut")))
)
(case "%%" (tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "zt")))
)
)
(gram
"Bcomptype"
(var "comptype")
(prod
(exp "ft" (var "fieldtype"))
(seq (seq (num 0x5E)) (seq (attr (var "ft") (var "Bfieldtype"))))
(case "ARRAY%" (tup (var "ft")))
)
(prod
(exp "ft*" (iter (var "fieldtype") list))
(seq
(seq (num 0x5F))
(seq
(attr
(iter (var "ft") list (dom "ft" (var "ft*")))
(var "Blist" (typ (var "fieldtype")) (gram (var "Bfieldtype")))
)
)
)
(case
"STRUCT%"
(tup (case "%" (tup (iter (var "ft") list (dom "ft" (var "ft*"))))))
)
)
(prod
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(seq
(seq (num 0x60))
(seq
(attr
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(var "Bresulttype")
)
)
(seq
(attr
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
(var "Bresulttype")
)
)
)
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(gram
"Bsubtype"
(var "subtype")
(prod
(exp "x*" (iter (var "idx") list))
(exp "ct" (var "comptype"))
(seq
(seq (num 0x4F))
(seq
(attr
(iter (var "x") list (dom "x" (var "x*")))
(var "Blist" (typ (var "typeidx")) (gram (var "Btypeidx")))
)
)
(seq (attr (var "ct") (var "Bcomptype")))
)
(case
"SUB%%%"
(tup
(opt (case "FINAL" (tup)))
(iter (case "_IDX%" (tup (var "x"))) list (dom "x" (var "x*")))
(var "ct")
)
)
)
(prod
(exp "x*" (iter (var "idx") list))
(exp "ct" (var "comptype"))
(seq
(seq (num 0x50))
(seq
(attr
(iter (var "x") list (dom "x" (var "x*")))
(var "Blist" (typ (var "typeidx")) (gram (var "Btypeidx")))
)
)
(seq (attr (var "ct") (var "Bcomptype")))
)
(case
"SUB%%%"
(tup
(opt)
(iter (case "_IDX%" (tup (var "x"))) list (dom "x" (var "x*")))
(var "ct")
)
)
)
(prod
(exp "ct" (var "comptype"))
(attr (var "ct") (var "Bcomptype"))
(case "SUB%%%" (tup (opt (case "FINAL" (tup))) (list) (var "ct")))
)
)
(gram
"Brectype"
(var "rectype")
(prod
(exp "st*" (iter (var "subtype") list))
(seq
(seq (num 0x4E))
(seq
(attr
(iter (var "st") list (dom "st" (var "st*")))
(var "Blist" (typ (var "subtype")) (gram (var "Bsubtype")))
)
)
)
(case
"REC%"
(tup (case "%" (tup (iter (var "st") list (dom "st" (var "st*"))))))
)
)
(prod
(exp "st" (var "subtype"))
(attr (var "st") (var "Bsubtype"))
(case "REC%" (tup (case "%" (tup (list (var "st"))))))
)
)
(gram
"Blimits"
(tup (bind (var "_") (var "addrtype")) (bind (var "_") (var "limits")))
(prod
(exp "n" (var "n"))
(seq (seq (num 0x00)) (seq (attr (case "%" (tup (var "n"))) (var "Bu64"))))
(tup
(case "I32" (tup))
(case "[%..%]" (tup (case "%" (tup (var "n"))) (opt)))
)
)
(prod
(exp "n" (var "n"))
(exp "m" (var "m"))
(seq
(seq (num 0x01))
(seq (attr (case "%" (tup (var "n"))) (var "Bu64")))
(seq (attr (case "%" (tup (var "m"))) (var "Bu64")))
)
(tup
(case "I32" (tup))
(case
"[%..%]"
(tup (case "%" (tup (var "n"))) (opt (case "%" (tup (var "m")))))
)
)
)
(prod
(exp "n" (var "n"))
(seq (seq (num 0x04)) (seq (attr (case "%" (tup (var "n"))) (var "Bu64"))))
(tup
(case "I64" (tup))
(case "[%..%]" (tup (case "%" (tup (var "n"))) (opt)))
)
)
(prod
(exp "n" (var "n"))
(exp "m" (var "m"))
(seq
(seq (num 0x05))
(seq (attr (case "%" (tup (var "n"))) (var "Bu64")))
(seq (attr (case "%" (tup (var "m"))) (var "Bu64")))
)
(tup
(case "I64" (tup))
(case
"[%..%]"
(tup (case "%" (tup (var "n"))) (opt (case "%" (tup (var "m")))))
)
)
)
)
(gram
"Btagtype"
(var "tagtype")
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x00)) (seq (attr (var "x") (var "Btypeidx"))))
(case "_IDX%" (tup (var "x")))
)
)
(gram
"Bglobaltype"
(var "globaltype")
(prod
(exp "t" (var "valtype"))
(exp "mut?" (iter (var "mut") opt))
(seq
(seq (attr (var "t") (var "Bvaltype")))
(seq (attr (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "Bmut")))
)
(case "%%" (tup (iter (var "mut") opt (dom "mut" (var "mut?"))) (var "t")))
)
)
(gram
"Bmemtype"
(var "memtype")
(prod
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(attr (tup (var "at") (var "lim")) (var "Blimits"))
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(gram
"Btabletype"
(var "tabletype")
(prod
(exp "rt" (var "reftype"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(seq
(seq (attr (var "rt") (var "Breftype")))
(seq (attr (tup (var "at") (var "lim")) (var "Blimits")))
)
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
(gram
"Bexterntype"
(var "externtype")
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x00)) (seq (attr (var "x") (var "Btypeidx"))))
(case "FUNC%" (tup (case "_IDX%" (tup (var "x")))))
)
(prod
(exp "tt" (var "tabletype"))
(seq (seq (num 0x01)) (seq (attr (var "tt") (var "Btabletype"))))
(case "TABLE%" (tup (var "tt")))
)
(prod
(exp "mt" (var "memtype"))
(seq (seq (num 0x02)) (seq (attr (var "mt") (var "Bmemtype"))))
(case "MEM%" (tup (var "mt")))
)
(prod
(exp "gt" (var "globaltype"))
(seq (seq (num 0x03)) (seq (attr (var "gt") (var "Bglobaltype"))))
(case "GLOBAL%" (tup (var "gt")))
)
(prod
(exp "jt" (var "tagtype"))
(seq (seq (num 0x04)) (seq (attr (var "jt") (var "Btagtype"))))
(case "TAG%" (tup (var "jt")))
)
)
(typ
"castop"
(inst
(alias
(tup
(bind (var "_") (iter (var "null") opt))
(bind (var "_") (iter (var "null") opt))
)
)
)
)
(gram
"Bcastop"
(var "castop")
(prod (num 0x00) (tup (opt) (opt)))
(prod (num 0x01) (tup (opt (case "NULL" (tup))) (opt)))
(prod (num 0x02) (tup (opt) (opt (case "NULL" (tup)))))
(prod (num 0x03) (tup (opt (case "NULL" (tup))) (opt (case "NULL" (tup)))))
)
(gram
"Bblocktype"
(var "blocktype")
(prod (num 0x40) (case "_RESULT%" (tup (opt))))
(prod
(exp "t" (var "valtype"))
(attr (var "t") (var "Bvaltype"))
(case "_RESULT%" (tup (opt (var "t"))))
)
(prod
(exp "i" (var "s33"))
(attr (var "i") (var "Bs33"))
(case
"_IDX%"
(tup (case "%" (tup (cvt int nat (proj (uncase (var "i") "%") 0)))))
)
(if
(cmp ge int (proj (uncase (var "i") "%") 0) (cvt nat int (num (nat 0))))
)
)
)
(gram
"Bcatch"
(var "catch")
(prod
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(seq
(seq (num 0x00))
(seq (attr (var "x") (var "Btagidx")))
(seq (attr (var "l") (var "Blabelidx")))
)
(case "CATCH%%" (tup (var "x") (var "l")))
)
(prod
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(seq
(seq (num 0x01))
(seq (attr (var "x") (var "Btagidx")))
(seq (attr (var "l") (var "Blabelidx")))
)
(case "CATCH_REF%%" (tup (var "x") (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq (seq (num 0x02)) (seq (attr (var "l") (var "Blabelidx"))))
(case "CATCH_ALL%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq (seq (num 0x03)) (seq (attr (var "l") (var "Blabelidx"))))
(case "CATCH_ALL_REF%" (tup (var "l")))
)
)
(typ
"memidxop"
(inst
(alias
(tup (bind (var "_") (var "memidx")) (bind (var "_") (var "memarg")))
)
)
)
(gram
"Bmemarg"
(var "memidxop")
(prod
(exp "n" (var "n"))
(exp "m" (var "m"))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Bu32")))
(seq (attr (case "%" (tup (var "m"))) (var "Bu64")))
)
(tup
(case "%" (tup (num (nat 0))))
(struct
(field "ALIGN" (case "%" (tup (var "n"))))
(field "OFFSET" (case "%" (tup (var "m"))))
)
)
(if (cmp lt nat (var "n") (bin pow nat (num (nat 2)) (num (nat 6)))))
)
(prod
(exp "n" (var "n"))
(exp "x" (var "idx"))
(exp "m" (var "m"))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Bu32")))
(seq (attr (var "x") (var "Bmemidx")))
(seq (attr (case "%" (tup (var "m"))) (var "Bu64")))
)
(tup
(var "x")
(struct
(field
"ALIGN"
(case
"%"
(tup
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "n"))
(cvt nat int (bin pow nat (num (nat 2)) (num (nat 6))))
)
)
)
)
)
(field "OFFSET" (case "%" (tup (var "m"))))
)
)
(if
(bin
and
bool
(cmp le nat (bin pow nat (num (nat 2)) (num (nat 6))) (var "n"))
(cmp lt nat (var "n") (bin pow nat (num (nat 2)) (num (nat 7))))
)
)
)
)
(gram
"Blaneidx"
(var "laneidx")
(prod
(exp "l" (var "labelidx"))
(attr (case "%" (tup (proj (uncase (var "l") "%") 0))) (var "Bbyte"))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
(rec
(gram
"Binstr"
(var "instr")
(prod (num 0x00) (case "UNREACHABLE" (tup)))
(prod (num 0x01) (case "NOP" (tup)))
(prod (num 0x1A) (case "DROP" (tup)))
(prod (num 0x1B) (case "SELECT%" (tup (opt))))
(prod
(exp "t*" (iter (var "valtype") list))
(seq
(seq (num 0x1C))
(seq
(attr
(iter (var "t") list (dom "t" (var "t*")))
(var "Blist" (typ (var "valtype")) (gram (var "Bvaltype")))
)
)
)
(case "SELECT%" (tup (opt (iter (var "t") list (dom "t" (var "t*"))))))
)
(prod
(exp "bt" (var "blocktype"))
(exp "in*" (iter (var "instr") list))
(seq
(seq (num 0x02))
(seq (attr (var "bt") (var "Bblocktype")))
(seq
(iter (attr (var "in") (var "Binstr")) list (dom "in" (var "in*")))
)
(seq (num 0x0B))
)
(case
"BLOCK%%"
(tup (var "bt") (iter (var "in") list (dom "in" (var "in*"))))
)
)
(prod
(exp "bt" (var "blocktype"))
(exp "in*" (iter (var "instr") list))
(seq
(seq (num 0x03))
(seq (attr (var "bt") (var "Bblocktype")))
(seq
(iter (attr (var "in") (var "Binstr")) list (dom "in" (var "in*")))
)
(seq (num 0x0B))
)
(case
"LOOP%%"
(tup (var "bt") (iter (var "in") list (dom "in" (var "in*"))))
)
)
(prod
(exp "bt" (var "blocktype"))
(exp "in*" (iter (var "instr") list))
(seq
(seq (num 0x04))
(seq (attr (var "bt") (var "Bblocktype")))
(seq
(iter (attr (var "in") (var "Binstr")) list (dom "in" (var "in*")))
)
(seq (num 0x0B))
)
(case
"IF%%ELSE%"
(tup (var "bt") (iter (var "in") list (dom "in" (var "in*"))) (list))
)
)
(prod
(exp "bt" (var "blocktype"))
(exp "in_1*" (iter (var "instr") list))
(exp "in_2*" (iter (var "instr") list))
(seq
(seq (num 0x04))
(seq (attr (var "bt") (var "Bblocktype")))
(seq
(iter
(attr (var "in_1") (var "Binstr"))
list
(dom "in_1" (var "in_1*"))
)
)
(seq (num 0x05))
(seq
(iter
(attr (var "in_2") (var "Binstr"))
list
(dom "in_2" (var "in_2*"))
)
)
(seq (num 0x0B))
)
(case
"IF%%ELSE%"
(tup
(var "bt")
(iter (var "in_1") list (dom "in_1" (var "in_1*")))
(iter (var "in_2") list (dom "in_2" (var "in_2*")))
)
)
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x08)) (seq (attr (var "x") (var "Btagidx"))))
(case "THROW%" (tup (var "x")))
)
(prod (num 0x0A) (case "THROW_REF" (tup)))
(prod
(exp "l" (var "labelidx"))
(seq (seq (num 0x0C)) (seq (attr (var "l") (var "Blabelidx"))))
(case "BR%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq (seq (num 0x0D)) (seq (attr (var "l") (var "Blabelidx"))))
(case "BR_IF%" (tup (var "l")))
)
(prod
(exp "l*" (iter (var "labelidx") list))
(exp "l_n" (var "labelidx"))
(seq
(seq (num 0x0E))
(seq
(attr
(iter (var "l") list (dom "l" (var "l*")))
(var "Blist" (typ (var "labelidx")) (gram (var "Blabelidx")))
)
)
(seq (attr (var "l_n") (var "Blabelidx")))
)
(case
"BR_TABLE%%"
(tup (iter (var "l") list (dom "l" (var "l*"))) (var "l_n"))
)
)
(prod (num 0x0F) (case "RETURN" (tup)))
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x10)) (seq (attr (var "x") (var "Bfuncidx"))))
(case "CALL%" (tup (var "x")))
)
(prod
(exp "y" (var "idx"))
(exp "x" (var "idx"))
(seq
(seq (num 0x11))
(seq (attr (var "y") (var "Btypeidx")))
(seq (attr (var "x") (var "Btableidx")))
)
(case "CALL_INDIRECT%%" (tup (var "x") (case "_IDX%" (tup (var "y")))))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x12)) (seq (attr (var "x") (var "Bfuncidx"))))
(case "RETURN_CALL%" (tup (var "x")))
)
(prod
(exp "y" (var "idx"))
(exp "x" (var "idx"))
(seq
(seq (num 0x13))
(seq (attr (var "y") (var "Btypeidx")))
(seq (attr (var "x") (var "Btableidx")))
)
(case
"RETURN_CALL_INDIRECT%%"
(tup (var "x") (case "_IDX%" (tup (var "y"))))
)
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x14)) (seq (attr (var "x") (var "Btypeidx"))))
(case "CALL_REF%" (tup (case "_IDX%" (tup (var "x")))))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x15)) (seq (attr (var "x") (var "Btypeidx"))))
(case "RETURN_CALL_REF%" (tup (case "_IDX%" (tup (var "x")))))
)
(prod
(exp "bt" (var "blocktype"))
(exp "c*" (iter (var "catch") list))
(exp "in*" (iter (var "instr") list))
(seq
(seq (num 0x1F))
(seq (attr (var "bt") (var "Bblocktype")))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(var "Blist" (typ (var "catch")) (gram (var "Bcatch")))
)
)
(seq
(iter (attr (var "in") (var "Binstr")) list (dom "in" (var "in*")))
)
(seq (num 0x0B))
)
(case
"TRY_TABLE%%%"
(tup
(var "bt")
(case "%" (tup (iter (var "c") list (dom "c" (var "c*")))))
(iter (var "in") list (dom "in" (var "in*")))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq (seq (num 0xD5)) (seq (attr (var "l") (var "Blabelidx"))))
(case "BR_ON_NULL%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq (seq (num 0xD6)) (seq (attr (var "l") (var "Blabelidx"))))
(case "BR_ON_NON_NULL%" (tup (var "l")))
)
(prod
(exp "null_1?" (iter (var "null") opt))
(exp "null_2?" (iter (var "null") opt))
(exp "l" (var "labelidx"))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 24)))) (var "Bu32")))
(seq
(attr
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
)
(var "Bcastop")
)
)
(seq (attr (var "l") (var "Blabelidx")))
(seq (attr (var "ht_1") (var "Bheaptype")))
(seq (attr (var "ht_2") (var "Bheaptype")))
)
(case
"BR_ON_CAST%%%"
(tup
(var "l")
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(var "ht_1")
)
)
(case
"REF%%"
(tup
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
(var "ht_2")
)
)
)
)
)
(prod
(exp "null_1?" (iter (var "null") opt))
(exp "null_2?" (iter (var "null") opt))
(exp "l" (var "labelidx"))
(exp "ht_1" (var "heaptype"))
(exp "ht_2" (var "heaptype"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 25)))) (var "Bu32")))
(seq
(attr
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
)
(var "Bcastop")
)
)
(seq (attr (var "l") (var "Blabelidx")))
(seq (attr (var "ht_1") (var "Bheaptype")))
(seq (attr (var "ht_2") (var "Bheaptype")))
)
(case
"BR_ON_CAST_FAIL%%%"
(tup
(var "l")
(case
"REF%%"
(tup
(iter (var "null_1") opt (dom "null_1" (var "null_1?")))
(var "ht_1")
)
)
(case
"REF%%"
(tup
(iter (var "null_2") opt (dom "null_2" (var "null_2?")))
(var "ht_2")
)
)
)
)
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x20)) (seq (attr (var "x") (var "Blocalidx"))))
(case "LOCAL.GET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x21)) (seq (attr (var "x") (var "Blocalidx"))))
(case "LOCAL.SET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x22)) (seq (attr (var "x") (var "Blocalidx"))))
(case "LOCAL.TEE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x23)) (seq (attr (var "x") (var "Bglobalidx"))))
(case "GLOBAL.GET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x24)) (seq (attr (var "x") (var "Bglobalidx"))))
(case "GLOBAL.SET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x25)) (seq (attr (var "x") (var "Btableidx"))))
(case "TABLE.GET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x26)) (seq (attr (var "x") (var "Btableidx"))))
(case "TABLE.SET%" (tup (var "x")))
)
(prod
(exp "y" (var "idx"))
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 12)))) (var "Bu32")))
(seq (attr (var "y") (var "Belemidx")))
(seq (attr (var "x") (var "Btableidx")))
)
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 13)))) (var "Bu32")))
(seq (attr (var "x") (var "Belemidx")))
)
(case "ELEM.DROP%" (tup (var "x")))
)
(prod
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 14)))) (var "Bu32")))
(seq (attr (var "x_1") (var "Btableidx")))
(seq (attr (var "x_2") (var "Btableidx")))
)
(case "TABLE.COPY%%" (tup (var "x_1") (var "x_2")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 15)))) (var "Bu32")))
(seq (attr (var "x") (var "Btableidx")))
)
(case "TABLE.GROW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 16)))) (var "Bu32")))
(seq (attr (var "x") (var "Btableidx")))
)
(case "TABLE.SIZE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 17)))) (var "Bu32")))
(seq (attr (var "x") (var "Btableidx")))
)
(case "TABLE.FILL%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x28))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "LOAD%%%%" (tup (case "I32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x29))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "LOAD%%%%" (tup (case "I64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x2A))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "LOAD%%%%" (tup (case "F32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x2B))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "LOAD%%%%" (tup (case "F64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x2C))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x2D))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x2E))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x2F))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x30))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x31))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x32))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x33))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x34))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 32)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x35))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 32)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x36))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "STORE%%%%" (tup (case "I32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x37))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "STORE%%%%" (tup (case "I64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x38))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "STORE%%%%" (tup (case "F32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x39))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "STORE%%%%" (tup (case "F64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x3A))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x3B))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 16)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x3C))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"STORE%%%%"
(tup
(case "I64" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x3D))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"STORE%%%%"
(tup
(case "I64" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 16)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0x3E))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"STORE%%%%"
(tup
(case "I64" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 32)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x3F)) (seq (attr (var "x") (var "Bmemidx"))))
(case "MEMORY.SIZE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq (seq (num 0x40)) (seq (attr (var "x") (var "Bmemidx"))))
(case "MEMORY.GROW%" (tup (var "x")))
)
(prod
(exp "y" (var "idx"))
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 8)))) (var "Bu32")))
(seq (attr (var "y") (var "Bdataidx")))
(seq (attr (var "x") (var "Bmemidx")))
)
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 9)))) (var "Bu32")))
(seq (attr (var "x") (var "Bdataidx")))
)
(case "DATA.DROP%" (tup (var "x")))
)
(prod
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 10)))) (var "Bu32")))
(seq (attr (var "x_1") (var "Bmemidx")))
(seq (attr (var "x_2") (var "Bmemidx")))
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 11)))) (var "Bu32")))
(seq (attr (var "x") (var "Bmemidx")))
)
(case "MEMORY.FILL%" (tup (var "x")))
)
(prod
(exp "ht" (var "heaptype"))
(seq (seq (num 0xD0)) (seq (attr (var "ht") (var "Bheaptype"))))
(case "REF.NULL%" (tup (var "ht")))
)
(prod (num 0xD1) (case "REF.IS_NULL" (tup)))
(prod
(exp "x" (var "idx"))
(seq (seq (num 0xD2)) (seq (attr (var "x") (var "Bfuncidx"))))
(case "REF.FUNC%" (tup (var "x")))
)
(prod (num 0xD3) (case "REF.EQ" (tup)))
(prod (num 0xD4) (case "REF.AS_NON_NULL" (tup)))
(prod
(exp "ht" (var "heaptype"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 20)))) (var "Bu32")))
(seq (attr (var "ht") (var "Bheaptype")))
)
(case "REF.TEST%" (tup (case "REF%%" (tup (opt) (var "ht")))))
)
(prod
(exp "ht" (var "heaptype"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 21)))) (var "Bu32")))
(seq (attr (var "ht") (var "Bheaptype")))
)
(case
"REF.TEST%"
(tup (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht"))))
)
)
(prod
(exp "ht" (var "heaptype"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 22)))) (var "Bu32")))
(seq (attr (var "ht") (var "Bheaptype")))
)
(case "REF.CAST%" (tup (case "REF%%" (tup (opt) (var "ht")))))
)
(prod
(exp "ht" (var "heaptype"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 23)))) (var "Bu32")))
(seq (attr (var "ht") (var "Bheaptype")))
)
(case
"REF.CAST%"
(tup (case "REF%%" (tup (opt (case "NULL" (tup))) (var "ht"))))
)
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 0)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "STRUCT.NEW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 1)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "STRUCT.NEW_DEFAULT%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 2)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "i") (var "Bu32")))
)
(case "STRUCT.GET%%%" (tup (opt) (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 3)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "i") (var "Bu32")))
)
(case "STRUCT.GET%%%" (tup (opt (case "S" (tup))) (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 4)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "i") (var "Bu32")))
)
(case "STRUCT.GET%%%" (tup (opt (case "U" (tup))) (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "u32"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 5)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "i") (var "Bu32")))
)
(case "STRUCT.SET%%" (tup (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 6)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.NEW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 7)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.NEW_DEFAULT%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(exp "n" (var "n"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 8)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (case "%" (tup (var "n"))) (var "Bu32")))
)
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 9)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "y") (var "Bdataidx")))
)
(case "ARRAY.NEW_DATA%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 10)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "y") (var "Belemidx")))
)
(case "ARRAY.NEW_ELEM%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 11)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.GET%%" (tup (opt) (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 12)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.GET%%" (tup (opt (case "S" (tup))) (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 13)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.GET%%" (tup (opt (case "U" (tup))) (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 14)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.SET%" (tup (var "x")))
)
(prod
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 15)))) (var "Bu32")))
)
(case "ARRAY.LEN" (tup))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 16)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
)
(case "ARRAY.FILL%" (tup (var "x")))
)
(prod
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 17)))) (var "Bu32")))
(seq (attr (var "x_1") (var "Btypeidx")))
(seq (attr (var "x_2") (var "Btypeidx")))
)
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 18)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "y") (var "Bdataidx")))
)
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 19)))) (var "Bu32")))
(seq (attr (var "x") (var "Btypeidx")))
(seq (attr (var "y") (var "Belemidx")))
)
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
(prod
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 26)))) (var "Bu32")))
)
(case "ANY.CONVERT_EXTERN" (tup))
)
(prod
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 27)))) (var "Bu32")))
)
(case "EXTERN.CONVERT_ANY" (tup))
)
(prod
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 28)))) (var "Bu32")))
)
(case "REF.I31" (tup))
)
(prod
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 29)))) (var "Bu32")))
)
(case "I31.GET%" (tup (case "S" (tup))))
)
(prod
(seq
(seq (num 0xFB))
(seq (attr (case "%" (tup (num (nat 30)))) (var "Bu32")))
)
(case "I31.GET%" (tup (case "U" (tup))))
)
(prod
(exp "n" (var "n"))
(seq
(seq (num 0x41))
(seq (attr (case "%" (tup (var "n"))) (var "Bu32")))
)
(case "CONST%%" (tup (case "I32" (tup)) (case "%" (tup (var "n")))))
)
(prod
(exp "n" (var "n"))
(seq
(seq (num 0x42))
(seq (attr (case "%" (tup (var "n"))) (var "Bu64")))
)
(case "CONST%%" (tup (case "I64" (tup)) (case "%" (tup (var "n")))))
)
(prod
(exp "p" (var "f32"))
(seq (seq (num 0x43)) (seq (attr (var "p") (var "Bf32"))))
(case "CONST%%" (tup (case "F32" (tup)) (var "p")))
)
(prod
(exp "p" (var "f64"))
(seq (seq (num 0x44)) (seq (attr (var "p") (var "Bf64"))))
(case "CONST%%" (tup (case "F64" (tup)) (var "p")))
)
(prod
(num 0x45)
(case "TESTOP%%" (tup (case "I32" (tup)) (case "EQZ" (tup))))
)
(prod
(num 0x46)
(case "RELOP%%" (tup (case "I32" (tup)) (case "EQ" (tup))))
)
(prod
(num 0x47)
(case "RELOP%%" (tup (case "I32" (tup)) (case "NE" (tup))))
)
(prod
(num 0x48)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LT%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x49)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LT%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x4A)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GT%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x4B)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GT%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x4C)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LE%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x4D)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LE%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x4E)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GE%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x4F)
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GE%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x50)
(case "TESTOP%%" (tup (case "I64" (tup)) (case "EQZ" (tup))))
)
(prod
(num 0x51)
(case "RELOP%%" (tup (case "I64" (tup)) (case "EQ" (tup))))
)
(prod
(num 0x52)
(case "RELOP%%" (tup (case "I64" (tup)) (case "NE" (tup))))
)
(prod
(num 0x53)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LT%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x54)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LT%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x55)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GT%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x56)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GT%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x57)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LE%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x58)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LE%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x59)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GE%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x5A)
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GE%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x5B)
(case "RELOP%%" (tup (case "F32" (tup)) (case "EQ" (tup))))
)
(prod
(num 0x5C)
(case "RELOP%%" (tup (case "F32" (tup)) (case "NE" (tup))))
)
(prod
(num 0x5D)
(case "RELOP%%" (tup (case "F32" (tup)) (case "LT" (tup))))
)
(prod
(num 0x5E)
(case "RELOP%%" (tup (case "F32" (tup)) (case "GT" (tup))))
)
(prod
(num 0x5F)
(case "RELOP%%" (tup (case "F32" (tup)) (case "LE" (tup))))
)
(prod
(num 0x60)
(case "RELOP%%" (tup (case "F32" (tup)) (case "GE" (tup))))
)
(prod
(num 0x61)
(case "RELOP%%" (tup (case "F64" (tup)) (case "EQ" (tup))))
)
(prod
(num 0x62)
(case "RELOP%%" (tup (case "F64" (tup)) (case "NE" (tup))))
)
(prod
(num 0x63)
(case "RELOP%%" (tup (case "F64" (tup)) (case "LT" (tup))))
)
(prod
(num 0x64)
(case "RELOP%%" (tup (case "F64" (tup)) (case "GT" (tup))))
)
(prod
(num 0x65)
(case "RELOP%%" (tup (case "F64" (tup)) (case "LE" (tup))))
)
(prod
(num 0x66)
(case "RELOP%%" (tup (case "F64" (tup)) (case "GE" (tup))))
)
(prod
(num 0x67)
(case "UNOP%%" (tup (case "I32" (tup)) (case "CLZ" (tup))))
)
(prod
(num 0x68)
(case "UNOP%%" (tup (case "I32" (tup)) (case "CTZ" (tup))))
)
(prod
(num 0x69)
(case "UNOP%%" (tup (case "I32" (tup)) (case "POPCNT" (tup))))
)
(prod
(num 0x6A)
(case "BINOP%%" (tup (case "I32" (tup)) (case "ADD" (tup))))
)
(prod
(num 0x6B)
(case "BINOP%%" (tup (case "I32" (tup)) (case "SUB" (tup))))
)
(prod
(num 0x6C)
(case "BINOP%%" (tup (case "I32" (tup)) (case "MUL" (tup))))
)
(prod
(num 0x6D)
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "DIV%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x6E)
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "DIV%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x6F)
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "REM%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x70)
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "REM%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x71)
(case "BINOP%%" (tup (case "I32" (tup)) (case "AND" (tup))))
)
(prod
(num 0x72)
(case "BINOP%%" (tup (case "I32" (tup)) (case "OR" (tup))))
)
(prod
(num 0x73)
(case "BINOP%%" (tup (case "I32" (tup)) (case "XOR" (tup))))
)
(prod
(num 0x74)
(case "BINOP%%" (tup (case "I32" (tup)) (case "SHL" (tup))))
)
(prod
(num 0x75)
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "SHR%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x76)
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "SHR%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x77)
(case "BINOP%%" (tup (case "I32" (tup)) (case "ROTL" (tup))))
)
(prod
(num 0x78)
(case "BINOP%%" (tup (case "I32" (tup)) (case "ROTR" (tup))))
)
(prod
(num 0x79)
(case "UNOP%%" (tup (case "I64" (tup)) (case "CLZ" (tup))))
)
(prod
(num 0x7A)
(case "UNOP%%" (tup (case "I64" (tup)) (case "CTZ" (tup))))
)
(prod
(num 0x7B)
(case "UNOP%%" (tup (case "I64" (tup)) (case "POPCNT" (tup))))
)
(prod
(num 0xC0)
(case
"UNOP%%"
(tup
(case "I32" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 8))))))
)
)
)
(prod
(num 0xC1)
(case
"UNOP%%"
(tup
(case "I32" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 16))))))
)
)
)
(prod
(num 0xC2)
(case
"UNOP%%"
(tup
(case "I64" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 8))))))
)
)
)
(prod
(num 0xC3)
(case
"UNOP%%"
(tup
(case "I64" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 16))))))
)
)
)
(prod
(num 0xC4)
(case
"UNOP%%"
(tup
(case "I64" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 32))))))
)
)
)
(prod
(num 0x7C)
(case "BINOP%%" (tup (case "I64" (tup)) (case "ADD" (tup))))
)
(prod
(num 0x7D)
(case "BINOP%%" (tup (case "I64" (tup)) (case "SUB" (tup))))
)
(prod
(num 0x7E)
(case "BINOP%%" (tup (case "I64" (tup)) (case "MUL" (tup))))
)
(prod
(num 0x7F)
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "DIV%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x80)
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "DIV%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x81)
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "REM%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x82)
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "REM%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x83)
(case "BINOP%%" (tup (case "I64" (tup)) (case "AND" (tup))))
)
(prod
(num 0x84)
(case "BINOP%%" (tup (case "I64" (tup)) (case "OR" (tup))))
)
(prod
(num 0x85)
(case "BINOP%%" (tup (case "I64" (tup)) (case "XOR" (tup))))
)
(prod
(num 0x86)
(case "BINOP%%" (tup (case "I64" (tup)) (case "SHL" (tup))))
)
(prod
(num 0x87)
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "SHR%" (tup (case "S" (tup)))))
)
)
(prod
(num 0x88)
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "SHR%" (tup (case "U" (tup)))))
)
)
(prod
(num 0x89)
(case "BINOP%%" (tup (case "I64" (tup)) (case "ROTL" (tup))))
)
(prod
(num 0x8A)
(case "BINOP%%" (tup (case "I64" (tup)) (case "ROTR" (tup))))
)
(prod
(num 0x8B)
(case "UNOP%%" (tup (case "F32" (tup)) (case "ABS" (tup))))
)
(prod
(num 0x8C)
(case "UNOP%%" (tup (case "F32" (tup)) (case "NEG" (tup))))
)
(prod
(num 0x8D)
(case "UNOP%%" (tup (case "F32" (tup)) (case "CEIL" (tup))))
)
(prod
(num 0x8E)
(case "UNOP%%" (tup (case "F32" (tup)) (case "FLOOR" (tup))))
)
(prod
(num 0x8F)
(case "UNOP%%" (tup (case "F32" (tup)) (case "TRUNC" (tup))))
)
(prod
(num 0x90)
(case "UNOP%%" (tup (case "F32" (tup)) (case "NEAREST" (tup))))
)
(prod
(num 0x91)
(case "UNOP%%" (tup (case "F32" (tup)) (case "SQRT" (tup))))
)
(prod
(num 0x92)
(case "BINOP%%" (tup (case "F32" (tup)) (case "ADD" (tup))))
)
(prod
(num 0x93)
(case "BINOP%%" (tup (case "F32" (tup)) (case "SUB" (tup))))
)
(prod
(num 0x94)
(case "BINOP%%" (tup (case "F32" (tup)) (case "MUL" (tup))))
)
(prod
(num 0x95)
(case "BINOP%%" (tup (case "F32" (tup)) (case "DIV" (tup))))
)
(prod
(num 0x96)
(case "BINOP%%" (tup (case "F32" (tup)) (case "MIN" (tup))))
)
(prod
(num 0x97)
(case "BINOP%%" (tup (case "F32" (tup)) (case "MAX" (tup))))
)
(prod
(num 0x98)
(case "BINOP%%" (tup (case "F32" (tup)) (case "COPYSIGN" (tup))))
)
(prod
(num 0x99)
(case "UNOP%%" (tup (case "F64" (tup)) (case "ABS" (tup))))
)
(prod
(num 0x9A)
(case "UNOP%%" (tup (case "F64" (tup)) (case "NEG" (tup))))
)
(prod
(num 0x9B)
(case "UNOP%%" (tup (case "F64" (tup)) (case "CEIL" (tup))))
)
(prod
(num 0x9C)
(case "UNOP%%" (tup (case "F64" (tup)) (case "FLOOR" (tup))))
)
(prod
(num 0x9D)
(case "UNOP%%" (tup (case "F64" (tup)) (case "TRUNC" (tup))))
)
(prod
(num 0x9E)
(case "UNOP%%" (tup (case "F64" (tup)) (case "NEAREST" (tup))))
)
(prod
(num 0x9F)
(case "UNOP%%" (tup (case "F64" (tup)) (case "SQRT" (tup))))
)
(prod
(num 0xA0)
(case "BINOP%%" (tup (case "F64" (tup)) (case "ADD" (tup))))
)
(prod
(num 0xA1)
(case "BINOP%%" (tup (case "F64" (tup)) (case "SUB" (tup))))
)
(prod
(num 0xA2)
(case "BINOP%%" (tup (case "F64" (tup)) (case "MUL" (tup))))
)
(prod
(num 0xA3)
(case "BINOP%%" (tup (case "F64" (tup)) (case "DIV" (tup))))
)
(prod
(num 0xA4)
(case "BINOP%%" (tup (case "F64" (tup)) (case "MIN" (tup))))
)
(prod
(num 0xA5)
(case "BINOP%%" (tup (case "F64" (tup)) (case "MAX" (tup))))
)
(prod
(num 0xA6)
(case "BINOP%%" (tup (case "F64" (tup)) (case "COPYSIGN" (tup))))
)
(prod
(num 0xA7)
(case
"CVTOP%%%"
(tup (case "I32" (tup)) (case "I64" (tup)) (case "WRAP" (tup)))
)
)
(prod
(num 0xA8)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xA9)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xAA)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xAB)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xAC)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "I32" (tup))
(case "EXTEND%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xAD)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "I32" (tup))
(case "EXTEND%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xAE)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xAF)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xB0)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xB1)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xB2)
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xB3)
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xB4)
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xB5)
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xB6)
(case
"CVTOP%%%"
(tup (case "F32" (tup)) (case "F64" (tup)) (case "DEMOTE" (tup)))
)
)
(prod
(num 0xB7)
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xB8)
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xB9)
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(num 0xBA)
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(num 0xBB)
(case
"CVTOP%%%"
(tup (case "F64" (tup)) (case "F32" (tup)) (case "PROMOTE" (tup)))
)
)
(prod
(num 0xBC)
(case
"CVTOP%%%"
(tup (case "I32" (tup)) (case "F32" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(num 0xBD)
(case
"CVTOP%%%"
(tup (case "I64" (tup)) (case "F64" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(num 0xBE)
(case
"CVTOP%%%"
(tup (case "F32" (tup)) (case "I32" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(num 0xBF)
(case
"CVTOP%%%"
(tup (case "F64" (tup)) (case "I64" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 0)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 1)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 2)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 3)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 4)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 5)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 6)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFC))
(seq (attr (case "%" (tup (num (nat 7)))) (var "Bu32")))
)
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 0)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "VLOAD%%%%" (tup (case "V128" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 1)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup
(case "%" (tup (num (nat 8))))
(num (nat 8))
(case "S" (tup))
)
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 2)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup
(case "%" (tup (num (nat 8))))
(num (nat 8))
(case "U" (tup))
)
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 3)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup
(case "%" (tup (num (nat 16))))
(num (nat 4))
(case "S" (tup))
)
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 4)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup
(case "%" (tup (num (nat 16))))
(num (nat 4))
(case "U" (tup))
)
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 5)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup
(case "%" (tup (num (nat 32))))
(num (nat 2))
(case "S" (tup))
)
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 6)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup
(case "%" (tup (num (nat 32))))
(num (nat 2))
(case "U" (tup))
)
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 7)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 8)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 16)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 9)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 32)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 10)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 64)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 11)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case "VSTORE%%%" (tup (case "V128" (tup)) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 84)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 8))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 85)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 16))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 86)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 32))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 87)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 64))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 88)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 8))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 89)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 16))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 90)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 32))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 91)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
(seq (attr (var "i") (var "Blaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 64))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 92)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (num (nat 32)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 93)))) (var "Bu32")))
(seq (attr (tup (var "x") (var "ao")) (var "Bmemarg")))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (num (nat 64)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "b*" (iter (var "byte") list))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 12)))) (var "Bu32")))
(seq
(iter
(attr (var "b") (var "Bbyte"))
(listn (num (nat 16)))
(dom "b" (var "b*"))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp (iter (var "b") (listn (num (nat 16))) (dom "b" (var "b*"))))
)
)
)
)
(prod
(exp "l*" (iter (var "labelidx") list))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 13)))) (var "Bu32")))
(seq
(iter
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
(listn (num (nat 16)))
(dom "l" (var "l*"))
)
)
)
(case
"VSHUFFLE%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(iter
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(listn (num (nat 16)))
(dom "l" (var "l*"))
)
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 14)))) (var "Bu32")))
)
(case
"VSWIZZLOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "SWIZZLE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 256)))) (var "Bu32")))
)
(case
"VSWIZZLOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "RELAXED_SWIZZLE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 15)))) (var "Bu32")))
)
(case
"VSPLAT%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 16)))) (var "Bu32")))
)
(case
"VSPLAT%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 17)))) (var "Bu32")))
)
(case
"VSPLAT%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 18)))) (var "Bu32")))
)
(case
"VSPLAT%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 19)))) (var "Bu32")))
)
(case
"VSPLAT%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 20)))) (var "Bu32")))
)
(case
"VSPLAT%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 21)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(opt (case "S" (tup)))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 22)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(opt (case "U" (tup)))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 23)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 24)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(opt (case "S" (tup)))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 25)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(opt (case "U" (tup)))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 26)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 27)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(opt)
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 28)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 29)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(opt)
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 30)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 31)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(opt)
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 32)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 33)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(opt)
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 34)))) (var "Bu32")))
(seq
(attr
(case "%" (tup (proj (uncase (var "l") "%") 0)))
(var "Blaneidx")
)
)
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%" (tup (proj (uncase (var "l") "%") 0)))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 35)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EQ" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 36)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "NE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 37)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 38)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 39)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 40)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 41)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 42)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 43)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 44)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 45)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EQ" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 46)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "NE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 47)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 48)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 49)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 50)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 51)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 52)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 53)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 54)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 55)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EQ" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 56)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 57)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 58)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 59)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 60)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 61)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 62)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 63)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 64)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 65)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EQ" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 66)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 67)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 68)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 69)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 70)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 71)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "EQ" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 72)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 73)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 74)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 75)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 76)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 77)))) (var "Bu32")))
)
(case "VVUNOP%%" (tup (case "V128" (tup)) (case "NOT" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 78)))) (var "Bu32")))
)
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "AND" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 79)))) (var "Bu32")))
)
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "ANDNOT" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 80)))) (var "Bu32")))
)
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "OR" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 81)))) (var "Bu32")))
)
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "XOR" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 82)))) (var "Bu32")))
)
(case "VVTERNOP%%" (tup (case "V128" (tup)) (case "BITSELECT" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 83)))) (var "Bu32")))
)
(case "VVTESTOP%%" (tup (case "V128" (tup)) (case "ANY_TRUE" (tup))))
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 96)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ABS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 97)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "NEG" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 98)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "POPCNT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 99)))) (var "Bu32")))
)
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 100)))) (var "Bu32")))
)
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 101)))) (var "Bu32")))
)
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "S" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 102)))) (var "Bu32")))
)
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "U" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 107)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "SHL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 108)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 109)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 110)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 111)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ADD_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 112)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ADD_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 113)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "SUB" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 114)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "SUB_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 115)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "SUB_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 118)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MIN%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 119)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MIN%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 120)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MAX%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 121)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MAX%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 123)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "AVGRU" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 124)))) (var "Bu32")))
)
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "EXTADD_PAIRWISE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 125)))) (var "Bu32")))
)
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "EXTADD_PAIRWISE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 128)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ABS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 129)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "NEG" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 130)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "Q15MULR_SATS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 142)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 143)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ADD_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 144)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ADD_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 145)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "SUB" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 146)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "SUB_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 147)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "SUB_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 149)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MUL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 150)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MIN%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 151)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MIN%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 152)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MAX%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 153)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MAX%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 155)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "AVGRU" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 273)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "RELAXED_Q15MULRS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 131)))) (var "Bu32")))
)
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 132)))) (var "Bu32")))
)
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 133)))) (var "Bu32")))
)
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "S" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 134)))) (var "Bu32")))
)
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "U" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 135)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 136)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 137)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 138)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 139)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "SHL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 140)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 141)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 156)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 157)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 158)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 159)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 274)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))
)
)
)
(case "RELAXED_DOTS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 126)))) (var "Bu32")))
)
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "EXTADD_PAIRWISE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 127)))) (var "Bu32")))
)
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "EXTADD_PAIRWISE%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 160)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ABS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 161)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NEG" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 163)))) (var "Bu32")))
)
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 164)))) (var "Bu32")))
)
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 167)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 168)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 169)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 170)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 171)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "SHL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 172)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 173)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 174)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 177)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "SUB" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 181)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MUL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 182)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MIN%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 183)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MIN%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 184)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MAX%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 185)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MAX%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 186)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "DOTS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 188)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 189)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 190)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 191)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 275)))) (var "Bu32")))
)
(case
"VEXTTERNOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))
)
)
)
(case "RELAXED_DOT_ADDS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 192)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ABS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 193)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NEG" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 195)))) (var "Bu32")))
)
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 196)))) (var "Bu32")))
)
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 199)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 200)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 201)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 202)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 203)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case "SHL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 204)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 205)))) (var "Bu32")))
)
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 206)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 209)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "SUB" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 213)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MUL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 214)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "EQ" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 215)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NE" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 216)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 217)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 218)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 219)))) (var "Bu32")))
)
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 220)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 221)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 222)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 223)))) (var "Bu32")))
)
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case
"%X%"
(tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))
)
)
)
(case
"%"
(tup
(case
"%X%"
(tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))
)
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 103)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CEIL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 104)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "FLOOR" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 105)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "TRUNC" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 106)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NEAREST" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 224)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ABS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 225)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NEG" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 227)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "SQRT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 228)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 229)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "SUB" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 230)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MUL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 231)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "DIV" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 232)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MIN" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 233)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MAX" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 234)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "PMIN" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 235)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "PMAX" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 269)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_MIN" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 270)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_MAX" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 261)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_MADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 262)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_NMADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 116)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "CEIL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 117)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "FLOOR" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 122)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "TRUNC" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 148)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NEAREST" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 236)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ABS" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 237)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NEG" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 239)))) (var "Bu32")))
)
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "SQRT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 240)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 241)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "SUB" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 242)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MUL" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 243)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "DIV" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 244)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MIN" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 245)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MAX" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 246)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "PMIN" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 247)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "PMAX" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 271)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_MIN" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 272)))) (var "Bu32")))
)
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_MAX" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 263)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_MADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 264)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_NMADD" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 265)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 266)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 267)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 268)))) (var "Bu32")))
)
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 94)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "DEMOTE%" (tup (case "ZERO" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 95)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "PROMOTELOW" (tup))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 248)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "TRUNC_SAT%%" (tup (case "S" (tup)) (opt)))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 249)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "TRUNC_SAT%%" (tup (case "U" (tup)) (opt)))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 250)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 251)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 252)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "TRUNC_SAT%%" (tup (case "S" (tup)) (opt (case "ZERO" (tup)))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 253)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "TRUNC_SAT%%" (tup (case "U" (tup)) (opt (case "ZERO" (tup)))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 254)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt (case "LOW" (tup))) (case "S" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 255)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt (case "LOW" (tup))) (case "U" (tup))))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 257)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_TRUNC%%" (tup (case "S" (tup)) (opt)))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 258)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_TRUNC%%" (tup (case "U" (tup)) (opt)))
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 259)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case
"RELAXED_TRUNC%%"
(tup (case "S" (tup)) (opt (case "ZERO" (tup))))
)
)
)
)
(prod
(seq
(seq (num 0xFD))
(seq (attr (case "%" (tup (num (nat 260)))) (var "Bu32")))
)
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case
"RELAXED_TRUNC%%"
(tup (case "U" (tup)) (opt (case "ZERO" (tup))))
)
)
)
)
)
)
(gram
"Bexpr"
(var "expr")
(prod
(exp "in*" (iter (var "instr") list))
(seq
(seq (iter (attr (var "in") (var "Binstr")) list (dom "in" (var "in*"))))
(seq (num 0x0B))
)
(iter (var "in") list (dom "in" (var "in*")))
)
)
(gram
"Bsection_"
(exp "N" (var "N"))
(typ "en")
(gram "BX" (iter (var "en") list))
(iter (var "en") list)
(prod
(exp "len" nat)
(exp "en*" (iter (var "en") list))
(seq
(seq (attr (case "%" (tup (var "N"))) (var "Bbyte")))
(seq (attr (case "%" (tup (var "len"))) (var "Bu32")))
(seq (attr (iter (var "en") list (dom "en" (var "en*"))) (var "BX")))
)
(iter (var "en") list (dom "en" (var "en*")))
(if (cmp eq bool (var "len") (num (nat 0))))
)
(prod eps (list))
)
(gram
"Bcustom"
(iter (tup) list)
(prod (seq (seq (var "Bname")) (seq (iter (var "Bbyte") list))) (list (tup)))
)
(gram
"Bcustomsec"
(tup)
(prod
(var "Bsection_" (exp (num (nat 0))) (typ (tup)) (gram (var "Bcustom")))
(tup)
)
)
(gram
"Btype"
(var "type")
(prod
(exp "qt" (var "rectype"))
(attr (var "qt") (var "Brectype"))
(case "TYPE%" (tup (var "qt")))
)
)
(gram
"Btypesec"
(iter (var "type") list)
(prod
(exp "ty*" (iter (var "type") list))
(attr
(iter (var "ty") list (dom "ty" (var "ty*")))
(var
"Bsection_"
(exp (num (nat 1)))
(typ (var "type"))
(gram (var "Blist" (typ (var "type")) (gram (var "Btype"))))
)
)
(iter (var "ty") list (dom "ty" (var "ty*")))
)
)
(gram
"Bimport"
(var "import")
(prod
(exp "nm_1" (var "name"))
(exp "nm_2" (var "name"))
(exp "xt" (var "externtype"))
(seq
(seq (attr (var "nm_1") (var "Bname")))
(seq (attr (var "nm_2") (var "Bname")))
(seq (attr (var "xt") (var "Bexterntype")))
)
(case "IMPORT%%%" (tup (var "nm_1") (var "nm_2") (var "xt")))
)
)
(gram
"Bimportsec"
(iter (var "import") list)
(prod
(exp "im*" (iter (var "import") list))
(attr
(iter (var "im") list (dom "im" (var "im*")))
(var
"Bsection_"
(exp (num (nat 2)))
(typ (var "import"))
(gram (var "Blist" (typ (var "import")) (gram (var "Bimport"))))
)
)
(iter (var "im") list (dom "im" (var "im*")))
)
)
(gram
"Bfuncsec"
(iter (var "typeidx") list)
(prod
(exp "x*" (iter (var "idx") list))
(attr
(iter (var "x") list (dom "x" (var "x*")))
(var
"Bsection_"
(exp (num (nat 3)))
(typ (var "typeidx"))
(gram (var "Blist" (typ (var "typeidx")) (gram (var "Btypeidx"))))
)
)
(iter (var "x") list (dom "x" (var "x*")))
)
)
(gram
"Btable"
(var "table")
(prod
(exp "tt" (var "tabletype"))
(exp "ht" (var "heaptype"))
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(attr (var "tt") (var "Btabletype"))
(case "TABLE%%" (tup (var "tt") (list (case "REF.NULL%" (tup (var "ht"))))))
(if
(cmp
eq
bool
(var "tt")
(case
"%%%"
(tup
(var "at")
(var "lim")
(case "REF%%" (tup (iter (case "NULL" (tup)) opt) (var "ht")))
)
)
)
)
)
(prod
(exp "tt" (var "tabletype"))
(exp "e" (var "expr"))
(seq
(seq (num 0x40))
(seq (num 0x00))
(seq (attr (var "tt") (var "Btabletype")))
(seq (attr (var "e") (var "Bexpr")))
)
(case "TABLE%%" (tup (var "tt") (var "e")))
)
)
(gram
"Btablesec"
(iter (var "table") list)
(prod
(exp "tab*" (iter (var "table") list))
(attr
(iter (var "tab") list (dom "tab" (var "tab*")))
(var
"Bsection_"
(exp (num (nat 4)))
(typ (var "table"))
(gram (var "Blist" (typ (var "table")) (gram (var "Btable"))))
)
)
(iter (var "tab") list (dom "tab" (var "tab*")))
)
)
(gram
"Bmem"
(var "mem")
(prod
(exp "mt" (var "memtype"))
(attr (var "mt") (var "Bmemtype"))
(case "MEMORY%" (tup (var "mt")))
)
)
(gram
"Bmemsec"
(iter (var "mem") list)
(prod
(exp "mem*" (iter (var "mem") list))
(attr
(iter (var "mem") list (dom "mem" (var "mem*")))
(var
"Bsection_"
(exp (num (nat 5)))
(typ (var "mem"))
(gram (var "Blist" (typ (var "mem")) (gram (var "Bmem"))))
)
)
(iter (var "mem") list (dom "mem" (var "mem*")))
)
)
(gram
"Bglobal"
(var "global")
(prod
(exp "gt" (var "globaltype"))
(exp "e" (var "expr"))
(seq
(seq (attr (var "gt") (var "Bglobaltype")))
(seq (attr (var "e") (var "Bexpr")))
)
(case "GLOBAL%%" (tup (var "gt") (var "e")))
)
)
(gram
"Bglobalsec"
(iter (var "global") list)
(prod
(exp "glob*" (iter (var "global") list))
(attr
(iter (var "glob") list (dom "glob" (var "glob*")))
(var
"Bsection_"
(exp (num (nat 6)))
(typ (var "global"))
(gram (var "Blist" (typ (var "global")) (gram (var "Bglobal"))))
)
)
(iter (var "glob") list (dom "glob" (var "glob*")))
)
)
(gram
"Bexport"
(var "export")
(prod
(exp "nm" (var "name"))
(exp "xx" (var "externidx"))
(seq
(seq (attr (var "nm") (var "Bname")))
(seq (attr (var "xx") (var "Bexternidx")))
)
(case "EXPORT%%" (tup (var "nm") (var "xx")))
)
)
(gram
"Bexportsec"
(iter (var "export") list)
(prod
(exp "ex*" (iter (var "export") list))
(attr
(iter (var "ex") list (dom "ex" (var "ex*")))
(var
"Bsection_"
(exp (num (nat 7)))
(typ (var "export"))
(gram (var "Blist" (typ (var "export")) (gram (var "Bexport"))))
)
)
(iter (var "ex") list (dom "ex" (var "ex*")))
)
)
(gram
"Bstart"
(iter (var "start") list)
(prod
(exp "x" (var "idx"))
(attr (var "x") (var "Bfuncidx"))
(list (case "START%" (tup (var "x"))))
)
)
(typ "startopt" (inst (alias (iter (var "start") list))))
(gram
"Bstartsec"
(iter (var "start") opt)
(prod
(exp "startopt" (var "startopt"))
(attr
(var "startopt")
(var
"Bsection_"
(exp (num (nat 8)))
(typ (var "start"))
(gram (var "Bstart"))
)
)
(call "opt_" (typ (var "start")) (exp (var "startopt")))
)
)
(gram
"Belemkind"
(var "reftype")
(prod
(num 0x00)
(case "REF%%" (tup (opt (case "NULL" (tup))) (case "FUNC" (tup))))
)
)
(gram
"Belem"
(var "elem")
(prod
(exp "e_o" (var "expr"))
(exp "y*" (iter (var "idx") list))
(seq
(seq (attr (case "%" (tup (num (nat 0)))) (var "Bu32")))
(seq (attr (var "e_o") (var "Bexpr")))
(seq
(attr
(iter (var "y") list (dom "y" (var "y*")))
(var "Blist" (typ (var "funcidx")) (gram (var "Bfuncidx")))
)
)
)
(case
"ELEM%%%"
(tup
(case "REF%%" (tup (opt) (case "FUNC" (tup))))
(list
(iter (case "REF.FUNC%" (tup (var "y"))) list (dom "y" (var "y*")))
)
(case "ACTIVE%%" (tup (case "%" (tup (num (nat 0)))) (var "e_o")))
)
)
)
(prod
(exp "rt" (var "reftype"))
(exp "y*" (iter (var "idx") list))
(seq
(seq (attr (case "%" (tup (num (nat 1)))) (var "Bu32")))
(seq (attr (var "rt") (var "Belemkind")))
(seq
(attr
(iter (var "y") list (dom "y" (var "y*")))
(var "Blist" (typ (var "funcidx")) (gram (var "Bfuncidx")))
)
)
)
(case
"ELEM%%%"
(tup
(var "rt")
(list
(iter (case "REF.FUNC%" (tup (var "y"))) list (dom "y" (var "y*")))
)
(case "PASSIVE" (tup))
)
)
)
(prod
(exp "x" (var "idx"))
(exp "e" (var "expr"))
(exp "rt" (var "reftype"))
(exp "y*" (iter (var "idx") list))
(seq
(seq (attr (case "%" (tup (num (nat 2)))) (var "Bu32")))
(seq (attr (var "x") (var "Btableidx")))
(seq (attr (var "e") (var "Bexpr")))
(seq (attr (var "rt") (var "Belemkind")))
(seq
(attr
(iter (var "y") list (dom "y" (var "y*")))
(var "Blist" (typ (var "funcidx")) (gram (var "Bfuncidx")))
)
)
)
(case
"ELEM%%%"
(tup
(var "rt")
(list
(iter (case "REF.FUNC%" (tup (var "y"))) list (dom "y" (var "y*")))
)
(case "ACTIVE%%" (tup (var "x") (var "e")))
)
)
)
(prod
(exp "rt" (var "reftype"))
(exp "y*" (iter (var "idx") list))
(seq
(seq (attr (case "%" (tup (num (nat 3)))) (var "Bu32")))
(seq (attr (var "rt") (var "Belemkind")))
(seq
(attr
(iter (var "y") list (dom "y" (var "y*")))
(var "Blist" (typ (var "funcidx")) (gram (var "Bfuncidx")))
)
)
)
(case
"ELEM%%%"
(tup
(var "rt")
(list
(iter (case "REF.FUNC%" (tup (var "y"))) list (dom "y" (var "y*")))
)
(case "DECLARE" (tup))
)
)
)
(prod
(exp "e_O" (var "expr"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (attr (case "%" (tup (num (nat 4)))) (var "Bu32")))
(seq (attr (var "e_O") (var "Bexpr")))
(seq
(attr
(iter (var "e") list (dom "e" (var "e*")))
(var "Blist" (typ (var "expr")) (gram (var "Bexpr")))
)
)
)
(case
"ELEM%%%"
(tup
(case "REF%%" (tup (opt (case "NULL" (tup))) (case "FUNC" (tup))))
(iter (var "e") list (dom "e" (var "e*")))
(case "ACTIVE%%" (tup (case "%" (tup (num (nat 0)))) (var "e_O")))
)
)
)
(prod
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (attr (case "%" (tup (num (nat 5)))) (var "Bu32")))
(seq (attr (var "rt") (var "Breftype")))
(seq
(attr
(iter (var "e") list (dom "e" (var "e*")))
(var "Blist" (typ (var "expr")) (gram (var "Bexpr")))
)
)
)
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") list (dom "e" (var "e*")))
(case "PASSIVE" (tup))
)
)
)
(prod
(exp "x" (var "idx"))
(exp "e_O" (var "expr"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (attr (case "%" (tup (num (nat 6)))) (var "Bu32")))
(seq (attr (var "x") (var "Btableidx")))
(seq (attr (var "e_O") (var "Bexpr")))
(seq
(attr
(iter (var "e") list (dom "e" (var "e*")))
(var "Blist" (typ (var "expr")) (gram (var "Bexpr")))
)
)
)
(case
"ELEM%%%"
(tup
(case "REF%%" (tup (opt (case "NULL" (tup))) (case "FUNC" (tup))))
(iter (var "e") list (dom "e" (var "e*")))
(case "ACTIVE%%" (tup (var "x") (var "e_O")))
)
)
)
(prod
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (attr (case "%" (tup (num (nat 7)))) (var "Bu32")))
(seq (attr (var "rt") (var "Breftype")))
(seq
(attr
(iter (var "e") list (dom "e" (var "e*")))
(var "Blist" (typ (var "expr")) (gram (var "Bexpr")))
)
)
)
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") list (dom "e" (var "e*")))
(case "DECLARE" (tup))
)
)
)
)
(gram
"Belemsec"
(iter (var "elem") list)
(prod
(exp "elem*" (iter (var "elem") list))
(attr
(iter (var "elem") list (dom "elem" (var "elem*")))
(var
"Bsection_"
(exp (num (nat 9)))
(typ (var "elem"))
(gram (var "Blist" (typ (var "elem")) (gram (var "Belem"))))
)
)
(iter (var "elem") list (dom "elem" (var "elem*")))
)
)
(typ
"code"
(inst
(alias
(tup
(bind (var "_") (iter (var "local") list))
(bind (var "_") (var "expr"))
)
)
)
)
(gram
"Blocals"
(iter (var "local") list)
(prod
(exp "n" (var "n"))
(exp "t" (var "valtype"))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Bu32")))
(seq (attr (var "t") (var "Bvaltype")))
)
(iter (case "LOCAL%" (tup (var "t"))) (listn (var "n")))
)
)
(gram
"Bfunc"
(var "code")
(prod
(exp "loc**" (iter (iter (var "local") list) list))
(exp "e" (var "expr"))
(seq
(seq
(attr
(iter
(iter (var "loc") list (dom "loc" (var "loc*")))
list
(dom "loc*" (var "loc**"))
)
(var "Blist" (typ (iter (var "local") list)) (gram (var "Blocals")))
)
)
(seq (attr (var "e") (var "Bexpr")))
)
(tup
(call
"concat_"
(typ (var "local"))
(exp
(iter
(iter (var "loc") list (dom "loc" (var "loc*")))
list
(dom "loc*" (var "loc**"))
)
)
)
(var "e")
)
(if
(cmp
lt
nat
(len
(call
"concat_"
(typ (var "local"))
(exp
(iter
(iter (var "loc") list (dom "loc" (var "loc*")))
list
(dom "loc*" (var "loc**"))
)
)
)
)
(bin pow nat (num (nat 2)) (num (nat 32)))
)
)
)
)
(gram
"Bcode"
(var "code")
(prod
(exp "len" nat)
(exp "code" (var "code"))
(seq
(seq (attr (case "%" (tup (var "len"))) (var "Bu32")))
(seq (attr (var "code") (var "Bfunc")))
)
(var "code")
(if (cmp eq bool (var "len") (num (nat 0))))
)
)
(gram
"Bcodesec"
(iter (var "code") list)
(prod
(exp "code*" (iter (var "code") list))
(attr
(iter (var "code") list (dom "code" (var "code*")))
(var
"Bsection_"
(exp (num (nat 10)))
(typ (var "code"))
(gram (var "Blist" (typ (var "code")) (gram (var "Bcode"))))
)
)
(iter (var "code") list (dom "code" (var "code*")))
)
)
(gram
"Bdata"
(var "data")
(prod
(exp "e" (var "expr"))
(exp "b*" (iter (var "byte") list))
(seq
(seq (attr (case "%" (tup (num (nat 0)))) (var "Bu32")))
(seq (attr (var "e") (var "Bexpr")))
(seq
(attr
(iter (var "b") list (dom "b" (var "b*")))
(var "Blist" (typ (var "byte")) (gram (var "Bbyte")))
)
)
)
(case
"DATA%%"
(tup
(iter (var "b") list (dom "b" (var "b*")))
(case "ACTIVE%%" (tup (case "%" (tup (num (nat 0)))) (var "e")))
)
)
)
(prod
(exp "b*" (iter (var "byte") list))
(seq
(seq (attr (case "%" (tup (num (nat 1)))) (var "Bu32")))
(seq
(attr
(iter (var "b") list (dom "b" (var "b*")))
(var "Blist" (typ (var "byte")) (gram (var "Bbyte")))
)
)
)
(case
"DATA%%"
(tup (iter (var "b") list (dom "b" (var "b*"))) (case "PASSIVE" (tup)))
)
)
(prod
(exp "x" (var "idx"))
(exp "e" (var "expr"))
(exp "b*" (iter (var "byte") list))
(seq
(seq (attr (case "%" (tup (num (nat 2)))) (var "Bu32")))
(seq (attr (var "x") (var "Bmemidx")))
(seq (attr (var "e") (var "Bexpr")))
(seq
(attr
(iter (var "b") list (dom "b" (var "b*")))
(var "Blist" (typ (var "byte")) (gram (var "Bbyte")))
)
)
)
(case
"DATA%%"
(tup
(iter (var "b") list (dom "b" (var "b*")))
(case "ACTIVE%%" (tup (var "x") (var "e")))
)
)
)
)
(gram
"Bdatasec"
(iter (var "data") list)
(prod
(exp "data*" (iter (var "data") list))
(attr
(iter (var "data") list (dom "data" (var "data*")))
(var
"Bsection_"
(exp (num (nat 11)))
(typ (var "data"))
(gram (var "Blist" (typ (var "data")) (gram (var "Bdata"))))
)
)
(iter (var "data") list (dom "data" (var "data*")))
)
)
(gram
"Bdatacnt"
(iter (var "u32") list)
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "Bu32"))
(list (case "%" (tup (var "n"))))
)
)
(typ "nopt" (inst (alias (iter (var "u32") list))))
(gram
"Bdatacntsec"
(iter (var "u32") opt)
(prod
(exp "nopt" (var "nopt"))
(attr
(var "nopt")
(var
"Bsection_"
(exp (num (nat 12)))
(typ (var "u32"))
(gram (var "Bdatacnt"))
)
)
(call "opt_" (typ (var "u32")) (exp (var "nopt")))
)
)
(gram
"Btag"
(var "tag")
(prod
(exp "jt" (var "tagtype"))
(attr (var "jt") (var "Btagtype"))
(case "TAG%" (tup (var "jt")))
)
)
(gram
"Btagsec"
(iter (var "tag") list)
(prod
(exp "tag*" (iter (var "tag") list))
(attr
(iter (var "tag") list (dom "tag" (var "tag*")))
(var
"Bsection_"
(exp (num (nat 13)))
(typ (var "tag"))
(gram (var "Blist" (typ (var "tag")) (gram (var "Btag"))))
)
)
(iter (var "tag") list (dom "tag" (var "tag*")))
)
)
(gram
"Bmagic"
(tup)
(prod
(seq (seq (num 0x00)) (seq (num 0x61)) (seq (num 0x73)) (seq (num 0x6D)))
(tup)
)
)
(gram
"Bversion"
(tup)
(prod
(seq (seq (num 0x01)) (seq (num 0x00)) (seq (num 0x00)) (seq (num 0x00)))
(tup)
)
)
(gram
"Bmodule"
(var "module")
(prod
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "typeidx*" (iter (var "typeidx") list))
(exp "table*" (iter (var "table") list))
(exp "mem*" (iter (var "mem") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "export*" (iter (var "export") list))
(exp "start?" (iter (var "start") opt))
(exp "elem*" (iter (var "elem") list))
(exp "n?" (iter (var "n") opt))
(exp "local**" (iter (iter (var "local") list) list))
(exp "expr*" (iter (var "expr") list))
(exp "data*" (iter (var "data") list))
(exp "func*" (iter (var "func") list))
(seq
(seq (var "Bmagic"))
(seq (var "Bversion"))
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "type") list (dom "type" (var "type*")))
(var "Btypesec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "import") list (dom "import" (var "import*")))
(var "Bimportsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "typeidx") list (dom "typeidx" (var "typeidx*")))
(var "Bfuncsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "table") list (dom "table" (var "table*")))
(var "Btablesec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr (iter (var "mem") list (dom "mem" (var "mem*"))) (var "Bmemsec"))
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr (iter (var "tag") list (dom "tag" (var "tag*"))) (var "Btagsec"))
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "global") list (dom "global" (var "global*")))
(var "Bglobalsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "export") list (dom "export" (var "export*")))
(var "Bexportsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "start") opt (dom "start" (var "start?")))
(var "Bstartsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "elem") list (dom "elem" (var "elem*")))
(var "Belemsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (case "%" (tup (var "n"))) opt (dom "n" (var "n?")))
(var "Bdatacntsec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter
(tup
(iter (var "local") list (dom "local" (var "local*")))
(var "expr")
)
list
(dom "expr" (var "expr*"))
(dom "local*" (var "local**"))
)
(var "Bcodesec")
)
)
(seq (iter (var "Bcustomsec") list))
(seq
(attr
(iter (var "data") list (dom "data" (var "data*")))
(var "Bdatasec")
)
)
(seq (iter (var "Bcustomsec") list))
)
(case
"MODULE%%%%%%%%%%%"
(tup
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "export") list (dom "export" (var "export*")))
)
)
(iter
(if
(cmp
eq
bool
(var "n")
(len (iter (var "data") list (dom "data" (var "data*"))))
)
)
opt
(dom "n" (var "n?"))
)
(if
(bin
or
bool
(cmp ne bool (iter (var "n") opt (dom "n" (var "n?"))) (opt))
(cmp
eq
bool
(call
"dataidx_funcs"
(exp (iter (var "func") list (dom "func" (var "func*"))))
)
(list)
)
)
)
(iter
(if
(cmp
eq
bool
(var "func")
(case
"FUNC%%%"
(tup
(var "typeidx")
(iter (var "local") list (dom "local" (var "local*")))
(var "expr")
)
)
)
)
list
(dom "expr" (var "expr*"))
(dom "func" (var "func*"))
(dom "local*" (var "local**"))
(dom "typeidx" (var "typeidx*"))
)
)
)
(gram
"Tchar"
(var "char")
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (range (num 0x00) (num 0xD7FF)))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (range (num 0xE000) (num 0x10FFFF)))
(case "%" (tup (var "<implicit-prod-result>")))
)
)
(gram
"Tsource"
(tup)
(prod
(exp "<implicit-prod-result>" (var "char"))
(attr (list (var "<implicit-prod-result>")) (iter (var "Tchar") list))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"TuNplain"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") eps)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"TsNplain"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") eps)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"TfNplain"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") eps)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tidchar"
(var "char")
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (range (num 0x30) (num 0x39)))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (range (num 0x41) (num 0x5A)))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (range (num 0x61) (num 0x7A)))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x21))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x23))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x24))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x25))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x26))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x27))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x2A))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x2B))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x2D))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x2E))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x2F))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x3A))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x3C))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x3D))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x3E))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x3F))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x40))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x5C))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x5E))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x5F))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x60))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x7C))
(case "%" (tup (var "<implicit-prod-result>")))
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x7E))
(case "%" (tup (var "<implicit-prod-result>")))
)
)
(gram
"Tdigit"
nat
(prod (num 0x30) (num (nat 0)))
(prod (num 0x31) (num (nat 1)))
(prod (num 0x32) (num (nat 2)))
(prod (num 0x33) (num (nat 3)))
(prod (num 0x34) (num (nat 4)))
(prod (num 0x35) (num (nat 5)))
(prod (num 0x36) (num (nat 6)))
(prod (num 0x37) (num (nat 7)))
(prod (num 0x38) (num (nat 8)))
(prod (num 0x39) (num (nat 9)))
)
(gram
"Thexdigit"
nat
(prod (exp "d" nat) (attr (var "d") (var "Tdigit")) (var "d"))
(prod (num 0x41) (num (nat 10)))
(prod (num 0x42) (num (nat 11)))
(prod (num 0x43) (num (nat 12)))
(prod (num 0x44) (num (nat 13)))
(prod (num 0x45) (num (nat 14)))
(prod (num 0x46) (num (nat 15)))
(prod (num 0x61) (num (nat 10)))
(prod (num 0x62) (num (nat 11)))
(prod (num 0x63) (num (nat 12)))
(prod (num 0x64) (num (nat 13)))
(prod (num 0x65) (num (nat 14)))
(prod (num 0x66) (num (nat 15)))
)
(rec
(gram
"Thexnum"
nat
(prod (exp "h" nat) (attr (var "h") (var "Thexdigit")) (var "h"))
(prod
(exp "n" (var "n"))
(exp "h" nat)
(seq
(seq (attr (var "n") (var "Thexnum")))
(seq (iter (text "_") opt))
(seq (attr (var "h") (var "Thexdigit")))
)
(bin add nat (bin mul nat (num (nat 16)) (var "n")) (var "h"))
)
)
)
(gram
"Tstringchar"
(var "char")
(prod
(exp "c" (var "char"))
(attr (var "c") (var "Tchar"))
(var "c")
(if
(bin
and
bool
(bin
and
bool
(bin
and
bool
(cmp ge nat (proj (uncase (var "c") "%") 0) (num (nat 32)))
(cmp ne bool (proj (uncase (var "c") "%") 0) (num (nat 127)))
)
(cmp ne bool (var "c") (case "%" (tup (num (nat 34)))))
)
(cmp ne bool (var "c") (case "%" (tup (num (nat 92)))))
)
)
)
(prod (text "\\t") (case "%" (tup (num (nat 9)))))
(prod (text "\\n") (case "%" (tup (num (nat 10)))))
(prod (text "\\r") (case "%" (tup (num (nat 13)))))
(prod (text "\\\"") (case "%" (tup (num (nat 34)))))
(prod (text "\\'") (case "%" (tup (num (nat 39)))))
(prod (text "\\\\") (case "%" (tup (num (nat 92)))))
(prod
(exp "n" (var "n"))
(seq
(seq (text "\\u{"))
(seq (attr (var "n") (var "Thexnum")))
(seq (text "}"))
)
(case "%" (tup (var "n")))
(if
(bin
or
bool
(cmp lt nat (var "n") (num (nat 55296)))
(bin
and
bool
(cmp le nat (num (nat 59392)) (var "n"))
(cmp lt nat (var "n") (num (nat 1114112)))
)
)
)
)
)
(gram
"Tstringelem"
(iter (var "byte") list)
(prod
(exp "c" (var "char"))
(attr (var "c") (var "Tstringchar"))
(call "utf8" (exp (list (var "c"))))
)
(prod
(exp "h_1" nat)
(exp "h_2" nat)
(seq
(seq (text "\\"))
(seq (attr (var "h_1") (var "Thexdigit")))
(seq (attr (var "h_2") (var "Thexdigit")))
)
(list
(case
"%"
(tup (bin add nat (bin mul nat (num (nat 16)) (var "h_1")) (var "h_2")))
)
)
)
)
(gram
"Tstring"
(iter (var "byte") list)
(prod
(exp "b**" (iter (iter (var "byte") list) list))
(seq
(seq (text "\""))
(seq
(iter
(attr (iter (var "b") list (dom "b" (var "b*"))) (var "Tstringelem"))
list
(dom "b*" (var "b**"))
)
)
(seq (text "\""))
)
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(iter (var "b") list (dom "b" (var "b*")))
list
(dom "b*" (var "b**"))
)
)
)
(if
(cmp
lt
nat
(len
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(iter (var "b") list (dom "b" (var "b*")))
list
(dom "b*" (var "b**"))
)
)
)
)
(bin pow nat (num (nat 2)) (num (nat 32)))
)
)
)
)
(gram
"Tname"
(var "name")
(prod
(exp "b*" (iter (var "byte") list))
(exp "c*" (iter (var "char") list))
(attr (iter (var "b") list (dom "b" (var "b*"))) (var "Tstring"))
(case "%" (tup (iter (var "c") list (dom "c" (var "c*")))))
(if
(cmp
eq
bool
(iter (var "b") list (dom "b" (var "b*")))
(call "utf8" (exp (iter (var "c") list (dom "c" (var "c*")))))
)
)
)
)
(gram
"Tid"
(var "name")
(prod
(exp "c*" (iter (var "char") list))
(seq
(seq (text "$"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Tidchar") list1)
)
)
)
(case "%" (tup (iter (var "c") list (dom "c" (var "c*")))))
)
(prod
(exp "c*" (iter (var "char") list))
(seq
(seq (text "$"))
(seq
(attr
(case "%" (tup (iter (var "c") list (dom "c" (var "c*")))))
(var "Tname")
)
)
)
(case "%" (tup (iter (var "c") list (dom "c" (var "c*")))))
(if
(cmp
gt
nat
(len (iter (var "c") list (dom "c" (var "c*"))))
(num (nat 0))
)
)
)
)
(gram
"Tkeyword"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (range (num 0x61) (num 0x7A)))
(seq (iter (var "Tidchar") list))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Treserved"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(list (var "<implicit-prod-result>"))
(iter
(alt
(seq (var "Tidchar"))
(seq (var "Tstring"))
(seq (text ","))
(seq (text ";"))
(seq (text "["))
(seq (text "]"))
(seq (text "{"))
(seq (text "}"))
)
list1
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Ttoken"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tkeyword"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "TuNplain"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "TsNplain"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "TfNplain"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (var "byte"))
(attr (list (var "<implicit-prod-result>")) (var "Tstring"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (var "name"))
(attr (var "<implicit-prod-result>") (var "Tid"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x28))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x29))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Treserved"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tannotid"
(tup)
(prod
(exp "<implicit-prod-result>" (var "char"))
(attr (list (var "<implicit-prod-result>")) (iter (var "Tidchar") list1))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (var "name"))
(attr (var "<implicit-prod-result>") (var "Tname"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(rec
(gram
"Tblockcomment"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (text "(;"))
(seq (iter (var "Tblockchar") list))
(seq (text ";)"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tblockchar"
(tup)
(prod
(exp "<implicit-prod-result>" (var "char"))
(exp "c" (var "char"))
(attr (var "<implicit-prod-result>") (attr (var "c") (var "Tchar")))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
(if
(bin
and
bool
(cmp ne bool (var "c") (case "%" (tup (num (nat 59)))))
(cmp ne bool (var "c") (case "%" (tup (num (nat 40)))))
)
)
)
(prod
(exp "<implicit-prod-result>" (tup))
(exp "c" (var "char"))
(attr
(var "<implicit-prod-result>")
(seq (seq (iter (text ";") list1)) (seq (attr (var "c") (var "Tchar"))))
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
(if
(bin
and
bool
(cmp ne bool (var "c") (case "%" (tup (num (nat 59)))))
(cmp ne bool (var "c") (case "%" (tup (num (nat 41)))))
)
)
)
(prod
(exp "<implicit-prod-result>" (tup))
(exp "c" (var "char"))
(attr
(var "<implicit-prod-result>")
(seq (seq (iter (text "(") list1)) (seq (attr (var "c") (var "Tchar"))))
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
(if
(bin
and
bool
(cmp ne bool (var "c") (case "%" (tup (num (nat 59)))))
(cmp ne bool (var "c") (case "%" (tup (num (nat 40)))))
)
)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tblockcomment"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
)
(gram
"Teof"
(tup)
(prod
(exp "<implicit-prod-result>" text)
(attr (var "<implicit-prod-result>") (text ""))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tlinechar"
(tup)
(prod
(exp "<implicit-prod-result>" (var "char"))
(exp "c" (var "char"))
(attr (var "<implicit-prod-result>") (attr (var "c") (var "Tchar")))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
(if
(bin
and
bool
(cmp ne bool (proj (uncase (var "c") "%") 0) (num (nat 10)))
(cmp ne bool (proj (uncase (var "c") "%") 0) (num (nat 13)))
)
)
)
)
(gram
"Tnewline"
(tup)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x0A))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x0D))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq (seq (num 0x0D)) (seq (num 0x0A)))
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tlinecomment"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (text ";;"))
(seq (iter (var "Tlinechar") list))
(alt (var "Tnewline") (var "Teof"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tcomment"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tlinecomment"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tblockcomment"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tformat"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tnewline"))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" nat)
(attr (var "<implicit-prod-result>") (num 0x09))
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(rec
(gram
"Tspace"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(list (var "<implicit-prod-result>"))
(iter
(alt (seq (text " ")) (var "Tformat") (var "Tcomment") (var "Tannot"))
list
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Tannot"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (text "(@"))
(var "Tannotid")
(seq (iter (alt (var "Tspace") (var "Ttoken")) list))
(seq (text ")"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
)
(gram
"Tsign"
int
(prod eps (un plus int (cvt nat int (num (nat 1)))))
(prod (text "+") (un plus int (cvt nat int (num (nat 1)))))
(prod (text "-") (un minus int (cvt nat int (num (nat 1)))))
)
(rec
(gram
"Tnum"
nat
(prod (exp "d" nat) (attr (var "d") (var "Tdigit")) (var "d"))
(prod
(exp "n" (var "n"))
(exp "d" nat)
(seq
(seq (attr (var "n") (var "Tnum")))
(seq (iter (text "_") opt))
(seq (attr (var "d") (var "Tdigit")))
)
(bin add nat (bin mul nat (num (nat 10)) (var "n")) (var "d"))
)
)
)
(gram
"TuN"
(exp "N" (var "N"))
(var "uN" (exp (var "N")))
(prod
(exp "n" (var "n"))
(attr (var "n") (var "Tnum"))
(case "%" (tup (var "n")))
(if (cmp lt nat (var "n") (bin pow nat (num (nat 2)) (var "N"))))
)
(prod
(exp "n" (var "n"))
(seq (seq (text "0x")) (seq (attr (var "n") (var "Thexnum"))))
(case "%" (tup (var "n")))
(if (cmp lt nat (var "n") (bin pow nat (num (nat 2)) (var "N"))))
)
)
(gram
"TsN"
(exp "N" (var "N"))
(var "sN" (exp (var "N")))
(prod
(exp "s" int)
(exp "n" (var "n"))
(seq
(seq (attr (var "s") (var "Tsign")))
(seq (attr (case "%" (tup (var "n"))) (var "TuN" (exp (var "N")))))
)
(case "%" (tup (bin mul int (var "s") (cvt nat int (var "n")))))
(if
(bin
and
bool
(cmp
le
int
(un
minus
int
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
(bin mul int (var "s") (cvt nat int (var "n")))
)
(cmp
lt
int
(bin mul int (var "s") (cvt nat int (var "n")))
(cvt
nat
int
(bin
pow
nat
(num (nat 2))
(cvt
int
nat
(bin
sub
int
(cvt nat int (var "N"))
(cvt nat int (num (nat 1)))
)
)
)
)
)
)
)
)
)
(gram
"TiN"
(exp "N" (var "N"))
(var "iN" (exp (var "N")))
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "TuN" (exp (var "N"))))
(case "%" (tup (var "n")))
)
(prod
(exp "i" (var "sN" (exp (var "N"))))
(attr (var "i") (var "TsN" (exp (var "N"))))
(case
"%"
(tup
(call
"inv_signed_"
(exp (var "N"))
(exp (proj (uncase (var "i") "%") 0))
)
)
)
)
)
(rec
(gram
"Tfrac"
rat
(prod
(exp "d" nat)
(attr (var "d") (var "Tdigit"))
(bin div rat (cvt nat rat (var "d")) (cvt nat rat (num (nat 10))))
)
(prod
(exp "d" nat)
(exp "p" rat)
(seq
(seq (attr (var "d") (var "Tdigit")))
(seq (iter (text "_") opt))
(seq (attr (var "p") (var "Tfrac")))
)
(bin
div
rat
(cvt
nat
rat
(bin
add
nat
(var "d")
(cvt rat nat (bin div rat (var "p") (cvt nat rat (num (nat 10)))))
)
)
(cvt nat rat (num (nat 10)))
)
)
)
)
(rec
(gram
"Thexfrac"
rat
(prod
(exp "h" nat)
(attr (var "h") (var "Thexdigit"))
(bin div rat (cvt nat rat (var "h")) (cvt nat rat (num (nat 16))))
)
(prod
(exp "h" nat)
(exp "p" rat)
(seq
(seq (attr (var "h") (var "Thexdigit")))
(seq (iter (text "_") opt))
(seq (attr (var "p") (var "Thexfrac")))
)
(bin
div
rat
(cvt
nat
rat
(bin
add
nat
(var "h")
(cvt rat nat (bin div rat (var "p") (cvt nat rat (num (nat 16)))))
)
)
(cvt nat rat (num (nat 16)))
)
)
)
)
(gram
"Tmant"
rat
(prod
(exp "p" nat)
(seq (seq (attr (var "p") (var "Tnum"))) (seq (iter (text ".") opt)))
(cvt nat rat (var "p"))
)
(prod
(exp "p" nat)
(exp "q" rat)
(seq
(seq (attr (var "p") (var "Tnum")))
(seq (text "."))
(seq (attr (var "q") (var "Tfrac")))
)
(cvt nat rat (bin add nat (var "p") (cvt rat nat (var "q"))))
)
)
(gram
"Thexmant"
rat
(prod
(exp "p" nat)
(seq (seq (attr (var "p") (var "Thexnum"))) (seq (iter (text ".") opt)))
(cvt nat rat (var "p"))
)
(prod
(exp "p" nat)
(exp "q" rat)
(seq
(seq (attr (var "p") (var "Thexnum")))
(seq (text "."))
(seq (attr (var "q") (var "Thexfrac")))
)
(cvt nat rat (bin add nat (var "p") (cvt rat nat (var "q"))))
)
)
(def "ieee_" (exp "N" (var "N")) (exp "rat" rat) (var "fNmag" (exp (var "N"))))
(gram
"Tfloat"
rat
(prod
(exp "p" rat)
(exp "s" int)
(exp "ee" nat)
(seq
(seq (attr (var "p") (var "Tmant")))
(alt (seq (text "E")) (seq (text "e")))
(seq (attr (var "s") (var "Tsign")))
(seq (attr (var "ee") (var "Tnum")))
)
(bin
mul
rat
(var "p")
(cvt
nat
rat
(bin
pow
nat
(num (nat 10))
(cvt int nat (bin mul int (var "s") (cvt nat int (var "ee"))))
)
)
)
)
)
(gram
"Thexfloat"
rat
(prod
(exp "p" rat)
(exp "s" int)
(exp "ee" nat)
(seq
(seq (text "0x"))
(seq (attr (var "p") (var "Thexmant")))
(alt (seq (text "P")) (seq (text "p")))
(seq (attr (var "s") (var "Tsign")))
(seq (attr (var "ee") (var "Tnum")))
)
(bin
mul
rat
(var "p")
(cvt
nat
rat
(bin
pow
nat
(num (nat 2))
(cvt int nat (bin mul int (var "s") (cvt nat int (var "ee"))))
)
)
)
)
)
(gram
"TfNmag"
(exp "N" (var "N"))
(var "fNmag" (exp (var "N")))
(prod
(exp "q" rat)
(attr (var "q") (var "Tfloat"))
(call "ieee_" (exp (var "N")) (exp (var "q")))
(if
(cmp
ne
bool
(call "ieee_" (exp (var "N")) (exp (var "q")))
(case "INF" (tup))
)
)
)
(prod
(exp "q" rat)
(attr (var "q") (var "Thexfloat"))
(call "ieee_" (exp (var "N")) (exp (var "q")))
(if
(cmp
ne
bool
(call "ieee_" (exp (var "N")) (exp (var "q")))
(case "INF" (tup))
)
)
)
(prod (text "inf") (case "INF" (tup)))
(prod (text "nan") (case "NAN%" (tup (call "canon_" (exp (var "N"))))))
(prod
(exp "n" (var "n"))
(seq (seq (text "nan:0x")) (seq (attr (var "n") (var "Thexnum"))))
(case "NAN%" (tup (var "n")))
(if
(bin
and
bool
(cmp le nat (num (nat 1)) (var "n"))
(cmp
lt
nat
(var "n")
(bin pow nat (num (nat 2)) (call "signif" (exp (var "N"))))
)
)
)
)
)
(gram
"TfN"
(exp "N" (var "N"))
(var "fN" (exp (var "N")))
(prod
(exp "q" (var "fNmag" (exp (var "N"))))
(seq
(seq (attr (un plus int (cvt nat int (num (nat 1)))) (var "Tsign")))
(seq (attr (var "q") (var "TfNmag" (exp (var "N")))))
)
(case "POS%" (tup (var "q")))
)
(prod
(exp "q" (var "fNmag" (exp (var "N"))))
(seq
(seq (attr (un minus int (cvt nat int (num (nat 1)))) (var "Tsign")))
(seq (attr (var "q") (var "TfNmag" (exp (var "N")))))
)
(case "NEG%" (tup (var "q")))
)
)
(gram
"Tu8"
(var "u8")
(prod
(exp "<implicit-prod-result>" (var "uN" (exp (num (nat 8)))))
(attr (var "<implicit-prod-result>") (var "TuN" (exp (num (nat 8)))))
(var "<implicit-prod-result>")
)
)
(gram
"Tu32"
(var "u32")
(prod
(exp "<implicit-prod-result>" (var "uN" (exp (num (nat 32)))))
(attr (var "<implicit-prod-result>") (var "TuN" (exp (num (nat 32)))))
(var "<implicit-prod-result>")
)
)
(gram
"Tu64"
(var "u64")
(prod
(exp "<implicit-prod-result>" (var "uN" (exp (num (nat 64)))))
(attr (var "<implicit-prod-result>") (var "TuN" (exp (num (nat 64)))))
(var "<implicit-prod-result>")
)
)
(gram
"Ti8"
(var "u8")
(prod
(exp "<implicit-prod-result>" (var "iN" (exp (num (nat 8)))))
(attr (var "<implicit-prod-result>") (var "TiN" (exp (num (nat 8)))))
(var "<implicit-prod-result>")
)
)
(gram
"Ti16"
(var "u16")
(prod
(exp "<implicit-prod-result>" (var "iN" (exp (num (nat 16)))))
(attr (var "<implicit-prod-result>") (var "TiN" (exp (num (nat 16)))))
(var "<implicit-prod-result>")
)
)
(gram
"Ti32"
(var "u32")
(prod
(exp "<implicit-prod-result>" (var "iN" (exp (num (nat 32)))))
(attr (var "<implicit-prod-result>") (var "TiN" (exp (num (nat 32)))))
(var "<implicit-prod-result>")
)
)
(gram
"Ti64"
(var "u64")
(prod
(exp "<implicit-prod-result>" (var "iN" (exp (num (nat 64)))))
(attr (var "<implicit-prod-result>") (var "TiN" (exp (num (nat 64)))))
(var "<implicit-prod-result>")
)
)
(gram
"Ti128"
(var "u128")
(prod
(exp "<implicit-prod-result>" (var "iN" (exp (num (nat 128)))))
(attr (var "<implicit-prod-result>") (var "TiN" (exp (num (nat 128)))))
(var "<implicit-prod-result>")
)
)
(gram
"Tf32"
(var "f32")
(prod
(exp "<implicit-prod-result>" (var "fN" (exp (num (nat 32)))))
(attr (var "<implicit-prod-result>") (var "TfN" (exp (num (nat 32)))))
(var "<implicit-prod-result>")
)
)
(gram
"Tf64"
(var "f64")
(prod
(exp "<implicit-prod-result>" (var "fN" (exp (num (nat 64)))))
(attr (var "<implicit-prod-result>") (var "TfN" (exp (num (nat 64)))))
(var "<implicit-prod-result>")
)
)
(gram
"Tlist"
(typ "el")
(gram "TX" (var "el"))
(iter (var "el") list)
(prod
(exp "el*" (iter (var "el") list))
(iter (attr (var "el") (var "TX")) list (dom "el" (var "el*")))
(iter (var "el") list (dom "el" (var "el*")))
(if
(cmp
lt
nat
(len (iter (var "el") list (dom "el" (var "el*"))))
(bin pow nat (num (nat 2)) (num (nat 32)))
)
)
)
)
(typ
"idctxt"
(inst
(struct
(field
"TYPES"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"TAGS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"GLOBALS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"MEMS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"TABLES"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"FUNCS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"DATAS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"ELEMS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"LOCALS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"LABELS"
(exp "name?*" (iter (iter (var "name") opt) list))
(iter (iter (var "name") opt) list)
)
(field
"FIELDS"
(exp "name?**" (iter (iter (iter (var "name") opt) list) list))
(iter (iter (iter (var "name") opt) list) list)
)
(field
"TYPEDEFS"
(exp "deftype?*" (iter (iter (var "deftype") opt) list))
(iter (iter (var "deftype") opt) list)
)
)
)
)
(typ "I" (inst (alias (var "idctxt"))))
(rec
(def
"concat_idctxt"
(exp "_" (iter (var "idctxt") list))
(var "idctxt")
(clause
(exp (list))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
(clause
(exp "I" (var "I"))
(exp "I'" (var "I"))
(exp (list (var "I") (var "I'")))
(comp (var "I") (call "concat_idctxt" (exp (iter (var "I'") list))))
)
)
)
(rel
"Idctxt_ok"
"|-%:OK"
(var "idctxt")
(rule
""
(exp "I" (var "I"))
(exp "field**" (iter (iter (var "char") list) list))
"|-%:OK"
(var "I")
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "TYPES")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "TAGS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "GLOBALS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "MEMS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "TABLES")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "FUNCS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "DATAS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "ELEMS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "LOCALS")))
)
)
)
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call "concatopt_" (typ (var "name")) (exp (dot (var "I") "LABELS")))
)
)
)
(iter
(if
(call
"disjoint_"
(typ (var "name"))
(exp
(call
"concatopt_"
(typ (var "name"))
(exp
(list
(opt
(case
"%"
(tup
(iter (var "field") list (dom "field" (var "field*")))
)
)
)
)
)
)
)
)
)
list
(dom "field*" (var "field**"))
)
(if
(cmp
eq
bool
(list
(iter
(opt
(case
"%"
(tup (iter (var "field") list (dom "field" (var "field*"))))
)
)
list
(dom "field*" (var "field**"))
)
)
(dot (var "I") "FIELDS")
)
)
)
)
(gram
"Tidx_"
(exp "ids" (iter (iter (var "name") opt) list))
(var "idx")
(prod (exp "x" (var "idx")) (attr (var "x") (var "Tu32")) (var "x"))
(prod
(exp "id" (var "name"))
(exp "x" (var "idx"))
(attr (var "id") (var "Tid"))
(var "x")
(if
(cmp
eq
bool
(idx (var "ids") (proj (uncase (var "x") "%") 0))
(opt (var "id"))
)
)
)
)
(gram
"Ttypeidx_"
(exp "I" (var "I"))
(var "typeidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "TYPES")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Ttagidx_"
(exp "I" (var "I"))
(var "tagidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "TAGS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tglobalidx_"
(exp "I" (var "I"))
(var "globalidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "GLOBALS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tmemidx_"
(exp "I" (var "I"))
(var "memidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "MEMS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Ttableidx_"
(exp "I" (var "I"))
(var "tableidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "TABLES")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tfuncidx_"
(exp "I" (var "I"))
(var "funcidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "FUNCS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tdataidx_"
(exp "I" (var "I"))
(var "dataidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "DATAS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Telemidx_"
(exp "I" (var "I"))
(var "elemidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "ELEMS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tlocalidx_"
(exp "I" (var "I"))
(var "localidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "LOCALS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tlabelidx_"
(exp "I" (var "I"))
(var "labelidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var "Tidx_" (exp (dot (var "I") "LABELS")))
)
(var "<implicit-prod-result>")
)
)
(gram
"Tfieldidx__"
(exp "I" (var "I"))
(exp "x" (var "idx"))
(var "fieldidx")
(prod
(exp "<implicit-prod-result>" (var "idx"))
(attr
(var "<implicit-prod-result>")
(var
"Tidx_"
(exp (idx (dot (var "I") "FIELDS") (proj (uncase (var "x") "%") 0)))
)
)
(var "<implicit-prod-result>")
)
)
(gram
"Texternidx_"
(exp "I" (var "I"))
(var "externidx")
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "tag"))
(seq (attr (var "x") (var "Ttagidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "TAG%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "global"))
(seq (attr (var "x") (var "Tglobalidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "GLOBAL%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "memory"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "MEM%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "table"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "TABLE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "func"))
(seq (attr (var "x") (var "Tfuncidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "FUNC%" (tup (var "x")))
)
)
(gram
"Tnumtype"
(var "numtype")
(prod (text "i32") (case "I32" (tup)))
(prod (text "i64") (case "I64" (tup)))
(prod (text "f32") (case "F32" (tup)))
(prod (text "f64") (case "F64" (tup)))
)
(gram "Tvectype" (var "vectype") (prod (text "v128") (case "V128" (tup))))
(gram
"Tabsheaptype"
(var "heaptype")
(prod (text "any") (case "ANY" (tup)))
(prod (text "eq") (case "EQ" (tup)))
(prod (text "i31") (case "I31" (tup)))
(prod (text "struct") (case "STRUCT" (tup)))
(prod (text "array") (case "ARRAY" (tup)))
(prod (text "none") (case "NONE" (tup)))
(prod (text "func") (case "FUNC" (tup)))
(prod (text "nofunc") (case "NOFUNC" (tup)))
(prod (text "exn") (case "EXN" (tup)))
(prod (text "noexn") (case "NOEXN" (tup)))
(prod (text "extern") (case "EXTERN" (tup)))
(prod (text "noextern") (case "NOEXTERN" (tup)))
)
(gram
"Theaptype_"
(exp "I" (var "I"))
(var "heaptype")
(prod
(exp "ht" (var "heaptype"))
(attr (var "ht") (var "Tabsheaptype"))
(var "ht")
)
(prod
(exp "x" (var "idx"))
(attr (var "x") (var "Ttypeidx_" (exp (var "I"))))
(case "_IDX%" (tup (var "x")))
)
)
(gram "Tnull" (var "null") (prod (text "null") (case "NULL" (tup))))
(gram
"Treftype_"
(exp "I" (var "I"))
(var "reftype")
(prod
(exp "null?" (iter (var "null") opt))
(exp "ht" (var "heaptype"))
(seq
(seq (text "("))
(seq (text "ref"))
(seq
(attr
(iter (var "null") opt (dom "null" (var "null?")))
(iter (var "Tnull") opt)
)
)
(seq (attr (var "ht") (var "Theaptype_" (exp (var "I")))))
(seq (text ")"))
)
(case
"REF%%"
(tup (iter (var "null") opt (dom "null" (var "null?"))) (var "ht"))
)
)
)
(gram
"Tvaltype_"
(exp "I" (var "I"))
(var "valtype")
(prod
(exp "nt" (var "numtype"))
(attr (var "nt") (var "Tnumtype"))
(sub (var "numtype") (var "valtype") (var "nt"))
)
(prod
(exp "vt" (var "vectype"))
(attr (var "vt") (var "Tvectype"))
(sub (var "vectype") (var "valtype") (var "vt"))
)
(prod
(exp "rt" (var "reftype"))
(attr (var "rt") (var "Treftype_" (exp (var "I"))))
(sub (var "reftype") (var "valtype") (var "rt"))
)
)
(gram
"Tpacktype"
(var "packtype")
(prod (text "i8") (case "I8" (tup)))
(prod (text "i16") (case "I16" (tup)))
)
(gram
"Tstoragetype_"
(exp "I" (var "I"))
(var "storagetype")
(prod
(exp "t" (var "valtype"))
(attr (var "t") (var "Tvaltype_" (exp (var "I"))))
(sub (var "valtype") (var "storagetype") (var "t"))
)
(prod
(exp "pt" (var "packtype"))
(attr (var "pt") (var "Tpacktype"))
(sub (var "packtype") (var "storagetype") (var "pt"))
)
)
(gram
"Tfieldtype_"
(exp "I" (var "I"))
(var "fieldtype")
(prod
(exp "zt" (var "storagetype"))
(attr (var "zt") (var "Tstoragetype_" (exp (var "I"))))
(case "%%" (tup (opt) (var "zt")))
)
(prod
(exp "zt" (var "storagetype"))
(seq
(seq (text "("))
(seq (text "mut"))
(seq (attr (var "zt") (var "Tstoragetype_" (exp (var "I")))))
(seq (text ")"))
)
(case "%%" (tup (opt (case "MUT" (tup))) (var "zt")))
)
)
(gram
"Tfield_"
(exp "I" (var "I"))
(tup
(bind (var "_") (var "fieldtype"))
(bind (var "_") (iter (var "name") opt))
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "ft" (var "fieldtype"))
(seq
(seq (text "("))
(seq (text "field"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "ft") (var "Tfieldtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(var "ft")
(opt (case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?")))))))
)
)
)
(gram
"Tparam_"
(exp "I" (var "I"))
(tup
(bind (var "_") (var "valtype"))
(bind (var "_") (iter (var "name") opt))
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "t" (var "valtype"))
(seq
(seq (text "("))
(seq (text "param"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "t") (var "Tvaltype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(var "t")
(opt (case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?")))))))
)
)
)
(gram
"Tresult_"
(exp "I" (var "I"))
(var "valtype")
(prod
(exp "t" (var "valtype"))
(seq
(seq (text "("))
(seq (text "result"))
(seq (attr (var "t") (var "Tvaltype_" (exp (var "I")))))
(seq (text ")"))
)
(var "t")
)
)
(gram
"Tcomptype_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "comptype")) (bind (var "_") (var "idctxt")))
(prod
(exp "ft*" (iter (var "fieldtype") list))
(exp "id?*" (iter (iter (var "char") opt) list))
(seq
(seq (text "("))
(seq (text "struct"))
(seq
(attr
(iter
(tup
(var "ft")
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
list
(dom "ft" (var "ft*"))
(dom "id?" (var "id?*"))
)
(var
"Tlist"
(typ
(tup
(bind (var "_") (var "fieldtype"))
(bind (var "_") (iter (var "name") opt))
)
)
(gram (var "Tfield_" (exp (var "I"))))
)
)
)
(seq (text ")"))
)
(tup
(case
"STRUCT%"
(tup (case "%" (tup (iter (var "ft") list (dom "ft" (var "ft*"))))))
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field
"FIELDS"
(list
(iter
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
list
(dom "id?" (var "id?*"))
)
)
)
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "ft" (var "fieldtype"))
(seq
(seq (text "("))
(seq (text "array"))
(seq (attr (var "ft") (var "Tfieldtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "ARRAY%" (tup (var "ft")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "t_1*" (iter (var "valtype") list))
(exp "id?*" (iter (iter (var "char") opt) list))
(exp "t_2*" (iter (var "valtype") list))
(seq
(seq (text "("))
(seq (text "func"))
(seq
(attr
(iter
(tup
(var "t_1")
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
list
(dom "id?" (var "id?*"))
(dom "t_1" (var "t_1*"))
)
(var
"Tlist"
(typ
(tup
(bind (var "_") (var "valtype"))
(bind (var "_") (iter (var "name") opt))
)
)
(gram (var "Tparam_" (exp (var "I"))))
)
)
)
(seq
(attr
(iter (var "t_2") list (dom "t_2" (var "t_2*")))
(var
"Tlist"
(typ (var "valtype"))
(gram (var "Tresult_" (exp (var "I"))))
)
)
)
(seq (text ")"))
)
(tup
(case
"FUNC%->%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram "Tfinal" (var "final") (prod (text "final") (case "FINAL" (tup))))
(gram
"Tsubtype_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "subtype")) (bind (var "_") (var "idctxt")))
(prod
(exp "fin?" (iter (var "final") opt))
(exp "x*" (iter (var "idx") list))
(exp "ct" (var "comptype"))
(exp "I'" (var "I"))
(seq
(seq (text "("))
(seq (text "sub"))
(seq
(attr
(iter (var "fin") opt (dom "fin" (var "fin?")))
(iter (var "Tfinal") opt)
)
)
(seq
(attr
(iter (var "x") list (dom "x" (var "x*")))
(var
"Tlist"
(typ (var "typeidx"))
(gram (var "Ttypeidx_" (exp (var "I"))))
)
)
)
(seq
(attr (tup (var "ct") (var "I'")) (var "Tcomptype_" (exp (var "I"))))
)
(seq (text ")"))
)
(tup
(case
"SUB%%%"
(tup
(iter (var "fin") opt (dom "fin" (var "fin?")))
(iter (case "_IDX%" (tup (var "x"))) list (dom "x" (var "x*")))
(var "ct")
)
)
(var "I'")
)
)
)
(gram
"Ttypedef_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "subtype")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "st" (var "subtype"))
(exp "I'" (var "I"))
(seq
(seq (text "("))
(seq (text "type"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (tup (var "st") (var "I'")) (var "Tsubtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(var "st")
(comp
(var "I'")
(struct
(field
"TYPES"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
)
(gram
"Trectype_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "rectype")) (bind (var "_") (var "idctxt")))
(prod
(exp "st*" (iter (var "subtype") list))
(exp "I'*" (iter (var "I") list))
(seq
(seq (text "("))
(seq (text "rec"))
(seq
(attr
(iter
(tup (var "st") (var "I'"))
list
(dom "I'" (var "I'*"))
(dom "st" (var "st*"))
)
(var
"Tlist"
(typ
(tup
(bind (var "_") (var "subtype"))
(bind (var "_") (var "idctxt"))
)
)
(gram (var "Ttypedef_" (exp (var "I"))))
)
)
)
(seq (text ")"))
)
(tup
(case
"REC%"
(tup (case "%" (tup (iter (var "st") list (dom "st" (var "st*"))))))
)
(call "concat_idctxt" (exp (iter (var "I'") list (dom "I'" (var "I'*")))))
)
)
)
(gram
"Taddrtype"
(var "addrtype")
(prod (text "i32") (case "I32" (tup)))
(prod (text "i64") (case "I64" (tup)))
)
(gram
"Tlimits"
(var "limits")
(prod
(exp "n" (var "n"))
(attr (case "%" (tup (var "n"))) (var "Tu64"))
(case "[%..%]" (tup (case "%" (tup (var "n"))) (opt)))
)
(prod
(exp "n" (var "n"))
(exp "m" (var "m"))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Tu64")))
(seq (attr (case "%" (tup (var "m"))) (var "Tu64")))
)
(case
"[%..%]"
(tup (case "%" (tup (var "n"))) (opt (case "%" (tup (var "m")))))
)
)
)
(gram
"Ttypeuse_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "typeidx")) (bind (var "_") (var "idctxt")))
(prod
(exp "x" (var "idx"))
(exp "I'" (var "I"))
(exp "st*" (iter (var "subtype") list))
(exp "i" (var "n"))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
(seq
(seq (text "("))
(seq (text "type"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (text ")"))
)
(tup (var "x") (var "I'"))
(if
(cmp
eq
bool
(idx (dot (var "I") "TYPEDEFS") (proj (uncase (var "x") "%") 0))
(opt
(case
"_DEF%%"
(tup
(case
"REC%"
(tup
(case "%" (tup (iter (var "st") list (dom "st" (var "st*")))))
)
)
(var "i")
)
)
)
)
)
(if
(cmp
eq
bool
(idx (iter (var "st") list (dom "st" (var "st*"))) (var "i"))
(case
"SUB%%%"
(tup
(opt (case "FINAL" (tup)))
(list)
(case
"FUNC%->%"
(tup
(case
"%"
(tup (iter (var "t_1") list (dom "t_1" (var "t_1*"))))
)
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(var "I'")
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field
"LOCALS"
(iter
(opt (case "%" (tup (list))))
(listn (len (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
)
)
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(prod
(exp "x" (var "idx"))
(exp "t_1*" (iter (var "valtype") list))
(exp "id?*" (iter (iter (var "char") opt) list))
(exp "t_2*" (iter (var "valtype") list))
(exp "I'" (var "I"))
(exp "st*" (iter (var "subtype") list))
(exp "i" (var "n"))
(seq
(seq (text "("))
(seq (text "type"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (text ")"))
(seq
(attr
(iter
(tup
(var "t_1")
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
list
(dom "id?" (var "id?*"))
(dom "t_1" (var "t_1*"))
)
(iter (var "Tparam_" (exp (var "I"))) list)
)
)
(seq
(attr
(iter (var "t_2") list (dom "t_2" (var "t_2*")))
(iter (var "Tresult_" (exp (var "I"))) list)
)
)
)
(tup (var "x") (var "I'"))
(if
(cmp
eq
bool
(idx (dot (var "I") "TYPEDEFS") (proj (uncase (var "x") "%") 0))
(opt
(case
"_DEF%%"
(tup
(case
"REC%"
(tup
(case "%" (tup (iter (var "st") list (dom "st" (var "st*")))))
)
)
(var "i")
)
)
)
)
)
(if
(cmp
eq
bool
(idx (iter (var "st") list (dom "st" (var "st*"))) (var "i"))
(case
"SUB%%%"
(tup
(opt (case "FINAL" (tup)))
(list)
(case
"FUNC%->%"
(tup
(case
"%"
(tup (iter (var "t_1") list (dom "t_1" (var "t_1*"))))
)
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
)
)
)
)
(if
(cmp
eq
bool
(var "I'")
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field
"LOCALS"
(iter
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
list
(dom "id?" (var "id?*"))
)
)
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(rule "Idctxt_ok" "|-%:OK" (var "I'"))
)
)
(gram
"Ttagtype_"
(exp "I" (var "I"))
(var "tagtype")
(prod
(exp "x" (var "idx"))
(exp "I'" (var "I"))
(attr (tup (var "x") (var "I'")) (var "Ttypeuse_" (exp (var "I"))))
(case "_IDX%" (tup (var "x")))
)
)
(gram
"Tglobaltype_"
(exp "I" (var "I"))
(var "globaltype")
(prod
(exp "t" (var "valtype"))
(attr (var "t") (var "Tvaltype_" (exp (var "I"))))
(case "%%" (tup (opt) (var "t")))
)
(prod
(exp "t" (var "valtype"))
(seq
(seq (text "("))
(seq (text "mut"))
(seq (attr (var "t") (var "Tvaltype_" (exp (var "I")))))
(seq (text ")"))
)
(case "%%" (tup (opt (case "MUT" (tup))) (var "t")))
)
)
(gram
"Tmemtype_"
(exp "I" (var "I"))
(var "memtype")
(prod
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(seq
(seq (attr (var "at") (var "Taddrtype")))
(seq (attr (var "lim") (var "Tlimits")))
)
(case "%%PAGE" (tup (var "at") (var "lim")))
)
)
(gram
"Ttabletype_"
(exp "I" (var "I"))
(var "tabletype")
(prod
(exp "at" (var "addrtype"))
(exp "lim" (var "limits"))
(exp "rt" (var "reftype"))
(seq
(seq (attr (var "at") (var "Taddrtype")))
(seq (attr (var "lim") (var "Tlimits")))
(seq (attr (var "rt") (var "Treftype_" (exp (var "I")))))
)
(case "%%%" (tup (var "at") (var "lim") (var "rt")))
)
)
(gram
"Texterntype_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "externtype")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "jt" (var "tagtype"))
(seq
(seq (text "("))
(seq (text "tag"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "jt") (var "Ttagtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "TAG%" (tup (var "jt")))
(struct
(field "TYPES" (list))
(field
"TAGS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "gt" (var "globaltype"))
(seq
(seq (text "("))
(seq (text "global"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "gt") (var "Tglobaltype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "GLOBAL%" (tup (var "gt")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field
"GLOBALS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "mt" (var "memtype"))
(seq
(seq (text "("))
(seq (text "memory"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "mt") (var "Tmemtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "MEM%" (tup (var "mt")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field
"MEMS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "tt" (var "tabletype"))
(seq
(seq (text "("))
(seq (text "table"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "tt") (var "Ttabletype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "TABLE%" (tup (var "tt")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field
"TABLES"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "x" (var "idx"))
(exp "I'" (var "I"))
(seq
(seq (text "("))
(seq (text "func"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (tup (var "x") (var "I'")) (var "Ttypeuse_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "FUNC%" (tup (case "_IDX%" (tup (var "x")))))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field
"FUNCS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Tlabel_"
(exp "I" (var "I"))
(tup (bind (var "_") (iter (var "name") opt)) (bind (var "_") (var "I")))
(prod
eps
(tup
(opt)
(comp
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
(var "I")
)
)
)
(prod
(exp "id" (var "name"))
(attr (var "id") (var "Tid"))
(tup
(opt (var "id"))
(comp
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list (opt (var "id"))))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
(var "I")
)
)
(if (un not bool (mem (opt (var "id")) (dot (var "I") "LABELS"))))
)
(prod
(exp "id" (var "name"))
(exp "x" (var "idx"))
(attr (var "id") (var "Tid"))
(tup
(opt (var "id"))
(comp
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list (opt (var "id"))))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
(upd
(var "I")
(idx (dot root "LABELS") (proj (uncase (var "x") "%") 0))
(opt)
)
)
)
(if
(cmp
eq
bool
(opt (var "id"))
(idx (dot (var "I") "LABELS") (proj (uncase (var "x") "%") 0))
)
)
)
)
(gram
"Tblocktype_"
(exp "I" (var "I"))
(var "blocktype")
(prod
(exp "t?" (iter (var "valtype") opt))
(attr
(iter (var "t") opt (dom "t" (var "t?")))
(iter (var "Tresult_" (exp (var "I"))) opt)
)
(case "_RESULT%" (tup (iter (var "t") opt (dom "t" (var "t?")))))
)
(prod
(exp "x" (var "idx"))
(exp "I'" (var "I"))
(attr (tup (var "x") (var "I'")) (var "Ttypeuse_" (exp (var "I"))))
(case "_IDX%" (tup (var "x")))
(if
(cmp
eq
bool
(var "I'")
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (iter (opt (case "%" (tup (list)))) list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
)
(gram
"Tcatch_"
(exp "I" (var "I"))
(var "catch")
(prod
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(seq
(seq (text "("))
(seq (text "catch"))
(seq (attr (var "x") (var "Ttagidx_" (exp (var "I")))))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "CATCH%%" (tup (var "x") (var "l")))
)
(prod
(exp "x" (var "idx"))
(exp "l" (var "labelidx"))
(seq
(seq (text "("))
(seq (text "catch_ref"))
(seq (attr (var "x") (var "Ttagidx_" (exp (var "I")))))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "CATCH_REF%%" (tup (var "x") (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (text "("))
(seq (text "catch_all"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "CATCH_ALL%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (text "("))
(seq (text "catch_all_ref"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
(seq (text ")"))
)
(case "CATCH_ALL_REF%" (tup (var "l")))
)
)
(gram "Tfoldedinstr_" (exp "I" (var "I")) (iter (var "instr") list))
(gram
"Tlaneidx"
(var "laneidx")
(prod (exp "i" (var "u8")) (attr (var "i") (var "Tu8")) (var "i"))
)
(gram
"Talign_"
(exp "N" (var "N"))
(var "u64")
(prod
(exp "m" (var "m"))
(exp "n" (var "n"))
(seq
(seq (text "align="))
(seq (attr (case "%" (tup (var "m"))) (var "Tu64")))
)
(case "%" (tup (var "m")))
(if (cmp eq bool (var "m") (bin pow nat (num (nat 2)) (var "n"))))
)
(prod eps (case "%" (tup (var "N"))))
)
(gram
"Toffset"
(var "u64")
(prod
(exp "n" (var "n"))
(seq
(seq (text "offset="))
(seq (attr (case "%" (tup (var "n"))) (var "Tu64")))
)
(case "%" (tup (var "n")))
)
(prod eps (case "%" (tup (num (nat 0)))))
)
(gram
"Tmemarg_"
(exp "N" (var "N"))
(var "memarg")
(prod
(exp "n" (var "n"))
(exp "m" (var "m"))
(seq
(seq (attr (case "%" (tup (var "n"))) (var "Toffset")))
(seq (attr (case "%" (tup (var "m"))) (var "Talign_" (exp (var "N")))))
)
(struct
(field "ALIGN" (case "%" (tup (var "n"))))
(field "OFFSET" (case "%" (tup (var "m"))))
)
)
)
(gram
"Tplaininstr_"
(exp "I" (var "I"))
(var "instr")
(prod (text "unreachable") (case "UNREACHABLE" (tup)))
(prod (text "nop") (case "NOP" (tup)))
(prod (text "drop") (case "DROP" (tup)))
(prod
(exp "t*?" (iter (iter (var "valtype") list) opt))
(seq
(seq (text "select"))
(seq
(iter
(attr
(iter (var "t") list (dom "t" (var "t*")))
(iter (var "Tresult_" (exp (var "I"))) list)
)
opt
(dom "t*" (var "t*?"))
)
)
)
(case
"SELECT%"
(tup
(iter
(iter (var "t") list (dom "t" (var "t*")))
opt
(dom "t*" (var "t*?"))
)
)
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (text "br"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
)
(case "BR%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (text "br_if"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
)
(case "BR_IF%" (tup (var "l")))
)
(prod
(exp "l*" (iter (var "labelidx") list))
(exp "l'" (var "labelidx"))
(seq
(seq (text "br_table"))
(seq
(attr
(iter (var "l") list (dom "l" (var "l*")))
(iter (var "Tlabelidx_" (exp (var "I"))) list)
)
)
(seq (attr (var "l'") (var "Tlabelidx_" (exp (var "I")))))
)
(case
"BR_TABLE%%"
(tup (iter (var "l") list (dom "l" (var "l*"))) (var "l'"))
)
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (text "br_on_null"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
)
(case "BR_ON_NULL%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(seq
(seq (text "br_on_non_null"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
)
(case "BR_ON_NON_NULL%" (tup (var "l")))
)
(prod
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
(seq
(seq (text "br_on_cast"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
(seq (attr (var "rt_1") (var "Treftype_" (exp (var "I")))))
(seq (attr (var "rt_2") (var "Treftype_" (exp (var "I")))))
)
(case "BR_ON_CAST%%%" (tup (var "l") (var "rt_1") (var "rt_2")))
)
(prod
(exp "l" (var "labelidx"))
(exp "rt_1" (var "reftype"))
(exp "rt_2" (var "reftype"))
(seq
(seq (text "br_on_cast_fail"))
(seq (attr (var "l") (var "Tlabelidx_" (exp (var "I")))))
(seq (attr (var "rt_1") (var "Treftype_" (exp (var "I")))))
(seq (attr (var "rt_2") (var "Treftype_" (exp (var "I")))))
)
(case "BR_ON_CAST_FAIL%%%" (tup (var "l") (var "rt_1") (var "rt_2")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "call"))
(seq (attr (var "x") (var "Tfuncidx_" (exp (var "I")))))
)
(case "CALL%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "call_ref"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "CALL_REF%" (tup (case "_IDX%" (tup (var "x")))))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "I'" (var "I"))
(seq
(seq (text "call_indirect"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
(seq (attr (tup (var "y") (var "I'")) (var "Ttypeuse_" (exp (var "I")))))
)
(case "CALL_INDIRECT%%" (tup (var "x") (case "_IDX%" (tup (var "y")))))
(if
(cmp
eq
bool
(var "I'")
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (iter (opt (case "%" (tup (list)))) list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(prod (text "return") (case "RETURN" (tup)))
(prod
(exp "x" (var "idx"))
(seq
(seq (text "return_call"))
(seq (attr (var "x") (var "Tfuncidx_" (exp (var "I")))))
)
(case "RETURN_CALL%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "return_call_ref"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "RETURN_CALL_REF%" (tup (case "_IDX%" (tup (var "x")))))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(exp "I'" (var "I"))
(seq
(seq (text "return_call_indirect"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
(seq (attr (tup (var "y") (var "I'")) (var "Ttypeuse_" (exp (var "I")))))
)
(case
"RETURN_CALL_INDIRECT%%"
(tup (var "x") (case "_IDX%" (tup (var "y"))))
)
(if
(cmp
eq
bool
(var "I'")
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (iter (opt (case "%" (tup (list)))) list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "throw"))
(seq (attr (var "x") (var "Ttagidx_" (exp (var "I")))))
)
(case "THROW%" (tup (var "x")))
)
(prod (text "throw_ref") (case "THROW_REF" (tup)))
(prod
(exp "x" (var "idx"))
(seq
(seq (text "local.get"))
(seq (attr (var "x") (var "Tlocalidx_" (exp (var "I")))))
)
(case "LOCAL.GET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "local.set"))
(seq (attr (var "x") (var "Tlocalidx_" (exp (var "I")))))
)
(case "LOCAL.SET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "local.tee"))
(seq (attr (var "x") (var "Tlocalidx_" (exp (var "I")))))
)
(case "LOCAL.TEE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "global.get"))
(seq (attr (var "x") (var "Tglobalidx_" (exp (var "I")))))
)
(case "GLOBAL.GET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "global.set"))
(seq (attr (var "x") (var "Tglobalidx_" (exp (var "I")))))
)
(case "GLOBAL.SET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "table.get"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
)
(case "TABLE.GET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "table.set"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
)
(case "TABLE.SET%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "table.size"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
)
(case "TABLE.SIZE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "table.grow"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
)
(case "TABLE.GROW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "table.fill"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
)
(case "TABLE.FILL%" (tup (var "x")))
)
(prod
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(seq
(seq (text "table.copy"))
(seq (attr (var "x_1") (var "Ttableidx_" (exp (var "I")))))
(seq (attr (var "x_2") (var "Ttableidx_" (exp (var "I")))))
)
(case "TABLE.COPY%%" (tup (var "x_1") (var "x_2")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (text "table.init"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
(seq (attr (var "y") (var "Telemidx_" (exp (var "I")))))
)
(case "TABLE.INIT%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "elem.drop"))
(seq (attr (var "x") (var "Telemidx_" (exp (var "I")))))
)
(case "ELEM.DROP%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.load"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case "LOAD%%%%" (tup (case "I32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case "LOAD%%%%" (tup (case "I64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "f32.load"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case "LOAD%%%%" (tup (case "F32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "f64.load"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case "LOAD%%%%" (tup (case "F64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.load8_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt (case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "S" (tup)))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.load8_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt (case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "U" (tup)))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.load16_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.load16_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"LOAD%%%%"
(tup
(case "I32" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load8_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt (case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "S" (tup)))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load8_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt (case "%_%" (tup (case "%" (tup (num (nat 8)))) (case "U" (tup)))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load16_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load16_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 16)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load32_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 32)))) (case "S" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.load32_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case
"LOAD%%%%"
(tup
(case "I64" (tup))
(opt
(case "%_%" (tup (case "%" (tup (num (nat 32)))) (case "U" (tup))))
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 16))))))
)
(case "VLOAD%%%%" (tup (case "V128" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load8x8_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (num (nat 8)))) (num (nat 8)) (case "S" (tup)))
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load8x8_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (num (nat 8)))) (num (nat 8)) (case "U" (tup)))
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load16x4_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (num (nat 16)))) (num (nat 4)) (case "S" (tup)))
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load16x4_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (num (nat 16)))) (num (nat 4)) (case "U" (tup)))
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load32x2_s"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (num (nat 32)))) (num (nat 2)) (case "S" (tup)))
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load32x2_u"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt
(case
"SHAPE%X%_%"
(tup (case "%" (tup (num (nat 32)))) (num (nat 2)) (case "U" (tup)))
)
)
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load8_splat"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load16_splat"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 16)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load32_splat"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 32)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load64_splat"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "SPLAT%" (tup (case "%" (tup (num (nat 64)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load32_zero"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (num (nat 32)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.load64_zero"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case
"VLOAD%%%%"
(tup
(case "V128" (tup))
(opt (case "ZERO%" (tup (case "%" (tup (num (nat 64)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.load8_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 8))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.load16_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 16))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.load32_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 32))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.load64_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VLOAD_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 64))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.store"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case "STORE%%%%" (tup (case "I32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.store"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case "STORE%%%%" (tup (case "I64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "f32.store"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case "STORE%%%%" (tup (case "F32" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "f64.store"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
)
(case "STORE%%%%" (tup (case "F64" (tup)) (opt) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.store8"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i32.store16"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"STORE%%%%"
(tup
(case "I32" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 16)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.store8"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
)
(case
"STORE%%%%"
(tup
(case "I64" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 8)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.store16"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
)
(case
"STORE%%%%"
(tup
(case "I64" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 16)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "i64.store32"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
)
(case
"STORE%%%%"
(tup
(case "I64" (tup))
(opt (case "%" (tup (case "%" (tup (num (nat 32)))))))
(var "x")
(var "ao")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(seq
(seq (text "v128.store"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 16))))))
)
(case "VSTORE%%%" (tup (case "V128" (tup)) (var "x") (var "ao")))
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.store8_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 1))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 8))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.store16_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 2))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 16))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.store32_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 4))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 32))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(exp "ao" (var "memarg"))
(exp "i" (var "laneidx"))
(seq
(seq (text "v128.store64_lane"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "ao") (var "Tmemarg_" (exp (num (nat 8))))))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VSTORE_LANE%%%%%"
(tup
(case "V128" (tup))
(case "%" (tup (num (nat 64))))
(var "x")
(var "ao")
(var "i")
)
)
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "memory.size"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
)
(case "MEMORY.SIZE%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "memory.grow"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
)
(case "MEMORY.GROW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "memory.fill"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
)
(case "MEMORY.FILL%" (tup (var "x")))
)
(prod
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(seq
(seq (text "memory.copy"))
(seq (attr (var "x_1") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "x_2") (var "Tmemidx_" (exp (var "I")))))
)
(case "MEMORY.COPY%%" (tup (var "x_1") (var "x_2")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (text "memory.init"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (attr (var "y") (var "Tdataidx_" (exp (var "I")))))
)
(case "MEMORY.INIT%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "data.drop"))
(seq (attr (var "x") (var "Tdataidx_" (exp (var "I")))))
)
(case "DATA.DROP%" (tup (var "x")))
)
(prod
(exp "ht" (var "heaptype"))
(seq
(seq (text "ref.null"))
(seq (attr (var "ht") (var "Theaptype_" (exp (var "I")))))
)
(case "REF.NULL%" (tup (var "ht")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "ref.func"))
(seq (attr (var "x") (var "Tfuncidx_" (exp (var "I")))))
)
(case "REF.FUNC%" (tup (var "x")))
)
(prod (text "ref.is_null") (case "REF.IS_NULL" (tup)))
(prod (text "ref.as_non_null") (case "REF.AS_NON_NULL" (tup)))
(prod (text "ref.eq") (case "REF.EQ" (tup)))
(prod
(exp "rt" (var "reftype"))
(seq
(seq (text "ref.test"))
(seq (attr (var "rt") (var "Treftype_" (exp (var "I")))))
)
(case "REF.TEST%" (tup (var "rt")))
)
(prod
(exp "rt" (var "reftype"))
(seq
(seq (text "ref.cast"))
(seq (attr (var "rt") (var "Treftype_" (exp (var "I")))))
)
(case "REF.CAST%" (tup (var "rt")))
)
(prod (text "ref.i31") (case "REF.I31" (tup)))
(prod (text "i31.get_s") (case "I31.GET%" (tup (case "S" (tup)))))
(prod (text "i31.get_u") (case "I31.GET%" (tup (case "U" (tup)))))
(prod
(exp "x" (var "idx"))
(seq
(seq (text "struct.new"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "STRUCT.NEW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "struct.new_default"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "STRUCT.NEW_DEFAULT%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "fieldidx"))
(seq
(seq (text "struct.get"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "i") (var "Tfieldidx__" (exp (var "I")) (exp (var "x")))))
)
(case "STRUCT.GET%%%" (tup (opt) (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "fieldidx"))
(seq
(seq (text "struct.get_s"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "i") (var "Tfieldidx__" (exp (var "I")) (exp (var "x")))))
)
(case "STRUCT.GET%%%" (tup (opt (case "S" (tup))) (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "fieldidx"))
(seq
(seq (text "struct.get_u"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "i") (var "Tfieldidx__" (exp (var "I")) (exp (var "x")))))
)
(case "STRUCT.GET%%%" (tup (opt (case "U" (tup))) (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(exp "i" (var "fieldidx"))
(seq
(seq (text "struct.set"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "i") (var "Tfieldidx__" (exp (var "I")) (exp (var "x")))))
)
(case "STRUCT.SET%%" (tup (var "x") (var "i")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.new"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.NEW%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.new_default"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.NEW_DEFAULT%" (tup (var "x")))
)
(prod
(exp "x" (var "idx"))
(exp "n" (var "n"))
(seq
(seq (text "array.new_fixed"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (case "%" (tup (var "n"))) (var "Tu32")))
)
(case "ARRAY.NEW_FIXED%%" (tup (var "x") (case "%" (tup (var "n")))))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (text "array.new_data"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "y") (var "Tdataidx_" (exp (var "I")))))
)
(case "ARRAY.NEW_DATA%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (text "array.new_elem"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "y") (var "Telemidx_" (exp (var "I")))))
)
(case "ARRAY.NEW_ELEM%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.get"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.GET%%" (tup (opt) (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.get_s"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.GET%%" (tup (opt (case "S" (tup))) (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.get_u"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.GET%%" (tup (opt (case "U" (tup))) (var "x")))
)
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.set"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.SET%" (tup (var "x")))
)
(prod (text "array.len") (case "ARRAY.LEN" (tup)))
(prod
(exp "x" (var "idx"))
(seq
(seq (text "array.fill"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.FILL%" (tup (var "x")))
)
(prod
(exp "x_1" (var "idx"))
(exp "x_2" (var "idx"))
(seq
(seq (text "array.copy"))
(seq (attr (var "x_1") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "x_2") (var "Ttypeidx_" (exp (var "I")))))
)
(case "ARRAY.COPY%%" (tup (var "x_1") (var "x_2")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (text "array.init_data"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "y") (var "Tdataidx_" (exp (var "I")))))
)
(case "ARRAY.INIT_DATA%%" (tup (var "x") (var "y")))
)
(prod
(exp "x" (var "idx"))
(exp "y" (var "idx"))
(seq
(seq (text "array.init_elem"))
(seq (attr (var "x") (var "Ttypeidx_" (exp (var "I")))))
(seq (attr (var "y") (var "Telemidx_" (exp (var "I")))))
)
(case "ARRAY.INIT_ELEM%%" (tup (var "x") (var "y")))
)
(prod (text "any.convert_extern") (case "ANY.CONVERT_EXTERN" (tup)))
(prod (text "extern.convert_any") (case "EXTERN.CONVERT_ANY" (tup)))
(prod
(exp "c" (var "u32"))
(seq (seq (text "i32.const")) (seq (attr (var "c") (var "Ti32"))))
(case "CONST%%" (tup (case "I32" (tup)) (var "c")))
)
(prod
(exp "c" (var "u64"))
(seq (seq (text "i64.const")) (seq (attr (var "c") (var "Ti64"))))
(case "CONST%%" (tup (case "I64" (tup)) (var "c")))
)
(prod
(exp "c" (var "f32"))
(seq (seq (text "f32.const")) (seq (attr (var "c") (var "Tf32"))))
(case "CONST%%" (tup (case "F32" (tup)) (var "c")))
)
(prod
(exp "c" (var "f64"))
(seq (seq (text "f64.const")) (seq (attr (var "c") (var "Tf64"))))
(case "CONST%%" (tup (case "F64" (tup)) (var "c")))
)
(prod
(text "i32.eqz")
(case "TESTOP%%" (tup (case "I32" (tup)) (case "EQZ" (tup))))
)
(prod
(text "i64.eqz")
(case "TESTOP%%" (tup (case "I64" (tup)) (case "EQZ" (tup))))
)
(prod
(text "i32.eq")
(case "RELOP%%" (tup (case "I32" (tup)) (case "EQ" (tup))))
)
(prod
(text "i32.ne")
(case "RELOP%%" (tup (case "I32" (tup)) (case "NE" (tup))))
)
(prod
(text "i32.lt_s")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LT%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.lt_u")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LT%" (tup (case "U" (tup)))))
)
)
(prod
(text "i32.gt_s")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GT%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.gt_u")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GT%" (tup (case "U" (tup)))))
)
)
(prod
(text "i32.le_s")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LE%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.le_u")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "LE%" (tup (case "U" (tup)))))
)
)
(prod
(text "i32.ge_s")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GE%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.ge_u")
(case
"RELOP%%"
(tup (case "I32" (tup)) (case "GE%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.eq")
(case "RELOP%%" (tup (case "I64" (tup)) (case "EQ" (tup))))
)
(prod
(text "i64.ne")
(case "RELOP%%" (tup (case "I64" (tup)) (case "NE" (tup))))
)
(prod
(text "i64.lt_s")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LT%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.lt_u")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LT%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.gt_s")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GT%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.gt_u")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GT%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.le_s")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LE%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.le_u")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "LE%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.ge_s")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GE%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.ge_u")
(case
"RELOP%%"
(tup (case "I64" (tup)) (case "GE%" (tup (case "U" (tup)))))
)
)
(prod
(text "f32.eq")
(case "RELOP%%" (tup (case "F32" (tup)) (case "EQ" (tup))))
)
(prod
(text "f32.ne")
(case "RELOP%%" (tup (case "F32" (tup)) (case "NE" (tup))))
)
(prod
(text "f32.lt")
(case "RELOP%%" (tup (case "F32" (tup)) (case "LT" (tup))))
)
(prod
(text "f32.gt")
(case "RELOP%%" (tup (case "F32" (tup)) (case "GT" (tup))))
)
(prod
(text "f32.le")
(case "RELOP%%" (tup (case "F32" (tup)) (case "LE" (tup))))
)
(prod
(text "f32.ge")
(case "RELOP%%" (tup (case "F32" (tup)) (case "GE" (tup))))
)
(prod
(text "f64.eq")
(case "RELOP%%" (tup (case "F64" (tup)) (case "EQ" (tup))))
)
(prod
(text "f64.ne")
(case "RELOP%%" (tup (case "F64" (tup)) (case "NE" (tup))))
)
(prod
(text "f64.lt")
(case "RELOP%%" (tup (case "F64" (tup)) (case "LT" (tup))))
)
(prod
(text "f64.gt")
(case "RELOP%%" (tup (case "F64" (tup)) (case "GT" (tup))))
)
(prod
(text "f64.le")
(case "RELOP%%" (tup (case "F64" (tup)) (case "LE" (tup))))
)
(prod
(text "f64.ge")
(case "RELOP%%" (tup (case "F64" (tup)) (case "GE" (tup))))
)
(prod
(text "i32.clz")
(case "UNOP%%" (tup (case "I32" (tup)) (case "CLZ" (tup))))
)
(prod
(text "i32.ctz")
(case "UNOP%%" (tup (case "I32" (tup)) (case "CTZ" (tup))))
)
(prod
(text "i32.popcnt")
(case "UNOP%%" (tup (case "I32" (tup)) (case "POPCNT" (tup))))
)
(prod
(text "i32.extend8_s")
(case
"UNOP%%"
(tup
(case "I32" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 8))))))
)
)
)
(prod
(text "i32.extend16_s")
(case
"UNOP%%"
(tup
(case "I32" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 16))))))
)
)
)
(prod
(text "i64.clz")
(case "UNOP%%" (tup (case "I64" (tup)) (case "CLZ" (tup))))
)
(prod
(text "i64.ctz")
(case "UNOP%%" (tup (case "I64" (tup)) (case "CTZ" (tup))))
)
(prod
(text "i64.popcnt")
(case "UNOP%%" (tup (case "I64" (tup)) (case "POPCNT" (tup))))
)
(prod
(text "i64.extend8_s")
(case
"UNOP%%"
(tup
(case "I64" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 8))))))
)
)
)
(prod
(text "i64.extend16_s")
(case
"UNOP%%"
(tup
(case "I64" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 16))))))
)
)
)
(prod
(text "i64.extend32_s")
(case
"UNOP%%"
(tup
(case "I64" (tup))
(case "EXTEND%" (tup (case "%" (tup (num (nat 32))))))
)
)
)
(prod
(text "f32.abs")
(case "UNOP%%" (tup (case "F32" (tup)) (case "ABS" (tup))))
)
(prod
(text "f32.neg")
(case "UNOP%%" (tup (case "F32" (tup)) (case "NEG" (tup))))
)
(prod
(text "f32.sqrt")
(case "UNOP%%" (tup (case "F32" (tup)) (case "SQRT" (tup))))
)
(prod
(text "f32.ceil")
(case "UNOP%%" (tup (case "F32" (tup)) (case "CEIL" (tup))))
)
(prod
(text "f32.floor")
(case "UNOP%%" (tup (case "F32" (tup)) (case "FLOOR" (tup))))
)
(prod
(text "f32.trunc")
(case "UNOP%%" (tup (case "F32" (tup)) (case "TRUNC" (tup))))
)
(prod
(text "f32.nearest")
(case "UNOP%%" (tup (case "F32" (tup)) (case "NEAREST" (tup))))
)
(prod
(text "f64.abs")
(case "UNOP%%" (tup (case "F64" (tup)) (case "ABS" (tup))))
)
(prod
(text "f64.neg")
(case "UNOP%%" (tup (case "F64" (tup)) (case "NEG" (tup))))
)
(prod
(text "f64.sqrt")
(case "UNOP%%" (tup (case "F64" (tup)) (case "SQRT" (tup))))
)
(prod
(text "f64.ceil")
(case "UNOP%%" (tup (case "F64" (tup)) (case "CEIL" (tup))))
)
(prod
(text "f64.floor")
(case "UNOP%%" (tup (case "F64" (tup)) (case "FLOOR" (tup))))
)
(prod
(text "f64.trunc")
(case "UNOP%%" (tup (case "F64" (tup)) (case "TRUNC" (tup))))
)
(prod
(text "f64.nearest")
(case "UNOP%%" (tup (case "F64" (tup)) (case "NEAREST" (tup))))
)
(prod
(text "i32.add")
(case "BINOP%%" (tup (case "I32" (tup)) (case "ADD" (tup))))
)
(prod
(text "i32.sub")
(case "BINOP%%" (tup (case "I32" (tup)) (case "SUB" (tup))))
)
(prod
(text "i32.mul")
(case "BINOP%%" (tup (case "I32" (tup)) (case "MUL" (tup))))
)
(prod
(text "i32.div_s")
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "DIV%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.div_u")
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "DIV%" (tup (case "U" (tup)))))
)
)
(prod
(text "i32.rem_s")
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "REM%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.rem_u")
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "REM%" (tup (case "U" (tup)))))
)
)
(prod
(text "i32.and")
(case "BINOP%%" (tup (case "I32" (tup)) (case "AND" (tup))))
)
(prod
(text "i32.or")
(case "BINOP%%" (tup (case "I32" (tup)) (case "OR" (tup))))
)
(prod
(text "i32.xor")
(case "BINOP%%" (tup (case "I32" (tup)) (case "XOR" (tup))))
)
(prod
(text "i32.shl")
(case "BINOP%%" (tup (case "I32" (tup)) (case "SHL" (tup))))
)
(prod
(text "i32.shr_s")
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "SHR%" (tup (case "S" (tup)))))
)
)
(prod
(text "i32.shr_u")
(case
"BINOP%%"
(tup (case "I32" (tup)) (case "SHR%" (tup (case "U" (tup)))))
)
)
(prod
(text "i32.rotl")
(case "BINOP%%" (tup (case "I32" (tup)) (case "ROTL" (tup))))
)
(prod
(text "i32.rotr")
(case "BINOP%%" (tup (case "I32" (tup)) (case "ROTR" (tup))))
)
(prod
(text "i64.add")
(case "BINOP%%" (tup (case "I64" (tup)) (case "ADD" (tup))))
)
(prod
(text "i64.sub")
(case "BINOP%%" (tup (case "I64" (tup)) (case "SUB" (tup))))
)
(prod
(text "i64.mul")
(case "BINOP%%" (tup (case "I64" (tup)) (case "MUL" (tup))))
)
(prod
(text "i64.div_s")
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "DIV%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.div_u")
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "DIV%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.rem_s")
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "REM%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.rem_u")
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "REM%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.and")
(case "BINOP%%" (tup (case "I64" (tup)) (case "AND" (tup))))
)
(prod
(text "i64.or")
(case "BINOP%%" (tup (case "I64" (tup)) (case "OR" (tup))))
)
(prod
(text "i64.xor")
(case "BINOP%%" (tup (case "I64" (tup)) (case "XOR" (tup))))
)
(prod
(text "i64.shl")
(case "BINOP%%" (tup (case "I64" (tup)) (case "SHL" (tup))))
)
(prod
(text "i64.shr_s")
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "SHR%" (tup (case "S" (tup)))))
)
)
(prod
(text "i64.shr_u")
(case
"BINOP%%"
(tup (case "I64" (tup)) (case "SHR%" (tup (case "U" (tup)))))
)
)
(prod
(text "i64.rotl")
(case "BINOP%%" (tup (case "I64" (tup)) (case "ROTL" (tup))))
)
(prod
(text "i64.rotr")
(case "BINOP%%" (tup (case "I64" (tup)) (case "ROTR" (tup))))
)
(prod
(text "f32.add")
(case "BINOP%%" (tup (case "F32" (tup)) (case "ADD" (tup))))
)
(prod
(text "f32.sub")
(case "BINOP%%" (tup (case "F32" (tup)) (case "SUB" (tup))))
)
(prod
(text "f32.mul")
(case "BINOP%%" (tup (case "F32" (tup)) (case "MUL" (tup))))
)
(prod
(text "f32.div")
(case "BINOP%%" (tup (case "F32" (tup)) (case "DIV" (tup))))
)
(prod
(text "f32.min")
(case "BINOP%%" (tup (case "F32" (tup)) (case "MIN" (tup))))
)
(prod
(text "f32.max")
(case "BINOP%%" (tup (case "F32" (tup)) (case "MAX" (tup))))
)
(prod
(text "f32.copysign")
(case "BINOP%%" (tup (case "F32" (tup)) (case "COPYSIGN" (tup))))
)
(prod
(text "f64.add")
(case "BINOP%%" (tup (case "F64" (tup)) (case "ADD" (tup))))
)
(prod
(text "f64.sub")
(case "BINOP%%" (tup (case "F64" (tup)) (case "SUB" (tup))))
)
(prod
(text "f64.mul")
(case "BINOP%%" (tup (case "F64" (tup)) (case "MUL" (tup))))
)
(prod
(text "f64.div")
(case "BINOP%%" (tup (case "F64" (tup)) (case "DIV" (tup))))
)
(prod
(text "f64.min")
(case "BINOP%%" (tup (case "F64" (tup)) (case "MIN" (tup))))
)
(prod
(text "f64.max")
(case "BINOP%%" (tup (case "F64" (tup)) (case "MAX" (tup))))
)
(prod
(text "f64.copysign")
(case "BINOP%%" (tup (case "F64" (tup)) (case "COPYSIGN" (tup))))
)
(prod
(text "i32.wrap_i64")
(case
"CVTOP%%%"
(tup (case "I32" (tup)) (case "I64" (tup)) (case "WRAP" (tup)))
)
)
(prod
(text "i32.trunc_f32_s")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32.trunc_f32_u")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32.trunc_f64_s")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32.trunc_f64_u")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32.trunc_sat_f32_s")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32.trunc_sat_f32_u")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32.trunc_sat_f64_s")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32.trunc_sat_f64_u")
(case
"CVTOP%%%"
(tup
(case "I32" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64.extend_i64_s")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "I64" (tup))
(case "EXTEND%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64.extend_i64_u")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "I64" (tup))
(case "EXTEND%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64.trunc_f32_s")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64.trunc_f32_u")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64.trunc_f64_s")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64.trunc_f64_u")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64.trunc_sat_f32_s")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64.trunc_sat_f32_u")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F32" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64.trunc_sat_f64_s")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64.trunc_sat_f64_u")
(case
"CVTOP%%%"
(tup
(case "I64" (tup))
(case "F64" (tup))
(case "TRUNC_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "f32.demote_f64")
(case
"CVTOP%%%"
(tup (case "F32" (tup)) (case "F64" (tup)) (case "DEMOTE" (tup)))
)
)
(prod
(text "f32.convert_i32_s")
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "f32.convert_i32_u")
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "f32.convert_i64_s")
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "f32.convert_i64_u")
(case
"CVTOP%%%"
(tup
(case "F32" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "f64.promote_f32")
(case
"CVTOP%%%"
(tup (case "F64" (tup)) (case "F32" (tup)) (case "PROMOTE" (tup)))
)
)
(prod
(text "f64.convert_i32_s")
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "f64.convert_i32_u")
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I32" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "f64.convert_i64_s")
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "f64.convert_i64_u")
(case
"CVTOP%%%"
(tup
(case "F64" (tup))
(case "I64" (tup))
(case "CONVERT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32.reinterpret_f32")
(case
"CVTOP%%%"
(tup (case "I32" (tup)) (case "F32" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(text "i64.reinterpret_f64")
(case
"CVTOP%%%"
(tup (case "I64" (tup)) (case "F64" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(text "f32.reinterpret_i32")
(case
"CVTOP%%%"
(tup (case "F32" (tup)) (case "I32" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(text "f64.reinterpret_i64")
(case
"CVTOP%%%"
(tup (case "F64" (tup)) (case "I64" (tup)) (case "REINTERPRET" (tup)))
)
)
(prod
(exp "c*" (iter (var "u8") list))
(seq
(seq (text "v128.const"))
(seq (text "i8x16"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Ti8") (listn (num (nat 16))))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "ibytes_" (exp (num (nat 8))) (exp (var "c")))
list
(dom "c" (var "c*"))
)
)
)
)
)
)
)
)
(prod
(exp "c*" (iter (var "u16") list))
(seq
(seq (text "v128.const"))
(seq (text "i16x8"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Ti16") (listn (num (nat 8))))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "ibytes_" (exp (num (nat 16))) (exp (var "c")))
list
(dom "c" (var "c*"))
)
)
)
)
)
)
)
)
(prod
(exp "c*" (iter (var "u32") list))
(seq
(seq (text "v128.const"))
(seq (text "i32x4"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Ti32") (listn (num (nat 4))))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "ibytes_" (exp (num (nat 32))) (exp (var "c")))
list
(dom "c" (var "c*"))
)
)
)
)
)
)
)
)
(prod
(exp "c*" (iter (var "u64") list))
(seq
(seq (text "v128.const"))
(seq (text "i64x2"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Ti64") (listn (num (nat 2))))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "ibytes_" (exp (num (nat 64))) (exp (var "c")))
list
(dom "c" (var "c*"))
)
)
)
)
)
)
)
)
(prod
(exp "c*" (iter (var "f32") list))
(seq
(seq (text "v128.const"))
(seq (text "f32x4"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Tf32") (listn (num (nat 4))))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "fbytes_" (exp (num (nat 32))) (exp (var "c")))
list
(dom "c" (var "c*"))
)
)
)
)
)
)
)
)
(prod
(exp "c*" (iter (var "f64") list))
(seq
(seq (text "v128.const"))
(seq (text "f64x2"))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Tf64") (listn (num (nat 2))))
)
)
)
(case
"VCONST%%"
(tup
(case "V128" (tup))
(call
"inv_ibytes_"
(exp (num (nat 128)))
(exp
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(call "fbytes_" (exp (num (nat 64))) (exp (var "c")))
list
(dom "c" (var "c*"))
)
)
)
)
)
)
)
)
(prod
(exp "i*" (iter (var "laneidx") list))
(seq
(seq (text "i8x16.shuffle"))
(seq
(attr
(iter (var "i") list (dom "i" (var "i*")))
(iter (var "Tlaneidx") (listn (num (nat 16))))
)
)
)
(case
"VSHUFFLE%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(iter (var "i") list (dom "i" (var "i*")))
)
)
)
(prod
(text "i8x16.swizzle")
(case
"VSWIZZLOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "SWIZZLE" (tup))
)
)
)
(prod
(text "i8x16.relaxed_swizzle")
(case
"VSWIZZLOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "RELAXED_SWIZZLE" (tup))
)
)
)
(prod
(text "i8x16.splat")
(case
"VSPLAT%"
(tup (case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16)))))))
)
)
(prod
(text "i16x8.splat")
(case
"VSPLAT%"
(tup (case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8)))))))
)
)
(prod
(text "i32x4.splat")
(case
"VSPLAT%"
(tup (case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4)))))))
)
)
(prod
(text "i64x2.splat")
(case
"VSPLAT%"
(tup (case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2)))))))
)
)
(prod
(text "f32x4.splat")
(case
"VSPLAT%"
(tup (case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4)))))))
)
)
(prod
(text "f64x2.splat")
(case
"VSPLAT%"
(tup (case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2)))))))
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i8x16.extract_lane_s"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(opt (case "S" (tup)))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i8x16.extract_lane_u"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(opt (case "U" (tup)))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i16x8.extract_lane_s"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(opt (case "S" (tup)))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i16x8.extract_lane_u"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(opt (case "U" (tup)))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i32x4.extract_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(opt)
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i64x2.extract_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(opt)
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "f32x4.extract_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(opt)
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "f64x2.extract_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VEXTRACT_LANE%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(opt)
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i8x16.replace_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i16x8.replace_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i32x4.replace_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "i64x2.replace_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "f32x4.replace_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(var "i")
)
)
)
(prod
(exp "i" (var "laneidx"))
(seq
(seq (text "f64x2.replace_lane"))
(seq (attr (var "i") (var "Tlaneidx")))
)
(case
"VREPLACE_LANE%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(var "i")
)
)
)
(prod
(text "v128.any_true")
(case "VVTESTOP%%" (tup (case "V128" (tup)) (case "ANY_TRUE" (tup))))
)
(prod
(text "i8x16.all_true")
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(text "i16x8.all_true")
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(text "i32x4.all_true")
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(text "i64x2.all_true")
(case
"VTESTOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ALL_TRUE" (tup))
)
)
)
(prod
(text "i8x16.eq")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EQ" (tup))
)
)
)
(prod
(text "i8x16.ne")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "NE" (tup))
)
)
)
(prod
(text "i8x16.lt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.lt_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.gt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.gt_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.le_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.le_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "LE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.ge_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.ge_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "GE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.eq")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EQ" (tup))
)
)
)
(prod
(text "i16x8.ne")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "NE" (tup))
)
)
)
(prod
(text "i16x8.lt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.lt_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.gt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.gt_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.le_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.le_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "LE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.ge_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.ge_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "GE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.eq")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EQ" (tup))
)
)
)
(prod
(text "i32x4.ne")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NE" (tup))
)
)
)
(prod
(text "i32x4.lt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.lt_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.gt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.gt_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.le_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.le_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.ge_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.ge_u")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64x2.eq")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "EQ" (tup))
)
)
)
(prod
(text "i64x2.ne")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NE" (tup))
)
)
)
(prod
(text "i64x2.lt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64x2.gt_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64x2.le_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64x2.ge_s")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "f32x4.eq")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EQ" (tup))
)
)
)
(prod
(text "f32x4.ne")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NE" (tup))
)
)
)
(prod
(text "f32x4.lt")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LT" (tup))
)
)
)
(prod
(text "f32x4.gt")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GT" (tup))
)
)
)
(prod
(text "f32x4.le")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "LE" (tup))
)
)
)
(prod
(text "f32x4.ge")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "GE" (tup))
)
)
)
(prod
(text "f64x2.eq")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "EQ" (tup))
)
)
)
(prod
(text "f64x2.ne")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NE" (tup))
)
)
)
(prod
(text "f64x2.lt")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LT" (tup))
)
)
)
(prod
(text "f64x2.gt")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GT" (tup))
)
)
)
(prod
(text "f64x2.le")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "LE" (tup))
)
)
)
(prod
(text "f64x2.ge")
(case
"VRELOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "GE" (tup))
)
)
)
(prod
(text "v128.not")
(case "VVUNOP%%" (tup (case "V128" (tup)) (case "NOT" (tup))))
)
(prod
(text "i8x16.abs")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ABS" (tup))
)
)
)
(prod
(text "i8x16.neg")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "NEG" (tup))
)
)
)
(prod
(text "i8x16.popcnt")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "POPCNT" (tup))
)
)
)
(prod
(text "i16x8.abs")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ABS" (tup))
)
)
)
(prod
(text "i16x8.neg")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "NEG" (tup))
)
)
)
(prod
(text "i32x4.abs")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ABS" (tup))
)
)
)
(prod
(text "i32x4.neg")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NEG" (tup))
)
)
)
(prod
(text "i64x2.abs")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ABS" (tup))
)
)
)
(prod
(text "i64x2.neg")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NEG" (tup))
)
)
)
(prod
(text "f32x4.abs")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ABS" (tup))
)
)
)
(prod
(text "f32x4.neg")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NEG" (tup))
)
)
)
(prod
(text "f32x4.sqrt")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "SQRT" (tup))
)
)
)
(prod
(text "f32x4.ceil")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CEIL" (tup))
)
)
)
(prod
(text "f32x4.floor")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "FLOOR" (tup))
)
)
)
(prod
(text "f32x4.trunc")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "TRUNC" (tup))
)
)
)
(prod
(text "f32x4.nearest")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "NEAREST" (tup))
)
)
)
(prod
(text "f64x2.abs")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ABS" (tup))
)
)
)
(prod
(text "f64x2.neg")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NEG" (tup))
)
)
)
(prod
(text "f64x2.sqrt")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "SQRT" (tup))
)
)
)
(prod
(text "f64x2.ceil")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "CEIL" (tup))
)
)
)
(prod
(text "f64x2.floor")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "FLOOR" (tup))
)
)
)
(prod
(text "f64x2.trunc")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "TRUNC" (tup))
)
)
)
(prod
(text "f64x2.nearest")
(case
"VUNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "NEAREST" (tup))
)
)
)
(prod
(text "v128.and")
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "AND" (tup))))
)
(prod
(text "v128.andnot")
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "ANDNOT" (tup))))
)
(prod
(text "v128.or")
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "OR" (tup))))
)
(prod
(text "v128.xor")
(case "VVBINOP%%" (tup (case "V128" (tup)) (case "XOR" (tup))))
)
(prod
(text "i8x16.add")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ADD" (tup))
)
)
)
(prod
(text "i8x16.add_sat_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ADD_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.add_sat_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "ADD_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.sub")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "SUB" (tup))
)
)
)
(prod
(text "i8x16.sub_sat_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "SUB_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.sub_sat_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "SUB_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.min_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MIN%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.min_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MIN%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.max_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MAX%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.max_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "MAX%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.avgr_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "AVGRU" (tup))
)
)
)
(prod
(text "i16x8.add")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ADD" (tup))
)
)
)
(prod
(text "i16x8.add_sat_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ADD_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.add_sat_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "ADD_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.sub")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "SUB" (tup))
)
)
)
(prod
(text "i16x8.sub_sat_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "SUB_SAT%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.sub_sat_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "SUB_SAT%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.mul")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MUL" (tup))
)
)
)
(prod
(text "i16x8.min_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MIN%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.min_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MIN%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.max_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MAX%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.max_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "MAX%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.avgr_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "AVGRU" (tup))
)
)
)
(prod
(text "i16x8.q15mulr_sat_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "Q15MULR_SATS" (tup))
)
)
)
(prod
(text "i16x8.relaxed_q15mulr_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "RELAXED_Q15MULRS" (tup))
)
)
)
(prod
(text "i32x4.add")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ADD" (tup))
)
)
)
(prod
(text "i32x4.sub")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "SUB" (tup))
)
)
)
(prod
(text "i32x4.mul")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MUL" (tup))
)
)
)
(prod
(text "i32x4.min_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MIN%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.min_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MIN%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.max_s")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MAX%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.max_u")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MAX%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64x2.add")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ADD" (tup))
)
)
)
(prod
(text "i64x2.sub")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "SUB" (tup))
)
)
)
(prod
(text "i64x2.mul")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MUL" (tup))
)
)
)
(prod
(text "f32x4.add")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "ADD" (tup))
)
)
)
(prod
(text "f32x4.sub")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "SUB" (tup))
)
)
)
(prod
(text "f32x4.mul")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MUL" (tup))
)
)
)
(prod
(text "f32x4.div")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "DIV" (tup))
)
)
)
(prod
(text "f32x4.min")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MIN" (tup))
)
)
)
(prod
(text "f32x4.max")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "MAX" (tup))
)
)
)
(prod
(text "f32x4.pmin")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "PMIN" (tup))
)
)
)
(prod
(text "f32x4.pmax")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "PMAX" (tup))
)
)
)
(prod
(text "f32x4.relaxed_min")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_MIN" (tup))
)
)
)
(prod
(text "f32x4.relaxed_max")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_MAX" (tup))
)
)
)
(prod
(text "f64x2.add")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "ADD" (tup))
)
)
)
(prod
(text "f64x2.sub")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "SUB" (tup))
)
)
)
(prod
(text "f64x2.mul")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MUL" (tup))
)
)
)
(prod
(text "f64x2.div")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "DIV" (tup))
)
)
)
(prod
(text "f64x2.min")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MIN" (tup))
)
)
)
(prod
(text "f64x2.max")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "MAX" (tup))
)
)
)
(prod
(text "f64x2.pmin")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "PMIN" (tup))
)
)
)
(prod
(text "f64x2.pmax")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "PMAX" (tup))
)
)
)
(prod
(text "f64x2.relaxed_min")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_MIN" (tup))
)
)
)
(prod
(text "f64x2.relaxed_max")
(case
"VBINOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_MAX" (tup))
)
)
)
(prod
(text "v128.bitselect")
(case "VVTERNOP%%" (tup (case "V128" (tup)) (case "BITSELECT" (tup))))
)
(prod
(text "i8x16.relaxed_laneselect")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(text "i16x8.relaxed_laneselect")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(text "i32x4.relaxed_laneselect")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(text "i64x2.relaxed_laneselect")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_LANESELECT" (tup))
)
)
)
(prod
(text "f32x4.relaxed_madd")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_MADD" (tup))
)
)
)
(prod
(text "f32x4.relaxed_nmadd")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_NMADD" (tup))
)
)
)
(prod
(text "f64x2.relaxed_madd")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_MADD" (tup))
)
)
)
(prod
(text "f64x2.relaxed_nmadd")
(case
"VTERNOP%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "RELAXED_NMADD" (tup))
)
)
)
(prod
(text "i8x16.shl")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "SHL" (tup))
)
)
)
(prod
(text "i8x16.shr_s")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i8x16.shr_u")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.shl")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "SHL" (tup))
)
)
)
(prod
(text "i16x8.shr_s")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.shr_u")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.shl")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "SHL" (tup))
)
)
)
(prod
(text "i32x4.shr_s")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.shr_u")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i64x2.shl")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case "SHL" (tup))
)
)
)
(prod
(text "i64x2.shr_s")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case "SHR%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i64x2.shr_u")
(case
"VSHIFTOP%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case "SHR%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i8x16.bitmask")
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
)
)
)
(prod
(text "i16x8.bitmask")
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
)
)
)
(prod
(text "i32x4.bitmask")
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
)
)
)
(prod
(text "i64x2.bitmask")
(case
"VBITMASK%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
)
)
)
(prod
(text "i8x16.narrow_i16x8_s")
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "S" (tup))
)
)
)
(prod
(text "i8x16.narrow_i16x8_u")
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "U" (tup))
)
)
)
(prod
(text "i16x8.narrow_i32x4_s")
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "S" (tup))
)
)
)
(prod
(text "i16x8.narrow_i32x4_u")
(case
"VNARROW%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "U" (tup))
)
)
)
(prod
(text "i16x8.extend_low_i8x16_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i16x8.extend_low_i8x16_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i16x8.extend_high_i8x16_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i16x8.extend_high_i8x16_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i32x4.extend_low_i16x8_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i32x4.extend_low_i16x8_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i32x4.extend_high_i16x8_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i32x4.extend_high_i16x8_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i32x4.trunc_sat_f32x4_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "TRUNC_SAT%%" (tup (case "S" (tup)) (opt)))
)
)
)
(prod
(text "i32x4.trunc_sat_f32x4_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "TRUNC_SAT%%" (tup (case "U" (tup)) (opt)))
)
)
)
(prod
(text "i32x4.trunc_sat_f64x2_s_zero")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "TRUNC_SAT%%" (tup (case "S" (tup)) (opt (case "ZERO" (tup)))))
)
)
)
(prod
(text "i32x4.trunc_sat_f64x2_u_zero")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "TRUNC_SAT%%" (tup (case "U" (tup)) (opt (case "ZERO" (tup)))))
)
)
)
(prod
(text "i32x4.relaxed_trunc_f32x4_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_TRUNC%%" (tup (case "S" (tup)) (opt)))
)
)
)
(prod
(text "i32x4.relaxed_trunc_f32x4_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "RELAXED_TRUNC%%" (tup (case "U" (tup)) (opt)))
)
)
)
(prod
(text "i32x4.relaxed_trunc_f64x2_s_zero")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case
"RELAXED_TRUNC%%"
(tup (case "S" (tup)) (opt (case "ZERO" (tup))))
)
)
)
)
(prod
(text "i32x4.relaxed_trunc_f64x2_u_zero")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case
"RELAXED_TRUNC%%"
(tup (case "U" (tup)) (opt (case "ZERO" (tup))))
)
)
)
)
(prod
(text "i64x2.extend_low_i32x4_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i64x2.extend_low_i32x4_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i64x2.extend_high_i32x4_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i64x2.extend_high_i32x4_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "EXTEND%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "f32x4.demote_f64x2_zero")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "DEMOTE%" (tup (case "ZERO" (tup))))
)
)
)
(prod
(text "f32x4.convert_i32x4_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt) (case "S" (tup))))
)
)
)
(prod
(text "f32x4.convert_i32x4_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt) (case "U" (tup))))
)
)
)
(prod
(text "f64x2.promote_low_f32x4")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "F32" (tup)) (case "%" (tup (num (nat 4))))))
(case "PROMOTELOW" (tup))
)
)
)
(prod
(text "f64x2.convert_low_i32x4_s")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt (case "LOW" (tup))) (case "S" (tup))))
)
)
)
(prod
(text "f64x2.convert_low_i32x4_u")
(case
"VCVTOP%%%"
(tup
(case "%X%" (tup (case "F64" (tup)) (case "%" (tup (num (nat 2))))))
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
(case "CONVERT%%" (tup (opt (case "LOW" (tup))) (case "U" (tup))))
)
)
)
(prod
(text "i16x8.extadd_pairwise_i8x16_s")
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "EXTADD_PAIRWISE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i16x8.extadd_pairwise_i8x16_u")
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "EXTADD_PAIRWISE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i32x4.extadd_pairwise_i16x8_s")
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "EXTADD_PAIRWISE%" (tup (case "S" (tup))))
)
)
)
(prod
(text "i32x4.extadd_pairwise_i16x8_u")
(case
"VEXTUNOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "EXTADD_PAIRWISE%" (tup (case "U" (tup))))
)
)
)
(prod
(text "i16x8.extmul_low_i8x16_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i16x8.extmul_low_i8x16_u")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i16x8.extmul_high_i8x16_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i16x8.extmul_high_i8x16_u")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I8" (tup)) (case "%" (tup (num (nat 16))))))
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i32x4.extmul_low_i16x8_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i32x4.extmul_low_i16x8_u")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i32x4.extmul_high_i16x8_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i32x4.extmul_high_i16x8_u")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i32x4.dot_i16x8_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I16" (tup)) (case "%" (tup (num (nat 8))))))
)
)
(case "DOTS" (tup))
)
)
)
(prod
(text "i64x2.extmul_low_i32x4_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i64x2.extmul_low_i32x4_u")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "EXTMUL%%" (tup (case "LOW" (tup)) (case "U" (tup))))
)
)
)
(prod
(text "i64x2.extmul_high_i32x4_s")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "S" (tup))))
)
)
)
(prod
(text "i64x2.extmul_high_i32x4_u")
(case
"VEXTBINOP%%%"
(tup
(case
"%"
(tup
(case "%X%" (tup (case "I64" (tup)) (case "%" (tup (num (nat 2))))))
)
)
(case
"%"
(tup
(case "%X%" (tup (case "I32" (tup)) (case "%" (tup (num (nat 4))))))
)
)
(case "EXTMUL%%" (tup (case "HIGH" (tup)) (case "U" (tup))))
)
)
)
)
(rec
(gram
"Tinstr_"
(exp "I" (var "I"))
(var "instr")
(prod
(exp "in" (var "instr"))
(attr (var "in") (var "Tplaininstr_" (exp (var "I"))))
(var "in")
)
(prod
(exp "in" (var "instr"))
(attr (var "in") (var "Tblockinstr_" (exp (var "I"))))
(var "in")
)
)
(gram
"Tinstrs_"
(exp "I" (var "I"))
(iter (var "instr") list)
(prod
(exp "in*" (iter (var "instr") list))
(attr
(iter (var "in") list (dom "in" (var "in*")))
(iter (var "Tinstr_" (exp (var "I"))) list)
)
(iter (var "in") list (dom "in" (var "in*")))
)
(prod
(exp "in**" (iter (iter (var "instr") list) list))
(attr
(iter
(iter (var "in") list (dom "in" (var "in*")))
list
(dom "in*" (var "in**"))
)
(iter (var "Tfoldedinstr_" (exp (var "I"))) list)
)
(call
"concat_"
(typ (var "instr"))
(exp
(iter
(iter (var "in") list (dom "in" (var "in*")))
list
(dom "in*" (var "in**"))
)
)
)
)
)
(gram
"Tblockinstr_"
(exp "I" (var "I"))
(var "instr")
(prod
(exp "id?" (iter (var "char") opt))
(exp "I'" (var "I"))
(exp "bt" (var "blocktype"))
(exp "in*" (iter (var "instr") list))
(exp "id'?" (iter (var "char") opt))
(seq
(seq (text "block"))
(seq
(attr
(tup
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
(var "I'")
)
(var "Tlabel_" (exp (var "I")))
)
)
(seq (attr (var "bt") (var "Tblocktype_" (exp (var "I")))))
(seq
(attr
(iter (var "in") list (dom "in" (var "in*")))
(var "Tinstrs_" (exp (var "I'")))
)
)
(seq (text "end"))
(seq
(attr
(opt
(case
"%"
(tup (lift (iter (var "id'") opt (dom "id'" (var "id'?")))))
)
)
(iter (var "Tid") opt)
)
)
)
(case
"BLOCK%%"
(tup (var "bt") (iter (var "in") list (dom "in" (var "in*"))))
)
(if
(bin
or
bool
(cmp eq bool (iter (var "id'") opt (dom "id'" (var "id'?"))) (opt))
(cmp
eq
bool
(iter (var "id'") opt (dom "id'" (var "id'?")))
(iter (var "id") opt (dom "id" (var "id?")))
)
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "I'" (var "I"))
(exp "bt" (var "blocktype"))
(exp "in*" (iter (var "instr") list))
(exp "id'?" (iter (var "char") opt))
(seq
(seq (text "loop"))
(seq
(attr
(tup
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
(var "I'")
)
(var "Tlabel_" (exp (var "I")))
)
)
(seq (attr (var "bt") (var "Tblocktype_" (exp (var "I")))))
(seq
(attr
(iter (var "in") list (dom "in" (var "in*")))
(var "Tinstrs_" (exp (var "I'")))
)
)
(seq (text "end"))
(seq
(attr
(opt
(case
"%"
(tup (lift (iter (var "id'") opt (dom "id'" (var "id'?")))))
)
)
(iter (var "Tid") opt)
)
)
)
(case
"LOOP%%"
(tup (var "bt") (iter (var "in") list (dom "in" (var "in*"))))
)
(if
(bin
or
bool
(cmp eq bool (iter (var "id'") opt (dom "id'" (var "id'?"))) (opt))
(cmp
eq
bool
(iter (var "id'") opt (dom "id'" (var "id'?")))
(iter (var "id") opt (dom "id" (var "id?")))
)
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "I'" (var "I"))
(exp "bt" (var "blocktype"))
(exp "in_1*" (iter (var "instr") list))
(exp "id_1?" (iter (var "char") opt))
(exp "in_2*" (iter (var "instr") list))
(exp "id_2?" (iter (var "char") opt))
(seq
(seq (text "if"))
(seq
(attr
(tup
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
(var "I'")
)
(var "Tlabel_" (exp (var "I")))
)
)
(seq (attr (var "bt") (var "Tblocktype_" (exp (var "I")))))
(seq
(attr
(iter (var "in_1") list (dom "in_1" (var "in_1*")))
(var "Tinstrs_" (exp (var "I'")))
)
)
(seq (text "else"))
(seq
(attr
(opt
(case
"%"
(tup (lift (iter (var "id_1") opt (dom "id_1" (var "id_1?")))))
)
)
(iter (var "Tid") opt)
)
)
(seq
(attr
(iter (var "in_2") list (dom "in_2" (var "in_2*")))
(var "Tinstrs_" (exp (var "I'")))
)
)
(seq (text "end"))
(seq
(attr
(opt
(case
"%"
(tup (lift (iter (var "id_2") opt (dom "id_2" (var "id_2?")))))
)
)
(iter (var "Tid") opt)
)
)
)
(case
"IF%%ELSE%"
(tup
(var "bt")
(iter (var "in_1") list (dom "in_1" (var "in_1*")))
(iter (var "in_2") list (dom "in_2" (var "in_2*")))
)
)
(if
(bin
and
bool
(bin
or
bool
(cmp
eq
bool
(iter (var "id_1") opt (dom "id_1" (var "id_1?")))
(opt)
)
(cmp
eq
bool
(iter (var "id_1") opt (dom "id_1" (var "id_1?")))
(iter (var "id") opt (dom "id" (var "id?")))
)
)
(bin
or
bool
(cmp
eq
bool
(iter (var "id_2") opt (dom "id_2" (var "id_2?")))
(opt)
)
(cmp
eq
bool
(iter (var "id_2") opt (dom "id_2" (var "id_2?")))
(iter (var "id") opt (dom "id" (var "id?")))
)
)
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "I'" (var "I"))
(exp "bt" (var "blocktype"))
(exp "c*" (iter (var "catch") list))
(exp "in*" (iter (var "instr") list))
(exp "id'?" (iter (var "char") opt))
(seq
(seq (text "try_table"))
(seq
(attr
(tup
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
(var "I'")
)
(var "Tlabel_" (exp (var "I")))
)
)
(seq (attr (var "bt") (var "Tblocktype_" (exp (var "I")))))
(seq
(attr
(iter (var "c") list (dom "c" (var "c*")))
(iter (var "Tcatch_" (exp (var "I"))) list)
)
)
(seq
(attr
(iter (var "in") list (dom "in" (var "in*")))
(var "Tinstrs_" (exp (var "I'")))
)
)
(seq (text "end"))
(seq
(attr
(opt
(case
"%"
(tup (lift (iter (var "id'") opt (dom "id'" (var "id'?")))))
)
)
(iter (var "Tid") opt)
)
)
)
(case
"TRY_TABLE%%%"
(tup
(var "bt")
(case "%" (tup (iter (var "c") list (dom "c" (var "c*")))))
(iter (var "in") list (dom "in" (var "in*")))
)
)
(if
(bin
or
bool
(cmp eq bool (iter (var "id'") opt (dom "id'" (var "id'?"))) (opt))
(cmp
eq
bool
(iter (var "id'") opt (dom "id'" (var "id'?")))
(iter (var "id") opt (dom "id" (var "id?")))
)
)
)
)
)
)
(gram
"Texpr_"
(exp "I" (var "I"))
(var "expr")
(prod
(exp "in*" (iter (var "instr") list))
(attr
(iter (var "in") list (dom "in" (var "in*")))
(var "Tinstrs_" (exp (var "I")))
)
(iter (var "in") list (dom "in" (var "in*")))
)
)
(gram
"Ttype_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "type")) (bind (var "_") (var "idctxt")))
(prod
(exp "qt" (var "rectype"))
(exp "I'" (var "I"))
(exp "I''" (var "I"))
(exp "st*" (iter (var "subtype") list))
(exp "n" (var "n"))
(exp "i*" (iter nat list))
(attr (tup (var "qt") (var "I'")) (var "Trectype_" (exp (var "I"))))
(tup (case "TYPE%" (tup (var "qt"))) (comp (var "I'") (var "I''")))
(if
(cmp
eq
bool
(var "qt")
(case
"REC%"
(tup
(case
"%"
(tup (iter (var "st") (listn (var "n")) (dom "st" (var "st*"))))
)
)
)
)
)
(if
(cmp
eq
bool
(var "I''")
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field
"TYPEDEFS"
(iter
(opt (case "_DEF%%" (tup (var "qt") (var "i"))))
(listn (var "n") "i")
(dom "i" (var "i*"))
)
)
)
)
)
)
)
(gram
"Ttag_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "tag")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "jt" (var "tagtype"))
(seq
(seq (text "("))
(seq (text "tag"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "jt") (var "Ttagtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "TAG%" (tup (var "jt")))
(struct
(field "TYPES" (list))
(field
"TAGS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Tglobal_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "global")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "gt" (var "globaltype"))
(exp "e" (var "expr"))
(seq
(seq (text "("))
(seq (text "global"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "gt") (var "Tglobaltype_" (exp (var "I")))))
(seq (attr (var "e") (var "Texpr_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "GLOBAL%%" (tup (var "gt") (var "e")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field
"GLOBALS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Tmem_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "mem")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "mt" (var "memtype"))
(seq
(seq (text "("))
(seq (text "memory"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "mt") (var "Tmemtype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "MEMORY%" (tup (var "mt")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field
"MEMS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Ttable_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "table")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "tt" (var "tabletype"))
(exp "e" (var "expr"))
(seq
(seq (text "("))
(seq (text "table"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "tt") (var "Ttabletype_" (exp (var "I")))))
(seq (attr (var "e") (var "Texpr_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "TABLE%%" (tup (var "tt") (var "e")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field
"TABLES"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Tlocal_"
(exp "I" (var "I"))
(tup
(bind (var "_") (iter (var "local") list))
(bind (var "_") (var "idctxt"))
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "t" (var "valtype"))
(seq
(seq (text "("))
(seq (text "local"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "t") (var "Tvaltype_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(list (case "LOCAL%" (tup (var "t"))))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field
"LOCALS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Tfunc_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "func")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "x" (var "idx"))
(exp "I_1" (var "I"))
(exp "loc**" (iter (iter (var "local") list) list))
(exp "I_2*" (iter (var "I") list))
(exp "e" (var "expr"))
(exp "I'" (var "I"))
(seq
(seq (text "("))
(seq (text "func"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (tup (var "x") (var "I_1")) (var "Ttypeuse_" (exp (var "I")))))
(seq
(iter
(attr
(tup (iter (var "loc") list (dom "loc" (var "loc*"))) (var "I_2"))
(var "Tlocal_" (exp (var "I")))
)
list
(dom "I_2" (var "I_2*"))
(dom "loc*" (var "loc**"))
)
)
(seq (attr (var "e") (var "Texpr_" (exp (var "I'")))))
(seq (text ")"))
)
(tup
(case
"FUNC%%%"
(tup
(var "x")
(call
"concat_"
(typ (var "local"))
(exp
(iter
(iter (var "loc") list (dom "loc" (var "loc*")))
list
(dom "loc*" (var "loc**"))
)
)
)
(var "e")
)
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field
"FUNCS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
(if
(cmp
eq
bool
(var "I'")
(comp
(comp (var "I") (var "I_1"))
(call
"concat_idctxt"
(exp (iter (var "I_2") list (dom "I_2" (var "I_2*"))))
)
)
)
)
(rule "Idctxt_ok" "|-%:OK" (var "I'"))
)
)
(gram
"Tdatastring"
(iter (var "byte") list)
(prod
(exp "b**" (iter (iter (var "byte") list) list))
(attr
(iter
(iter (var "b") list (dom "b" (var "b*")))
list
(dom "b*" (var "b**"))
)
(iter (var "Tstring") list)
)
(call
"concat_"
(typ (var "byte"))
(exp
(iter
(iter (var "b") list (dom "b" (var "b*")))
list
(dom "b*" (var "b**"))
)
)
)
)
)
(gram
"Tmemuse_"
(exp "I" (var "I"))
(var "memidx")
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "memory"))
(seq (attr (var "x") (var "Tmemidx_" (exp (var "I")))))
(seq (text ")"))
)
(var "x")
)
)
(gram
"Toffset_"
(exp "I" (var "I"))
(var "expr")
(prod
(exp "e" (var "expr"))
(seq
(seq (text "("))
(seq (text "offset"))
(seq (attr (var "e") (var "Texpr_" (exp (var "I")))))
(seq (text ")"))
)
(var "e")
)
)
(gram
"Tdata_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "data")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "b*" (iter (var "byte") list))
(seq
(seq (text "("))
(seq (text "data"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq
(attr (iter (var "b") list (dom "b" (var "b*"))) (var "Tdatastring"))
)
(seq (text ")"))
)
(tup
(case
"DATA%%"
(tup (iter (var "b") list (dom "b" (var "b*"))) (case "PASSIVE" (tup)))
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field
"DATAS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "x" (var "idx"))
(exp "e" (var "expr"))
(exp "b*" (iter (var "byte") list))
(seq
(seq (text "("))
(seq (text "data"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "x") (var "Tmemuse_" (exp (var "I")))))
(seq (attr (var "e") (var "Toffset_" (exp (var "I")))))
(seq
(attr (iter (var "b") list (dom "b" (var "b*"))) (var "Tdatastring"))
)
(seq (text ")"))
)
(tup
(case
"DATA%%"
(tup
(iter (var "b") list (dom "b" (var "b*")))
(case "ACTIVE%%" (tup (var "x") (var "e")))
)
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field
"DATAS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Telemlist_"
(exp "I" (var "I"))
(tup
(bind (var "_") (var "reftype"))
(bind (var "_") (iter (var "expr") list))
)
(prod
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (attr (var "rt") (var "Treftype_" (exp (var "I")))))
(seq
(attr
(iter (var "e") list (dom "e" (var "e*")))
(var "Tlist" (typ (var "expr")) (gram (var "Texpr_" (exp (var "I")))))
)
)
)
(tup (var "rt") (iter (var "e") list (dom "e" (var "e*"))))
)
)
(gram
"Ttableuse_"
(exp "I" (var "I"))
(var "tableidx")
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "table"))
(seq (attr (var "x") (var "Ttableidx_" (exp (var "I")))))
(seq (text ")"))
)
(var "x")
)
)
(gram
"Telem_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "elem")) (bind (var "_") (var "idctxt")))
(prod
(exp "id?" (iter (var "char") opt))
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (text "("))
(seq (text "elem"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq
(attr
(tup (var "rt") (iter (var "e") list (dom "e" (var "e*"))))
(var "Telemlist_" (exp (var "I")))
)
)
(seq (text ")"))
)
(tup
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") list (dom "e" (var "e*")))
(case "PASSIVE" (tup))
)
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field
"ELEMS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "x" (var "idx"))
(exp "e'" (var "expr"))
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (text "("))
(seq (text "elem"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (attr (var "x") (var "Ttableuse_" (exp (var "I")))))
(seq (attr (var "e'") (var "Toffset_" (exp (var "I")))))
(seq
(attr
(tup (var "rt") (iter (var "e") list (dom "e" (var "e*"))))
(var "Telemlist_" (exp (var "I")))
)
)
(seq (text ")"))
)
(tup
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") list (dom "e" (var "e*")))
(case "ACTIVE%%" (tup (var "x") (var "e'")))
)
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field
"ELEMS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
(prod
(exp "id?" (iter (var "char") opt))
(exp "rt" (var "reftype"))
(exp "e*" (iter (var "expr") list))
(seq
(seq (text "("))
(seq (text "elem"))
(seq
(attr
(opt
(case "%" (tup (lift (iter (var "id") opt (dom "id" (var "id?"))))))
)
(iter (var "Tid") opt)
)
)
(seq (text "declare"))
(seq
(attr
(tup (var "rt") (iter (var "e") list (dom "e" (var "e*"))))
(var "Telemlist_" (exp (var "I")))
)
)
(seq (text ")"))
)
(tup
(case
"ELEM%%%"
(tup
(var "rt")
(iter (var "e") list (dom "e" (var "e*")))
(case "DECLARE" (tup))
)
)
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field
"ELEMS"
(list
(opt
(case
"%"
(tup (lift (iter (var "id") opt (dom "id" (var "id?")))))
)
)
)
)
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Telemexpr_"
(exp "I" (var "I"))
(var "expr")
(prod
(exp "e" (var "expr"))
(seq
(seq (text "("))
(seq (text "item"))
(seq (attr (var "e") (var "Texpr_" (exp (var "I")))))
(seq (text ")"))
)
(var "e")
)
)
(gram
"Tstart_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "start")) (bind (var "_") (var "idctxt")))
(prod
(exp "x" (var "idx"))
(seq
(seq (text "("))
(seq (text "start"))
(seq (attr (var "x") (var "Tfuncidx_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "START%" (tup (var "x")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Timport_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "import")) (bind (var "_") (var "idctxt")))
(prod
(exp "nm_1" (var "name"))
(exp "nm_2" (var "name"))
(exp "xt" (var "externtype"))
(exp "I'" (var "I"))
(seq
(seq (text "("))
(seq (text "import"))
(seq (attr (var "nm_1") (var "Tname")))
(seq (attr (var "nm_2") (var "Tname")))
(seq
(attr (tup (var "xt") (var "I'")) (var "Texterntype_" (exp (var "I"))))
)
(seq (text ")"))
)
(tup
(case "IMPORT%%%" (tup (var "nm_1") (var "nm_2") (var "xt")))
(var "I'")
)
)
)
(gram
"Texport_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "export")) (bind (var "_") (var "idctxt")))
(prod
(exp "nm" (var "name"))
(exp "xx" (var "externidx"))
(seq
(seq (text "("))
(seq (text "export"))
(seq (attr (var "nm") (var "Tname")))
(seq (attr (var "xx") (var "Texternidx_" (exp (var "I")))))
(seq (text ")"))
)
(tup
(case "EXPORT%%" (tup (var "nm") (var "xx")))
(struct
(field "TYPES" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field "LABELS" (list))
(field "FIELDS" (list))
(field "TYPEDEFS" (list))
)
)
)
)
(gram
"Texportdots"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (text "("))
(seq (text "export"))
(seq (var "Tname"))
(seq (text ")"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Timportdots"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (text "("))
(seq (text "import"))
(seq (var "Tname"))
(seq (var "Tname"))
(seq (text ")"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(def "dots" (tup))
(gram
"Texporttagdots_"
(exp "I" (var "I"))
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (var "Ttagtype_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(var "Timportdots")
(seq (var "Ttagtype_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Texportglobaldots_"
(exp "I" (var "I"))
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (var "Tglobaltype_" (exp (var "I"))))
(seq (var "Texpr_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(var "Timportdots")
(seq (var "Tglobaltype_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Texportmemdots_"
(exp "I" (var "I"))
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (var "Tmemtype_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (iter (var "Taddrtype") opt))
(seq (text "("))
(seq (text "data"))
(seq (var "Tdatastring"))
(seq (text ")"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(var "Timportdots")
(seq (var "Tmemtype_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Texporttabledots_"
(exp "I" (var "I"))
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (var "Ttabletype_" (exp (var "I"))))
(seq (iter (var "Texpr_" (exp (var "I"))) opt))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (iter (var "Taddrtype") opt))
(seq (var "Treftype_" (exp (var "I"))))
(seq (text "("))
(seq (text "elem"))
(seq (var "Telemlist_" (exp (var "I"))))
(seq (text ")"))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(var "Timportdots")
(seq (var "Ttabletype_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram
"Texportfuncdots_"
(exp "I" (var "I"))
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(seq (var "Ttypeuse_" (exp (var "I"))))
(seq (iter (var "Tlocal_" (exp (var "I"))) list))
(seq (var "Texpr_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr
(var "<implicit-prod-result>")
(seq
(seq (iter (var "Texportdots") list))
(var "Timportdots")
(seq (var "Ttypeuse_" (exp (var "I"))))
)
)
(proj (tup (var "<implicit-prod-result>") (tup)) 1)
)
)
(gram "Texporttag_" (exp "I" (var "I")) (tup))
(gram "Texportglobal_" (exp "I" (var "I")) (tup))
(gram "Texportmem_" (exp "I" (var "I")) (tup))
(gram "Texporttable_" (exp "I" (var "I")) (tup))
(gram "Texportfunc_" (exp "I" (var "I")) (tup))
(gram "Tdatamem_" (exp "I" (var "I")) (tup))
(gram "Telemtable_" (exp "I" (var "I")) (tup))
(typ
"decl"
(inst
(variant
(case
"TYPE%"
(exp "rectype" (var "rectype"))
(tup (bind (var "rectype") (var "rectype")))
)
(case
"IMPORT%%%"
(exp "name" (var "name"))
(exp "externtype" (var "externtype"))
(tup
(bind (var "name") (var "name"))
(bind (var "_") (var "name"))
(bind (var "externtype") (var "externtype"))
)
)
(case
"TAG%"
(exp "tagtype" (var "tagtype"))
(tup (bind (var "tagtype") (var "tagtype")))
)
(case
"GLOBAL%%"
(exp "globaltype" (var "globaltype"))
(exp "expr" (var "expr"))
(tup
(bind (var "globaltype") (var "globaltype"))
(bind (var "expr") (var "expr"))
)
)
(case
"MEMORY%"
(exp "memtype" (var "memtype"))
(tup (bind (var "memtype") (var "memtype")))
)
(case
"TABLE%%"
(exp "tabletype" (var "tabletype"))
(exp "expr" (var "expr"))
(tup
(bind (var "tabletype") (var "tabletype"))
(bind (var "expr") (var "expr"))
)
)
(case
"FUNC%%%"
(exp "typeidx" (var "typeidx"))
(exp "local*" (iter (var "local") list))
(exp "expr" (var "expr"))
(tup
(bind (var "typeidx") (var "typeidx"))
(bind
(iter (var "local") list (dom "local" (var "local*")))
(iter (var "local") list)
)
(bind (var "expr") (var "expr"))
)
)
(case
"DATA%%"
(exp "byte*" (iter (var "byte") list))
(exp "datamode" (var "datamode"))
(tup
(bind
(iter (var "byte") list (dom "byte" (var "byte*")))
(iter (var "byte") list)
)
(bind (var "datamode") (var "datamode"))
)
)
(case
"ELEM%%%"
(exp "reftype" (var "reftype"))
(exp "expr*" (iter (var "expr") list))
(exp "elemmode" (var "elemmode"))
(tup
(bind (var "reftype") (var "reftype"))
(bind
(iter (var "expr") list (dom "expr" (var "expr*")))
(iter (var "expr") list)
)
(bind (var "elemmode") (var "elemmode"))
)
)
(case
"START%"
(exp "funcidx" (var "funcidx"))
(tup (bind (var "funcidx") (var "funcidx")))
)
(case
"EXPORT%%"
(exp "name" (var "name"))
(exp "externidx" (var "externidx"))
(tup
(bind (var "name") (var "name"))
(bind (var "externidx") (var "externidx"))
)
)
)
)
)
(rec
(def
"typesd"
(exp "_" (iter (var "decl") list))
(iter (var "type") list)
(clause (exp (list)) (list))
(clause
(exp "type" (var "type"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "type") (var "decl") (var "type")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "type"))
(call
"typesd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"typesd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"importsd"
(exp "_" (iter (var "decl") list))
(iter (var "import") list)
(clause (exp (list)) (list))
(clause
(exp "import" (var "import"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "import") (var "decl") (var "import")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "import"))
(call
"importsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"importsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"tagsd"
(exp "_" (iter (var "decl") list))
(iter (var "tag") list)
(clause (exp (list)) (list))
(clause
(exp "tag" (var "tag"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "tag") (var "decl") (var "tag")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "tag"))
(call
"tagsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"tagsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"globalsd"
(exp "_" (iter (var "decl") list))
(iter (var "global") list)
(clause (exp (list)) (list))
(clause
(exp "global" (var "global"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "global") (var "decl") (var "global")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "global"))
(call
"globalsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"globalsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"memsd"
(exp "_" (iter (var "decl") list))
(iter (var "mem") list)
(clause (exp (list)) (list))
(clause
(exp "mem" (var "mem"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "mem") (var "decl") (var "mem")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "mem"))
(call
"memsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"memsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"tablesd"
(exp "_" (iter (var "decl") list))
(iter (var "table") list)
(clause (exp (list)) (list))
(clause
(exp "table" (var "table"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "table") (var "decl") (var "table")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "table"))
(call
"tablesd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"tablesd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"funcsd"
(exp "_" (iter (var "decl") list))
(iter (var "func") list)
(clause (exp (list)) (list))
(clause
(exp "func" (var "func"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "func") (var "decl") (var "func")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "func"))
(call
"funcsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"funcsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"datasd"
(exp "_" (iter (var "decl") list))
(iter (var "data") list)
(clause (exp (list)) (list))
(clause
(exp "data" (var "data"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "data") (var "decl") (var "data")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "data"))
(call
"datasd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"datasd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"elemsd"
(exp "_" (iter (var "decl") list))
(iter (var "elem") list)
(clause (exp (list)) (list))
(clause
(exp "elem" (var "elem"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "elem") (var "decl") (var "elem")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "elem"))
(call
"elemsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"elemsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"startsd"
(exp "_" (iter (var "decl") list))
(iter (var "start") list)
(clause (exp (list)) (list))
(clause
(exp "start" (var "start"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "start") (var "decl") (var "start")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "start"))
(call
"startsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"startsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(rec
(def
"exportsd"
(exp "_" (iter (var "decl") list))
(iter (var "export") list)
(clause (exp (list)) (list))
(clause
(exp "export" (var "export"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (sub (var "export") (var "decl") (var "export")))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(cat
(list (var "export"))
(call
"exportsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
)
)
(clause
(exp "decl" (var "decl"))
(exp "decl'*" (iter (var "decl") list))
(exp
(cat
(list (var "decl"))
(iter (var "decl'") list (dom "decl'" (var "decl'*")))
)
)
(call
"exportsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
else
)
)
)
(def
"ordered"
(exp "_" (iter (var "decl") list))
bool
(clause
(exp "decl'*" (iter (var "decl") list))
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
(bool true)
(if
(cmp
eq
bool
(call
"importsd"
(exp (iter (var "decl'") list (dom "decl'" (var "decl'*"))))
)
(list)
)
)
)
(clause
(exp "decl_1*" (iter (var "decl") list))
(exp "import" (var "import"))
(exp "decl_2*" (iter (var "decl") list))
(exp
(cat
(iter (var "decl_1") list (dom "decl_1" (var "decl_1*")))
(cat
(list (sub (var "import") (var "decl") (var "import")))
(iter (var "decl_2") list (dom "decl_2" (var "decl_2*")))
)
)
)
(bin
and
bool
(bin
and
bool
(bin
and
bool
(bin
and
bool
(bin
and
bool
(cmp
eq
bool
(call
"importsd"
(exp
(iter (var "decl_1") list (dom "decl_1" (var "decl_1*")))
)
)
(list)
)
(cmp
eq
bool
(call
"tagsd"
(exp
(iter (var "decl_1") list (dom "decl_1" (var "decl_1*")))
)
)
(list)
)
)
(cmp
eq
bool
(call
"globalsd"
(exp (iter (var "decl_1") list (dom "decl_1" (var "decl_1*"))))
)
(list)
)
)
(cmp
eq
bool
(call
"memsd"
(exp (iter (var "decl_1") list (dom "decl_1" (var "decl_1*"))))
)
(list)
)
)
(cmp
eq
bool
(call
"tablesd"
(exp (iter (var "decl_1") list (dom "decl_1" (var "decl_1*"))))
)
(list)
)
)
(cmp
eq
bool
(call
"funcsd"
(exp (iter (var "decl_1") list (dom "decl_1" (var "decl_1*"))))
)
(list)
)
)
)
)
(gram
"Tdecl_"
(exp "I" (var "I"))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "type")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Ttype_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "type")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "import")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Timport_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "import")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "tag")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Ttag_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "tag")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "global")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Tglobal_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "global")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "mem")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Tmem_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "mem")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "table")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Ttable_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "table")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "func")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Tfunc_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "func")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "data")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Tdata_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "data")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "elem")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Telem_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "elem")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "start")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Tstart_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "start")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "export")) (bind (var "_") (var "idctxt")))
)
(attr (var "<implicit-prod-result>") (var "Texport_" (exp (var "I"))))
(sub
(tup (bind (var "_") (var "export")) (bind (var "_") (var "idctxt")))
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
(var "<implicit-prod-result>")
)
)
)
(gram
"Tmodule"
(var "module")
(prod
(exp "decl*" (iter (var "decl") list))
(exp "I*" (iter (var "I") list))
(exp "I'" (var "I"))
(exp "type*" (iter (var "type") list))
(exp "import*" (iter (var "import") list))
(exp "tag*" (iter (var "tag") list))
(exp "global*" (iter (var "global") list))
(exp "mem*" (iter (var "mem") list))
(exp "table*" (iter (var "table") list))
(exp "func*" (iter (var "func") list))
(exp "data*" (iter (var "data") list))
(exp "elem*" (iter (var "elem") list))
(exp "start?" (iter (var "start") opt))
(exp "export*" (iter (var "export") list))
(seq
(seq (text "("))
(seq (text "module"))
(seq (iter (var "Tid") opt))
(seq
(attr
(iter
(tup (var "decl") (var "I"))
list
(dom "I" (var "I*"))
(dom "decl" (var "decl*"))
)
(iter (var "Tdecl_" (exp (var "I'"))) list)
)
)
(seq (text ")"))
)
(case
"MODULE%%%%%%%%%%%"
(tup
(iter (var "type") list (dom "type" (var "type*")))
(iter (var "import") list (dom "import" (var "import*")))
(iter (var "tag") list (dom "tag" (var "tag*")))
(iter (var "global") list (dom "global" (var "global*")))
(iter (var "mem") list (dom "mem" (var "mem*")))
(iter (var "table") list (dom "table" (var "table*")))
(iter (var "func") list (dom "func" (var "func*")))
(iter (var "data") list (dom "data" (var "data*")))
(iter (var "elem") list (dom "elem" (var "elem*")))
(iter (var "start") opt (dom "start" (var "start?")))
(iter (var "export") list (dom "export" (var "export*")))
)
)
(if
(cmp
eq
bool
(var "I'")
(call "concat_idctxt" (exp (iter (var "I") list (dom "I" (var "I*")))))
)
)
(rule "Idctxt_ok" "|-%:OK" (var "I'"))
(if
(cmp
eq
bool
(iter (var "type") list (dom "type" (var "type*")))
(call
"typesd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "import") list (dom "import" (var "import*")))
(call
"importsd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "tag") list (dom "tag" (var "tag*")))
(call "tagsd" (exp (iter (var "decl") list (dom "decl" (var "decl*")))))
)
)
(if
(cmp
eq
bool
(iter (var "global") list (dom "global" (var "global*")))
(call
"globalsd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "mem") list (dom "mem" (var "mem*")))
(call "memsd" (exp (iter (var "decl") list (dom "decl" (var "decl*")))))
)
)
(if
(cmp
eq
bool
(iter (var "table") list (dom "table" (var "table*")))
(call
"tablesd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "func") list (dom "func" (var "func*")))
(call
"funcsd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "data") list (dom "data" (var "data*")))
(call
"datasd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "elem") list (dom "elem" (var "elem*")))
(call
"elemsd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(lift (iter (var "start") opt (dom "start" (var "start?"))))
(call
"startsd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(cmp
eq
bool
(iter (var "export") list (dom "export" (var "export*")))
(call
"exportsd"
(exp (iter (var "decl") list (dom "decl" (var "decl*"))))
)
)
)
(if
(call "ordered" (exp (iter (var "decl") list (dom "decl" (var "decl*")))))
)
)
)
(gram
"Tdecldots_"
(exp "I" (var "I"))
(iter
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
list
)
(prod
(exp
"<implicit-prod-result>"
(tup (bind (var "_") (var "decl")) (bind (var "_") (var "idctxt")))
)
(attr
(list (var "<implicit-prod-result>"))
(iter (var "Tdecl_" (exp (var "I"))) list)
)
(list (var "<implicit-prod-result>"))
)
)
(typ "A" (inst (alias nat)))
(typ "B" (inst (alias nat)))
(typ
"sym"
(inst
(variant
(case "_FIRST%" (exp "A_1" (var "A")) (tup (bind (var "A_1") (var "A"))))
(case "_DOTS" (tup))
(case "_LAST%" (exp "A_n" (var "A")) (tup (bind (var "A_n") (var "A"))))
)
)
)
(typ
"symsplit"
(inst
(variant
(case "_FIRST%" (exp "A_1" (var "A")) (tup (bind (var "A_1") (var "A"))))
(case "_LAST%" (exp "A_2" (var "A")) (tup (bind (var "A_2") (var "A"))))
)
)
)
(typ "recorddots" (inst (alias (tup))))
(typ
"record"
(inst
(struct
(field "FIELD_1" (exp "A_1" (var "A")) (var "A"))
(field "FIELD_2" (exp "A_2" (var "A")) (var "A"))
(field "..." (exp "recorddots" (var "recorddots")) (var "recorddots"))
)
)
)
(typ "pth" (inst (variant (case "PTHSYNTAX" (tup)))))
(typ "T" (inst (alias nat)))
(rel "NotationTypingPremise" "%" nat)
(rel "NotationTypingPremisedots" "..." (tup))
(rel
"NotationTypingScheme"
"%"
nat
(rule
""
(exp "conclusion" nat)
(exp "premise_1" nat)
(exp "premise_2" nat)
(exp "premise_n" nat)
"%"
(var "conclusion")
(rule "NotationTypingPremise" "%" (var "premise_1"))
(rule "NotationTypingPremise" "%" (var "premise_2"))
(rule "NotationTypingPremisedots" "..." (tup))
(rule "NotationTypingPremise" "%" (var "premise_n"))
)
)
(rec
(rel
"NotationTypingInstrScheme"
"%|-%:%"
(tup
(bind (var "_") (var "context"))
(bind (var "_") (iter (var "instr") list))
(bind (var "_") (var "instrtype"))
)
(rule
"i32.add"
(exp "C" (var "context"))
"%|-%:%"
(tup
(var "C")
(list (case "BINOP%%" (tup (case "I32" (tup)) (case "ADD" (tup)))))
(case
"%->_%%"
(tup
(case "%" (tup (list (case "I32" (tup)) (case "I32" (tup)))))
(list)
(case "%" (tup (list (case "I32" (tup)))))
)
)
)
)
(rule
"global.get"
(exp "C" (var "context"))
(exp "x" (var "idx"))
(exp "t" (var "valtype"))
(exp "mut" (var "mut"))
"%|-%:%"
(tup
(var "C")
(list (case "GLOBAL.GET%" (tup (var "x"))))
(case
"%->_%%"
(tup (case "%" (tup (list))) (list) (case "%" (tup (list (var "t")))))
)
)
(if
(cmp
eq
bool
(idx (dot (var "C") "GLOBALS") (proj (uncase (var "x") "%") 0))
(case "%%" (tup (opt (var "mut")) (var "t")))
)
)
)
(rule
"block"
(exp "C" (var "context"))
(exp "blocktype" (var "blocktype"))
(exp "instr*" (iter (var "instr") list))
(exp "t_1*" (iter (var "valtype") list))
(exp "t_2*" (iter (var "valtype") list))
"%|-%:%"
(tup
(var "C")
(list
(case
"BLOCK%%"
(tup
(var "blocktype")
(iter (var "instr") list (dom "instr" (var "instr*")))
)
)
)
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
(rule
"Blocktype_ok"
"%|-%:%"
(tup
(var "C")
(var "blocktype")
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
(rule
"NotationTypingInstrScheme"
"%|-%:%"
(tup
(comp
(struct
(field "TYPES" (list))
(field "RECS" (list))
(field "TAGS" (list))
(field "GLOBALS" (list))
(field "MEMS" (list))
(field "TABLES" (list))
(field "FUNCS" (list))
(field "DATAS" (list))
(field "ELEMS" (list))
(field "LOCALS" (list))
(field
"LABELS"
(list
(case
"%"
(tup (iter (var "t_2") list (dom "t_2" (var "t_2*"))))
)
)
)
(field "RETURN" (opt))
(field "REFS" (list))
)
(var "C")
)
(iter (var "instr") list (dom "instr" (var "instr*")))
(case
"%->_%%"
(tup
(case "%" (tup (iter (var "t_1") list (dom "t_1" (var "t_1*")))))
(list)
(case "%" (tup (iter (var "t_2") list (dom "t_2" (var "t_2*")))))
)
)
)
)
)
)
)
(rel
"NotationReduct"
"~>%"
(iter (var "instr") list)
(rule
"2"
(exp "q_1" (var "num_" (exp (case "F64" (tup)))))
(exp "q_4" (var "num_" (exp (case "F64" (tup)))))
(exp "q_3" (var "num_" (exp (case "F64" (tup)))))
"~>%"
(list
(case "CONST%%" (tup (case "F64" (tup)) (var "q_1")))
(case "CONST%%" (tup (case "F64" (tup)) (var "q_4")))
(case "CONST%%" (tup (case "F64" (tup)) (var "q_3")))
(case "BINOP%%" (tup (case "F64" (tup)) (case "ADD" (tup))))
(case "BINOP%%" (tup (case "F64" (tup)) (case "MUL" (tup))))
)
)
(rule
"3"
(exp "q_1" (var "num_" (exp (case "F64" (tup)))))
(exp "q_5" (var "num_" (exp (case "F64" (tup)))))
"~>%"
(list
(case "CONST%%" (tup (case "F64" (tup)) (var "q_1")))
(case "CONST%%" (tup (case "F64" (tup)) (var "q_5")))
(case "BINOP%%" (tup (case "F64" (tup)) (case "MUL" (tup))))
)
)
(rule
"4"
(exp "q_6" (var "num_" (exp (case "F64" (tup)))))
"~>%"
(list (case "CONST%%" (tup (case "F64" (tup)) (var "q_6"))))
)
)
(def "instrdots" (iter (var "instr") list))
(typ
"label"
(inst
(variant
(case
"LABEL_%{%}"
(exp "n" (var "n"))
(exp "instr*" (iter (var "instr") list))
(tup
(bind (var "n") (var "n"))
(bind
(iter (var "instr") list (dom "instr" (var "instr*")))
(iter (var "instr") list)
)
)
)
)
)
)
(typ
"callframe"
(inst
(variant
(case
"FRAME_%{%}"
(exp "n" (var "n"))
(exp "frame" (var "frame"))
(tup (bind (var "n") (var "n")) (bind (var "frame") (var "frame")))
)
)
)
)
(def
"allocX"
(typ "X")
(typ "Y")
(exp "store" (var "store"))
(exp "X" (var "X"))
(exp "Y" (var "Y"))
(tup (bind (var "_") (var "store")) (bind (var "_") (var "addr")))
)
(rec
(def
"allocXs"
(typ "X")
(typ "Y")
(exp "store" (var "store"))
(exp "_" (iter (var "X") list))
(exp "_" (iter (var "Y") list))
(tup
(bind (var "_") (var "store"))
(bind (var "_") (iter (var "addr") list))
)
(clause
(typ "X")
(typ "Y")
(exp "s" (var "store"))
(typ (var "X"))
(typ (var "Y"))
(exp (var "s"))
(exp (list))
(exp (list))
(tup (var "s") (list))
)
(clause
(typ "X")
(typ "Y")
(exp "s" (var "store"))
(exp "X" (var "X"))
(exp "X'*" (iter (var "X") list))
(exp "Y" (var "Y"))
(exp "Y'*" (iter (var "Y") list))
(exp "s_2" (var "store"))
(exp "a" (var "addr"))
(exp "a'*" (iter (var "addr") list))
(exp "s_1" (var "store"))
(typ (var "X"))
(typ (var "Y"))
(exp (var "s"))
(exp (cat (list (var "X")) (iter (var "X'") list (dom "X'" (var "X'*")))))
(exp (cat (list (var "Y")) (iter (var "Y'") list (dom "Y'" (var "Y'*")))))
(tup
(var "s_2")
(cat (list (var "a")) (iter (var "a'") list (dom "a'" (var "a'*"))))
)
(if
(cmp
eq
bool
(tup (var "s_1") (var "a"))
(call
"allocX"
(typ (var "X"))
(typ (var "Y"))
(exp (var "s"))
(exp (var "X"))
(exp (var "Y"))
)
)
)
(if
(cmp
eq
bool
(tup (var "s_2") (iter (var "a'") list (dom "a'" (var "a'*"))))
(call
"allocXs"
(typ (var "X"))
(typ (var "Y"))
(exp (var "s_1"))
(exp (iter (var "X'") list (dom "X'" (var "X'*"))))
(exp (iter (var "Y'") list (dom "Y'" (var "Y'*"))))
)
)
)
)
)
)
(typ
"symdots"
(inst
(variant
(case
"%"
(exp "i" nat)
(tup (bind (var "i") nat))
(if (cmp eq bool (var "i") (num (nat 0))))
)
)
)
)
(def "var" (typ "X") nat (clause (typ "X") (typ (var "X")) (num (nat 0))))
(gram "Bvar" (typ "X") (tup) (prod (num 0x00) (tup)))
(gram
"Bsym"
(var "A")
(prod (var "Bvar" (typ (var "B"))) (call "var" (typ (var "A"))))
(prod
(alt (var "Bvar" (typ (var "symdots"))) (var "Bvar" (typ (var "B"))))
(call "var" (typ (var "A")))
)
)
(gram
"Bsymsplit"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Bvar" (typ (var "B"))))
(var "<implicit-prod-result>")
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Bvar" (typ (var "B"))))
(var "<implicit-prod-result>")
)
)
(gram "Tvar" (typ "X") (tup) (prod (num 0x00) (tup)))
(gram
"Tsym"
(var "A")
(prod (var "Tvar" (typ (var "T"))) (call "var" (typ (var "A"))))
(prod
(alt (var "Tvar" (typ (var "symdots"))) (var "Tvar" (typ (var "T"))))
(call "var" (typ (var "A")))
)
)
(gram
"Tsymsplit"
(tup)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tvar" (typ (var "B"))))
(var "<implicit-prod-result>")
)
(prod
(exp "<implicit-prod-result>" (tup))
(attr (var "<implicit-prod-result>") (var "Tvar" (typ (var "B"))))
(var "<implicit-prod-result>")
)
)
(typ "abbreviated" (inst (alias (tup))))
(typ "expanded" (inst (alias (tup))))
(typ "syntax" (inst (alias (tup))))
(gram "Tabbrev" (tup))