package owi

  1. Overview
  2. Docs

Types of text modules, as produced by the parser. Many parts of it are reused later in the interpreter.

exception Trap of string

Structure

Types

type nonrec num_type =
  1. | I32
  2. | I64
  3. | F32
  4. | F64
type nonrec ref_type =
  1. | Func_ref
  2. | Extern_ref
type nonrec val_type =
  1. | Num_type of num_type
  2. | Ref_type of ref_type
type nonrec param = string option * val_type
type nonrec param_type = param list
type nonrec result_ = val_type
type nonrec result_type = result_ list
type nonrec func_type = param_type * result_type
type nonrec limits = {
  1. min : int;
  2. max : int option;
}
type nonrec mem_type = limits
type nonrec table_type = limits * ref_type
type nonrec mut =
  1. | Const
  2. | Var
type nonrec global_type = mut * val_type
type nonrec extern_type =
  1. | Func of string option * func_type
  2. | Table of string option * table_type
  3. | Mem of string option * mem_type
  4. | Global of string option * global_type

Instructions

type nonrec nn =
  1. | S32
  2. | S64
type nonrec sx =
  1. | U
  2. | S
type nonrec iunop =
  1. | Clz
  2. | Ctz
  3. | Popcnt
type nonrec funop =
  1. | Abs
  2. | Neg
  3. | Sqrt
  4. | Ceil
  5. | Floor
  6. | Trunc
  7. | Nearest
type nonrec ibinop =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div of sx
  5. | Rem of sx
  6. | And
  7. | Or
  8. | Xor
  9. | Shl
  10. | Shr of sx
  11. | Rotl
  12. | Rotr
type nonrec fbinop =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div
  5. | Min
  6. | Max
  7. | Copysign
type nonrec itestop =
  1. | Eqz
type nonrec irelop =
  1. | Eq
  2. | Ne
  3. | Lt of sx
  4. | Gt of sx
  5. | Le of sx
  6. | Ge of sx
type nonrec frelop =
  1. | Eq
  2. | Ne
  3. | Lt
  4. | Gt
  5. | Le
  6. | Ge
type indice =
  1. | Raw of int
  2. | Symbolic of string
type memarg = {
  1. offset : int;
  2. align : int;
}
type 'indice block_type =
  1. | Bt_ind of 'indice
  2. | Bt_raw of 'indice option * func_type
type ('indice, 'bt) instr' =
  1. | I32_const of Int32.t
  2. | I64_const of Int64.t
  3. | F32_const of Float32.t
  4. | F64_const of Float64.t
  5. | I_unop of nn * iunop
  6. | F_unop of nn * funop
  7. | I_binop of nn * ibinop
  8. | F_binop of nn * fbinop
  9. | I_testop of nn * itestop
  10. | I_relop of nn * irelop
  11. | F_relop of nn * frelop
  12. | I_extend8_s of nn
  13. | I_extend16_s of nn
  14. | I64_extend32_s
  15. | I32_wrap_i64
  16. | I64_extend_i32 of sx
  17. | I_trunc_f of nn * nn * sx
  18. | I_trunc_sat_f of nn * nn * sx
  19. | F32_demote_f64
  20. | F64_promote_f32
  21. | F_convert_i of nn * nn * sx
  22. | I_reinterpret_f of nn * nn
  23. | F_reinterpret_i of nn * nn
  24. | Ref_null of ref_type
  25. | Ref_is_null
  26. | Ref_func of 'indice
  27. | Drop
  28. | Select of val_type list option
  29. | Local_get of 'indice
  30. | Local_set of 'indice
  31. | Local_tee of 'indice
  32. | Global_get of 'indice
  33. | Global_set of 'indice
  34. | Table_get of 'indice
  35. | Table_set of 'indice
  36. | Table_size of 'indice
  37. | Table_grow of 'indice
  38. | Table_fill of 'indice
  39. | Table_copy of 'indice * 'indice
  40. | Table_init of 'indice * 'indice
  41. | Elem_drop of 'indice
  42. | I_load of nn * memarg
  43. | F_load of nn * memarg
  44. | I_store of nn * memarg
  45. | F_store of nn * memarg
  46. | I_load8 of nn * sx * memarg
  47. | I_load16 of nn * sx * memarg
  48. | I64_load32 of sx * memarg
  49. | I_store8 of nn * memarg
  50. | I_store16 of nn * memarg
  51. | I64_store32 of memarg
  52. | Memory_size
  53. | Memory_grow
  54. | Memory_fill
  55. | Memory_copy
  56. | Memory_init of 'indice
  57. | Data_drop of 'indice
  58. | Nop
  59. | Unreachable
  60. | Block of string option * 'bt option * ('indice, 'bt) expr'
  61. | Loop of string option * 'bt option * ('indice, 'bt) expr'
  62. | If_else of string option * 'bt option * ('indice, 'bt) expr' * ('indice, 'bt) expr'
  63. | Br of 'indice
  64. | Br_if of 'indice
  65. | Br_table of 'indice array * 'indice
  66. | Return
  67. | Call of 'indice
  68. | Call_indirect of 'indice * 'bt
and ('indice, 'bt) expr' = ('indice, 'bt) instr' list
type instr = (indice, indice block_type) instr'
type simplified_instr = (int, int block_type) instr'
type expr = (indice, indice block_type) expr'
type simplified_expr = (int, int block_type) expr'
type result_expr = (int, func_type) expr'
type ('indice, 'bt) func' = {
  1. type_f : 'bt;
  2. locals : param list;
  3. body : ('indice, 'bt) expr';
  4. id : string option;
}
type 'indice func = ('indice, 'indice block_type) func'
type table = string option * table_type
type mem = string option * mem_type
type 'expr global' = {
  1. type_ : global_type;
  2. init : 'expr;
  3. id : string option;
}
type ('indice, 'expr) elem_mode =
  1. | Elem_passive
  2. | Elem_active of 'indice * 'expr
  3. | Elem_declarative
type ('indice, 'expr) elem' = {
  1. id : string option;
  2. type_ : ref_type;
  3. init : 'expr list;
  4. mode : ('indice, 'expr) elem_mode;
}
type elem = (indice option, (indice, indice block_type) expr') elem'
type ('indice, 'expr) data_mode =
  1. | Data_passive
  2. | Data_active of 'indice * 'expr
type ('indice, 'expr) data' = {
  1. id : string option;
  2. init : string;
  3. mode : ('indice, 'expr) data_mode;
}
type data = (indice option, (indice, indice block_type) expr') data'
type import_desc =
  1. | Import_func of string option * indice block_type
  2. | Import_table of string option * table_type
  3. | Import_mem of string option * mem_type
  4. | Import_global of string option * global_type
type import = {
  1. module_ : string;
  2. name : string;
  3. desc : import_desc;
}
type 'indice export_desc' =
  1. | Export_func of 'indice option
  2. | Export_table of 'indice option
  3. | Export_mem of 'indice option
  4. | Export_global of 'indice option
type export_desc = indice export_desc'
type 'indice export' = {
  1. name : string;
  2. desc : 'indice export_desc';
}
type export = indice export'
type type_ = string option * func_type
type module_field =
  1. | MType of type_
  2. | MGlobal of global
  3. | MTable of table
  4. | MMem of mem
  5. | MFunc of indice func
  6. | MElem of elem
  7. | MData of data
  8. | MStart of indice
  9. | MImport of import
  10. | MExport of export
type module_ = {
  1. id : string option;
  2. fields : module_field list;
}
type const =
  1. | Const_I32 of Int32.t
  2. | Const_I64 of Int64.t
  3. | Const_F32 of Float32.t
  4. | Const_F64 of Float64.t
  5. | Const_null of ref_type
  6. | Const_host of int
type action =
  1. | Invoke of string option * string * const list
  2. | Get of string option * string
type result_const =
  1. | Literal of const
  2. | Nan_canon of nn
  3. | Nan_arith of nn
type result =
  1. | Result_const of result_const
  2. | Result_extern_ref
  3. | Result_func_ref
type assert_ =
  1. | Assert_return of action * result list
  2. | Assert_trap of action * string
  3. | Assert_trap_module of module_ * string
  4. | Assert_malformed of module_ * string
  5. | Assert_malformed_quote of string list * string
  6. | Assert_malformed_binary of string list * string
  7. | Assert_invalid of module_ * string
  8. | Assert_invalid_quote of string list * string
  9. | Assert_invalid_binary of string list * string
  10. | Assert_exhaustion of action * string
  11. | Assert_unlinkable of module_ * string
type cmd =
  1. | Module of module_
  2. | Assert of assert_
  3. | Register of string * string option
  4. | Action of action
type script = cmd list
module Const : sig ... end