numbl 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/binding.gyp +6 -5
  2. package/dist-cli/cli.js +63077 -42047
  3. package/dist-lib/graphics/types.d.ts +40 -1
  4. package/dist-lib/lib.d.ts +0 -1
  5. package/dist-lib/lib.js +78446 -57671
  6. package/dist-lib/numbl-core/executeCode.d.ts +10 -12
  7. package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
  8. package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
  9. package/dist-lib/numbl-core/executors/index.d.ts +0 -3
  10. package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
  11. package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
  12. package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
  13. package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
  14. package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
  15. package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
  16. package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
  17. package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
  18. package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
  19. package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
  20. package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
  21. package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
  22. package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
  23. package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
  24. package/dist-lib/numbl-core/executors/lowering.d.ts +31 -77
  25. package/dist-lib/numbl-core/executors/plugins.d.ts +14 -21
  26. package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
  27. package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
  28. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +0 -18
  29. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +37 -21
  30. package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
  31. package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +13 -1
  32. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +1 -1
  33. package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
  34. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
  35. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
  36. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
  37. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
  38. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
  39. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
  40. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
  41. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
  42. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
  43. package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
  44. package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
  45. package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
  46. package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
  47. package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
  48. package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
  49. package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
  50. package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
  51. package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
  52. package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
  53. package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
  54. package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
  55. package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
  56. package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
  57. package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
  58. package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
  59. package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
  60. package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
  61. package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
  62. package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
  63. package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
  64. package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
  65. package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
  66. package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
  67. package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
  68. package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
  69. package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
  70. package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
  71. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
  72. package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
  73. package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
  74. package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
  75. package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
  76. package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
  77. package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
  78. package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
  79. package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
  80. package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
  81. package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
  82. package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
  83. package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
  84. package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
  85. package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
  86. package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
  87. package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
  88. package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
  89. package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
  90. package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
  91. package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
  92. package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
  93. package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
  94. package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
  95. package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
  96. package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
  97. package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
  98. package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
  99. package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
  100. package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
  101. package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
  102. package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
  103. package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
  104. package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
  105. package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
  106. package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
  107. package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
  108. package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
  109. package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
  110. package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
  111. package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
  112. package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
  113. package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
  114. package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
  115. package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
  116. package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
  117. package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
  118. package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
  119. package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
  120. package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
  121. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
  122. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
  123. package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
  124. package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
  125. package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
  126. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
  127. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
  128. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
  129. package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
  130. package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
  131. package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
  132. package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
  133. package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
  134. package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
  135. package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
  136. package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
  137. package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
  138. package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
  139. package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
  140. package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
  141. package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
  142. package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
  143. package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
  144. package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
  145. package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
  146. package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
  147. package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
  148. package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
  149. package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
  150. package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
  151. package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
  152. package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
  153. package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
  154. package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
  155. package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
  156. package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
  157. package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
  158. package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
  159. package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
  160. package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
  161. package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
  162. package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
  163. package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
  164. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
  165. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
  166. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
  167. package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
  168. package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
  169. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
  170. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
  171. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
  172. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
  173. package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
  174. package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
  175. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
  176. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
  177. package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
  178. package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
  179. package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
  180. package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
  181. package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
  182. package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
  183. package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
  184. package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +103 -0
  185. package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
  186. package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
  187. package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
  188. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
  189. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
  190. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
  191. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
  192. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
  193. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
  194. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
  195. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
  196. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
  197. package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
  198. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
  199. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
  200. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
  201. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
  202. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
  203. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
  204. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
  205. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
  206. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
  207. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
  208. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
  209. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
  210. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
  211. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
  212. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
  213. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
  214. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
  215. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
  216. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
  217. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
  218. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
  219. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
  220. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
  221. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
  222. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
  223. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
  224. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
  225. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
  226. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
  227. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
  228. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
  229. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
  230. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
  231. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
  232. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
  233. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
  234. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
  235. package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
  236. package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
  237. package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
  238. package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
  239. package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
  240. package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
  241. package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
  242. package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
  243. package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
  244. package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
  245. package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
  246. package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
  247. package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
  248. package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
  249. package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
  250. package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
  251. package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
  252. package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
  253. package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
  254. package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
  255. package/dist-lib/numbl-core/jit/index.d.ts +15 -0
  256. package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
  257. package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
  258. package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
  259. package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
  260. package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
  261. package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
  262. package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
  263. package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
  264. package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
  265. package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
  266. package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
  267. package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
  268. package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
  269. package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
  270. package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
  271. package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
  272. package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
  273. package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
  274. package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
  275. package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
  276. package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
  277. package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
  278. package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
  279. package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
  280. package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
  281. package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
  282. package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
  283. package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
  284. package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
  285. package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
  286. package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
  287. package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
  288. package/dist-lib/numbl-core/jitTypes.d.ts +7 -321
  289. package/dist-lib/numbl-core/jsUserFunctions.d.ts +2 -2
  290. package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
  291. package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
  292. package/dist-lib/numbl-core/runtime/indexing.d.ts +11 -1
  293. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +28 -2
  294. package/dist-lib/numbl-core/runtime/runtime.d.ts +16 -1
  295. package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +5 -0
  296. package/dist-lib/numbl-core/runtime/types.d.ts +19 -3
  297. package/dist-lib/numbl-core/version.d.ts +1 -1
  298. package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
  299. package/dist-plot-viewer/assets/index-DfxsWeyf.js +4426 -0
  300. package/dist-plot-viewer/index.html +1 -1
  301. package/dist-site-viewer/404.html +33 -0
  302. package/dist-site-viewer/assets/index-C5c2lKAx.js +4748 -0
  303. package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
  304. package/dist-site-viewer/assets/numbl-worker-CkoM4MUa.js +11836 -0
  305. package/dist-site-viewer/coi-serviceworker.js +70 -0
  306. package/dist-site-viewer/favicon.svg +23 -0
  307. package/dist-site-viewer/index.html +16 -0
  308. package/dist-site-viewer/logo.svg +26 -0
  309. package/dist-site-viewer/numbl-embed.js +111 -0
  310. package/dist-site-viewer/vite.svg +1 -0
  311. package/native/ops/real_unary_elemwise.c +3 -1
  312. package/package.json +15 -9
  313. package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +0 -30
  314. package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +0 -59
  315. package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +0 -27
  316. package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +0 -42
  317. package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +0 -44
  318. package/dist-lib/numbl-core/executors/cJit/compile.d.ts +0 -45
  319. package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +0 -23
  320. package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +0 -33
  321. package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +0 -39
  322. package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +0 -16
  323. package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +0 -28
  324. package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +0 -32
  325. package/dist-lib/numbl-core/executors/cJit/register.d.ts +0 -10
  326. package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +0 -15
  327. package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +0 -25
  328. package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegen.d.ts +0 -7
  329. package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegenHoist.d.ts +0 -70
  330. package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +0 -67
  331. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpers.d.ts +0 -34
  332. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersComplex.d.ts +0 -21
  333. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +0 -33
  334. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersTensor.d.ts +0 -34
  335. package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +0 -59
  336. package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +0 -53
  337. package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +0 -44
  338. package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +0 -15
  339. package/dist-lib/numbl-core/executors/jsJit/lower/blockAnalysis.d.ts +0 -37
  340. package/dist-lib/numbl-core/executors/jsJit/lower/jitBailSafety.d.ts +0 -41
  341. package/dist-lib/numbl-core/executors/jsJit/lower/jitLower.d.ts +0 -136
  342. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerExpr.d.ts +0 -36
  343. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerStmt.d.ts +0 -9
  344. package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerTypes.d.ts +0 -29
  345. package/dist-lib/numbl-core/executors/jsJit/lower/scalarEmit.d.ts +0 -58
  346. package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +0 -120
  347. package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +0 -17
  348. package/dist-plot-viewer/assets/index-COAM8o1E.js +0 -4426
  349. /package/dist-lib/numbl-core/{executors/jsJit/helpers → runtime}/alloc.d.ts +0 -0
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Bracket-literal lowering: `[1 2 3]`, `[1; 2; 3]`, `[A B; C D]`, etc.
3
+ *
4
+ * Reached from `lowerExpr` whenever the AST node is a `Tensor`. The
5
+ * lowerer classifies every cell as scalar / tensor / empty, then takes
6
+ * one of three paths:
7
+ *
8
+ * - **All-scalar fast path** — every cell is a scalar; collapse to a
9
+ * single `TensorBuild` IR node with a column-major exact-data
10
+ * carrier when the result fits the cap.
11
+ * - **Singleton collapse** — `[v]` returns `v` unchanged (whether
12
+ * scalar or tensor), matching MATLAB.
13
+ * - **Concat path** — mixed scalar/tensor cells (or all-tensor
14
+ * cells), with per-row horzcat shape and an outer vertcat. Empty
15
+ * cells are dropped. Per-row width / per-cell height mismatches
16
+ * are caught statically when both sides are known; runtime-only
17
+ * axes trust the user (a future `mtoc2_check_concat_axis` could
18
+ * validate at runtime).
19
+ */
20
+ import type { Expr } from "../parser/index.js";
21
+ import type { IRExpr } from "./ir.js";
22
+ import type { Lowerer } from "./lower.js";
23
+ export declare function lowerTensorLit(this: Lowerer, e: Extract<Expr, {
24
+ type: "Tensor";
25
+ }>): IRExpr;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Compile-time range-element-count formula. Single source of truth for
3
+ * the `n = floor((end - start) / step + 1 + 1e-10)` formula used in
4
+ * three places: `lowerRangeAsValue` (range-as-value `1:n`), the
5
+ * `exactRangeCount` helper in `lowerIndexSlice.ts`, and the C-side
6
+ * `mtoc2_loop_count` runtime helper. All three must agree byte-for-
7
+ * byte so the statically-known shape, the runtime-allocated buffer
8
+ * length, and the for-loop iteration count match.
9
+ *
10
+ * The `+ 1e-10` cushion absorbs the IEEE-ulp underflow on ranges like
11
+ * `0:0.1:0.3` (where `(0.3-0)/0.1` evaluates to 2.99999... rather
12
+ * than 3.0) without affecting genuinely-non-integer quotients.
13
+ */
14
+ /** Compute the count of elements in a range `start : step : end`,
15
+ * given that every endpoint is a finite real number and `step` is
16
+ * non-zero. Returns 0 for empty ranges (e.g. `5:1:0`). The caller
17
+ * is responsible for checking finiteness and `step !== 0` before
18
+ * calling. */
19
+ export declare function rangeCountFromExactEnds(start: number, step: number, end: number): number;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * User-function specialization machinery.
3
+ *
4
+ * `specializeUserFunction` is the single chokepoint that turns a
5
+ * parsed `function` AST into an `IRFunc` against a specific arg-type
6
+ * tuple, with the spec cache keyed on `(file, argTypes, nargout)`.
7
+ * Every expression-context user-function call (bare-name, packaged
8
+ * `pkg.foo`, instance / static class methods, method-via-arg-type,
9
+ * handle dispatch) routes through `buildUserFunctionCall`, which
10
+ * calls `specializeUserFunction` for the spec lookup and synthesizes
11
+ * the matching `Call` IR node.
12
+ *
13
+ * Lives in its own module so the new user-defined `.js` function
14
+ * feature has a clear integration surface: a sidecar can either
15
+ * register a builtin (which doesn't need this path at all) or
16
+ * synthesize a `decl: FuncStmt` and reuse the existing spec discipline.
17
+ */
18
+ import type { Stmt } from "../parser/index.js";
19
+ import type { Span } from "../parser/index.js";
20
+ import type { IRExpr, IRFunc } from "./ir.js";
21
+ import { type Type } from "./types.js";
22
+ import type { Lowerer } from "./lower.js";
23
+ type FuncStmt = Extract<Stmt, {
24
+ type: "Function";
25
+ }>;
26
+ /** Build a single-output `Call` IR node against a user-function AST,
27
+ * specializing the body on the arg-type tuple. Single chokepoint for
28
+ * every expression-context user-function call: bare-name calls,
29
+ * packaged (`pkg.foo`) calls, instance / static class methods,
30
+ * method-call-via-arg-type, and handle dispatch. Each caller is
31
+ * still responsible for the verdict-specific bookkeeping (resolver
32
+ * routing, prepending the receiver to args for instance methods,
33
+ * rejecting >=2-output methods if its dispatch path doesn't yet
34
+ * support truncation, …) — but the spec lookup + output-type
35
+ * derivation + IR construction is uniform here.
36
+ *
37
+ * For 0-output declarations the resulting `Call` has `ty = VOID`,
38
+ * which the caller (`lowerExprStmt`) must accept as bare-statement
39
+ * use only. For >=1-output declarations the spec truncates to
40
+ * nargout=1 and the result type is the (possibly Unknown if the
41
+ * body didn't assign the output) first declared output.
42
+ *
43
+ * The N≥2-output path uses a separate `MultiAssignCall` IR node
44
+ * built by `lowerMultiAssign` — this helper is single-output only. */
45
+ export declare function buildUserFunctionCall(this: Lowerer, decl: FuncStmt, callArgs: IRExpr[], callName: string, span: Span, opts?: {
46
+ specSource?: string;
47
+ definingFile?: string;
48
+ }): IRExpr;
49
+ /** Specialize a user function (or method, or anonymous-function
50
+ * synth) on the given arg-type tuple. The C mangling salts by the
51
+ * defining file so two files defining a same-named subfunction get
52
+ * distinct mangled names.
53
+ *
54
+ * Caller is responsible for passing `definingFile` — for top-level
55
+ * functions resolved through the workspace, that's the resolver's
56
+ * verdict file; for class methods it's the class's file; for
57
+ * anonymous-function synth ASTs it's the file where `@(...)` was
58
+ * written. */
59
+ export declare function specializeUserFunction(this: Lowerer, decl: FuncStmt, argTypes: Type[],
60
+ /** Optional override for the specialization-key source-name half.
61
+ * Class methods pass `<className>__<methodName>` so the mangled C
62
+ * name disambiguates two methods of the same source-level name
63
+ * on different classes. Defaults to `decl.name`. */
64
+ specSource?: string,
65
+ /** File the function definition lives in. Salts the spec key so
66
+ * cross-file homonyms get distinct C names. Defaults to the
67
+ * function's source span's file. */
68
+ definingFile?: string,
69
+ /** When set, the named output gets a synthetic first assignment to
70
+ * `initExpr` (an already-lowered IR expression) prepended to the
71
+ * body. The user's constructor body then sees the receiver
72
+ * initialized with the class defaults. */
73
+ preSeedOutput?: {
74
+ name: string;
75
+ ty: Type;
76
+ initExpr: IRExpr;
77
+ },
78
+ /** Per-call-site `nargout`: the number of outputs the caller
79
+ * requested. Salts the spec key so two callers requesting
80
+ * different output counts get distinct specializations. Defaults
81
+ * to `decl.outputs.length` (the declared count) when the caller
82
+ * can't supply a more specific value (e.g. cross-file resolver
83
+ * paths that don't yet thread this through). Inside the body, the
84
+ * `nargout` identifier folds to this value via the
85
+ * `callFrameStack`. */
86
+ nargout?: number,
87
+ /** Span of the call site, used to attribute arity / output-
88
+ * assignment errors. Defaults to `decl.span` (the function
89
+ * definition) when omitted — but every translation-time call site
90
+ * should supply its own span so the user sees the bad call, not
91
+ * the definition. */
92
+ callSiteSpan?: Span): IRFunc;
93
+ export {};
@@ -0,0 +1,503 @@
1
+ /**
2
+ * mtoc2 type system. Built from scratch — not derived from numbl's
3
+ * JitType. Designed to be the long-term home for static type info,
4
+ * with "exact known value" tracking as a first-class feature on
5
+ * every scalar (and eventually small arrays).
6
+ *
7
+ * MVP scope: scalar real double only. The full Type union and the
8
+ * NumericType field layout already accommodate growth (complex,
9
+ * arrays, strings, logicals, structs, classes) but the lowerer and
10
+ * codegen reject anything outside scope with UnsupportedConstruct.
11
+ */
12
+ import type { Span, Stmt } from "../parser/index.js";
13
+ type FunctionStmt = Extract<Stmt, {
14
+ type: "Function";
15
+ }>;
16
+ export type Sign = "positive" | "nonneg" | "negative" | "nonpositive" | "zero" | "nonzero" | "unknown";
17
+ export declare function signFromNumber(v: number): Sign;
18
+ /** Derive the sign of a tensor from its exact data. Returns the
19
+ * tightest lattice state that holds across every element:
20
+ * - all `>0` → `positive`
21
+ * - all `<0` → `negative`
22
+ * - all `===0` → `zero`
23
+ * - mix of `>0` and `==0` → `nonneg`
24
+ * - mix of `<0` and `==0` → `nonpositive`
25
+ * - mix of `>0` and `<0` (no zeros) → `nonzero`
26
+ * - any NaN, or mix of all three (positives, negatives, zeros) → `unknown`.
27
+ *
28
+ * Empty data returns `unknown` (no elements to constrain). */
29
+ export declare function signFromExactArray(data: Float64Array): Sign;
30
+ export declare function unifySign(a: Sign, b: Sign): Sign;
31
+ export declare function flipSign(s: Sign): Sign;
32
+ /** Per-axis dimension knowledge. Either the exact non-negative integer
33
+ * size is known, or we have no info. There's no separate ">1" lattice
34
+ * state — call sites that previously cared about "definitely > 1"
35
+ * now check `d.kind === "exact" && d.value !== 1` (or `value > 1`,
36
+ * depending on whether a zero-sized axis should count).
37
+ * When all entries in a `dims` array are `exact`, the surrounding
38
+ * `NumericType.shape` is also set; the two views never disagree. */
39
+ export type DimInfo = {
40
+ kind: "exact";
41
+ value: number;
42
+ } | {
43
+ kind: "unknown";
44
+ };
45
+ export declare const DIM_ONE: DimInfo;
46
+ /** Convenience: does this `DimInfo` statically pin the axis to 1? */
47
+ export declare function isDimOne(d: DimInfo): boolean;
48
+ /** Product of every entry in `shape` — i.e. `numel` for a tensor with
49
+ * this concrete shape. Returns 1 for an empty shape array (a 0-D
50
+ * scalar in MATLAB terms; mtoc2 always pads to 2-D so this is rare
51
+ * but well-defined). */
52
+ export declare function shapeNumel(shape: ReadonlyArray<number>): number;
53
+ /** Cap for how big an "exact array" we'll propagate through the type
54
+ * system. Anything larger drops to non-exact. */
55
+ export declare const EXACT_ARRAY_MAX_ELEMENTS = 256;
56
+ /** Max rank for `mtoc2_tensor_t`. Mirror of `MTOC2_MAX_NDIM` in
57
+ * `src/codegen/runtime/tensor.h` — kept in lockstep with the runtime
58
+ * helpers that allocate per-axis stride/index buffers on the stack. */
59
+ export declare const MTOC2_MAX_NDIM = 8;
60
+ /** Exact-value variants.
61
+ * - `number`: scalar real.
62
+ * - `{re,im}`: scalar complex.
63
+ * - `Float64Array`: dense real array, column-major (matches numbl's
64
+ * `RuntimeTensor.data`). Shape is carried by `dims` on `NumericType`.
65
+ * - `{re: Float64Array; im: Float64Array}`: dense complex array,
66
+ * column-major split-buffer (mirrors the runtime layout). */
67
+ export type NumericExact = number | {
68
+ re: number;
69
+ im: number;
70
+ } | Float64Array | {
71
+ re: Float64Array;
72
+ im: Float64Array;
73
+ };
74
+ export type NumericElem = "double" | "logical" | "char";
75
+ export interface NumericType {
76
+ kind: "Numeric";
77
+ elem: NumericElem;
78
+ isComplex: boolean;
79
+ /** Per-axis dim info: each axis is either `{exact, value}` or
80
+ * `unknown`. Always present. Length 2 for scalars
81
+ * (`[{exact,1},{exact,1}]`); same length as `shape` when `shape`
82
+ * is set. */
83
+ dims: DimInfo[];
84
+ /** Statically-known integer shape, when available (always set when
85
+ * every entry in `dims` is `exact`; mirrors those values).
86
+ * `shape[i]` equals `dims[i].value` for every axis. */
87
+ shape?: number[];
88
+ sign: Sign;
89
+ exact?: NumericExact;
90
+ }
91
+ /** Scalar string handle — the double-quoted (`"foo"`) text type.
92
+ * `length("foo") == 1` (numbl treats it as a single value, not a
93
+ * byte array). Backed by `mtoc2_string_t` in emitted C; participates
94
+ * in the standard owned-value lifecycle (empty/assign/copy/free).
95
+ * `exact` carries the literal value when the source is a `"..."`
96
+ * expression. */
97
+ export interface StringType {
98
+ kind: "String";
99
+ exact?: string;
100
+ }
101
+ /** 1×N row-vector of bytes — the single-quoted (`'foo'`) char-array
102
+ * type. `length('foo') == 3` (numbl exposes the byte count). Backed
103
+ * by `mtoc2_char_tensor_t` in emitted C; same owned-value lifecycle
104
+ * as `String`. Multi-row chars aren't constructable in v1, so the
105
+ * type doesn't carry a shape — `exact.length` is the column count.
106
+ * `exact` carries the literal value when the source is a `'...'`
107
+ * expression. */
108
+ export interface CharType {
109
+ kind: "Char";
110
+ exact?: string;
111
+ }
112
+ export interface UnknownType {
113
+ kind: "Unknown";
114
+ }
115
+ /** One captured variable in a `HandleType`. The `name` is both the
116
+ * enclosing-scope identifier the @-site snapshot reads from AND the
117
+ * synthesized function's tail-param name; the `ty` is the captured
118
+ * value's type at the @-site. Captures of owned types (tensors,
119
+ * structs, classes, other handles) are deep-copied into the handle's
120
+ * C struct at the `@(...)` site, matching MATLAB by-value capture
121
+ * semantics; the handle's per-shape `_free` helper releases each
122
+ * owned field at scope exit. */
123
+ export interface HandleCapture {
124
+ name: string;
125
+ ty: Type;
126
+ }
127
+ /** Function handle. mtoc2 supports only user-function targets
128
+ * (named `@user_func` and anonymous `@(p1,...,pN) <body>`); `@builtin`
129
+ * is rejected. Captures may be any non-Void / non-Unknown / non-String
130
+ * value type — scalar real numeric, tensor, struct, class instance, or
131
+ * another handle. The handle's C representation is a per-capture-shape
132
+ * typedef with `_empty / _copy / _assign / _free` helpers, matching
133
+ * the struct/class owned-value lifecycle. */
134
+ export interface HandleType {
135
+ kind: "Handle";
136
+ /** Source-level identifier for the target function. For named
137
+ * handles, this is the user's name (e.g. `sq`); for anonymous
138
+ * handles, the synthesized name (e.g. `anon_0`). Used as the
139
+ * source-name half of the specialization mangling. */
140
+ targetName: string;
141
+ /** Synthesized or pre-scanned `Function` AST handed to
142
+ * `specializeUserFunction` at every call site. The params list
143
+ * contains `[...userParams, ...captureNames]` (in that order); the
144
+ * body's references to a captured variable resolve naturally to the
145
+ * matching synthesized tail param. */
146
+ ast: FunctionStmt;
147
+ /** Variables captured from the enclosing scope at the `@(...)` site.
148
+ * Empty for named handles and for capture-free anonymous functions.
149
+ * Field order matches the synth function's tail params. */
150
+ captures: ReadonlyArray<HandleCapture>;
151
+ }
152
+ /** "No value" — the type of a call to a user function with zero
153
+ * outputs. Valid only as the expression type of an `ExprStmt`. Every
154
+ * other lowering site (Assign RHS, sub-expression of a Binary / Unary
155
+ * / Call, tensor-literal element, if/while cond, for bounds) rejects
156
+ * Void with `UnsupportedConstruct`. */
157
+ export interface VoidType {
158
+ kind: "Void";
159
+ }
160
+ /** A struct value. Field order is canonical (sorted by name) so two
161
+ * StructType values with the same shape are structurally identical
162
+ * regardless of source-level field-write order. Construct via
163
+ * `structType()` rather than the raw interface so the sort is
164
+ * applied. */
165
+ export interface StructType {
166
+ kind: "Struct";
167
+ fields: ReadonlyArray<{
168
+ name: string;
169
+ ty: Type;
170
+ }>;
171
+ }
172
+ /** A class instance value. The `className` is the source-level class
173
+ * name (the `classdef Foo` identifier); `properties` is the full
174
+ * flattened-and-sorted property list with each property's type
175
+ * derived from its `properties` block default expression. v1
176
+ * forbids inheritance, so the property list is always exactly the
177
+ * one declared in the class body. */
178
+ export interface ClassType {
179
+ kind: "Class";
180
+ className: string;
181
+ properties: ReadonlyArray<{
182
+ name: string;
183
+ ty: Type;
184
+ }>;
185
+ }
186
+ /** Cell array. Two modes:
187
+ * - **tuple**: per-slot types, used when the cell's shape is exact
188
+ * AND the total slot count fits `EXACT_ARRAY_MAX_ELEMENTS`. Cell
189
+ * literals `{a, b, c}` and small `cell(n, m)` constructors land
190
+ * here. `elements.length === shape product`; slot k is the
191
+ * column-major-flat index. Each `elements[k]` is the *static*
192
+ * type of slot k.
193
+ * - **uniform**: a single `elem` type covers every slot. Used for
194
+ * `cell(n, m)` with a non-exact dim or a slot count above the
195
+ * cap, and for tuple cells that "demote" on a non-static-index
196
+ * write whose existing slot types all unify with the rhs type.
197
+ *
198
+ * Cells have no LUB / heterogeneous mode. When neither tuple nor
199
+ * uniform applies (a non-static-index write into a tuple whose
200
+ * slot types don't all unify with the rhs), the lowerer raises
201
+ * `UnsupportedConstruct`. */
202
+ export interface CellType {
203
+ kind: "Cell";
204
+ mode: "tuple" | "uniform";
205
+ dims: DimInfo[];
206
+ shape?: number[];
207
+ /** Tuple-mode only: per-slot types in column-major order. */
208
+ elements?: Type[];
209
+ /** Uniform-mode only: every slot has this type. */
210
+ elem?: Type;
211
+ }
212
+ export type Type = NumericType | StringType | CharType | UnknownType | VoidType | HandleType | StructType | ClassType | CellType;
213
+ export declare const VOID: VoidType;
214
+ export declare function scalarDouble(sign?: Sign, exact?: number): NumericType;
215
+ /** Scalar complex double. Sign is always `unknown` for complex values
216
+ * — the sign lattice describes ordering on the real line, which has
217
+ * no analogue for complex numbers. When `exact` is provided, both
218
+ * `re` and `im` must be finite. */
219
+ export declare function scalarComplex(exact?: {
220
+ re: number;
221
+ im: number;
222
+ }): NumericType;
223
+ export declare function scalarLogical(exact?: boolean): NumericType;
224
+ /** Real-double tensor built from a per-axis `dims` lattice. Used by
225
+ * slice-read result typing when the slot pattern leaves at least one
226
+ * axis with a runtime-only length (an `unknown` `DimInfo`). When every
227
+ * dim turns out to be `exact`, this function also populates `shape`
228
+ * so downstream code can take the concrete-shape paths uniformly.
229
+ *
230
+ * Trailing singletons in `dims` are stripped subject to a 2-axis
231
+ * minimum, matching numbl's tensor shape-normalization rule. */
232
+ export declare function tensorDoubleFromDims(dims: DimInfo[]): NumericType;
233
+ /** Real-double tensor with statically-known shape. `dims` is derived
234
+ * from `shape` (`{kind:"exact", value: s}` per axis). When `exact` is
235
+ * provided, its length must equal the shape's product; the layout is
236
+ * column-major (matching numbl's `RuntimeTensor.data`).
237
+ *
238
+ * When `exact` is provided, `sign` is derived from the actual values
239
+ * via `signFromExactArray`. This is what lets `sqrt([0 1 4 9])` pass
240
+ * the requireDomain check (without it the tensor would carry
241
+ * `sign:"unknown"`). For tensors without exact data the caller can
242
+ * set `sign` post-construction (e.g. `zeros`/`ones` know their fill
243
+ * value even when the result is too large to carry exact data). */
244
+ export declare function tensorDouble(shape: number[], exact?: Float64Array): NumericType;
245
+ /** Complex-double tensor with statically-known shape. Mirrors
246
+ * `tensorDouble` but the result type carries `isComplex: true` and
247
+ * the optional `exact` is the split-buffer carrier whose `re` /
248
+ * `im` Float64Arrays each match the shape product. Sign is always
249
+ * `"unknown"` for complex (the lattice describes ordering on the
250
+ * real line; complex numbers have no analogue). */
251
+ export declare function tensorComplex(shape: number[], exact?: {
252
+ re: Float64Array;
253
+ im: Float64Array;
254
+ }): NumericType;
255
+ /** Complex-double tensor built from a per-axis `dims` lattice. Sibling
256
+ * of `tensorDoubleFromDims` for slice-read result typing when at
257
+ * least one axis is runtime-only. */
258
+ export declare function tensorComplexFromDims(dims: DimInfo[]): NumericType;
259
+ export declare const UNKNOWN: UnknownType;
260
+ /** Constructor for a `@<user_func>` handle (named or anonymous). */
261
+ export declare function handleType(targetName: string, ast: FunctionStmt, captures?: ReadonlyArray<HandleCapture>): HandleType;
262
+ /** Construct a `StructType`, preserving the given field order.
263
+ *
264
+ * Field order is OBSERVABLE in MATLAB — disp, `fieldnames`, and
265
+ * `struct2cell` all report insertion order — so we must NOT sort:
266
+ * sorting made the JIT display fields alphabetically while the
267
+ * interpreter (and MATLAB) keep insertion order. The C typedef layout
268
+ * and the JS struct object both follow this `fields` order, so keeping
269
+ * insertion order aligns storage and display. The cost is that two
270
+ * structs built with the same names in different orders no longer share
271
+ * a typedef (they're distinct field orders, exactly as in MATLAB). */
272
+ export declare function structType(fields: ReadonlyArray<{
273
+ name: string;
274
+ ty: Type;
275
+ }>): StructType;
276
+ /** Construct a `ClassType` with canonical (sorted-by-name) property
277
+ * order. */
278
+ export declare function classType(className: string, properties: ReadonlyArray<{
279
+ name: string;
280
+ ty: Type;
281
+ }>): ClassType;
282
+ /** Construct a tuple-mode `CellType`. The caller must provide a fully
283
+ * exact shape (every entry in `dims` is `exact`) and an `elements`
284
+ * array whose length equals the shape product. */
285
+ export declare function cellTuple(shape: number[], elements: Type[]): CellType;
286
+ /** Construct a uniform-mode `CellType`. Used when the cell's slot
287
+ * count exceeds `EXACT_ARRAY_MAX_ELEMENTS`, when a dim is non-exact,
288
+ * or when a tuple cell demotes after a non-static-index write. */
289
+ export declare function cellUniform(dims: DimInfo[], elem: Type): CellType;
290
+ /** The canonical "empty `[]` double tensor" slot type — what numbl
291
+ * initialises every fresh slot in `cell(n, m)` to
292
+ * (see `numbl/.../type-constructors.ts:442-469`). Shape is `[0, 0]`,
293
+ * no exact data, sign unknown. Mtoc2 reuses this exact representation
294
+ * so cross-runner displays of an unwritten slot match byte-for-byte. */
295
+ export declare function emptyDoubleTensorType(): NumericType;
296
+ export declare function isNumeric(t: Type): t is NumericType;
297
+ export declare function isVoid(t: Type): t is VoidType;
298
+ export declare function isHandle(t: Type): t is HandleType;
299
+ export declare function isStruct(t: Type): t is StructType;
300
+ export declare function isClass(t: Type): t is ClassType;
301
+ export declare function isString(t: Type): t is StringType;
302
+ export declare function isChar(t: Type): t is CharType;
303
+ export declare function isCell(t: Type): t is CellType;
304
+ /** True when `t` can be consumed by a "text-accepting" runtime helper
305
+ * via `mtoc2_text_view_t` — today: a `String` handle or a `Char` array.
306
+ * The shared predicate lets builtins like `disp` / future
307
+ * `error` / `fprintf` accept either source kind. */
308
+ export declare function isText(t: Type): boolean;
309
+ /** Find a field on a struct/class by name. Returns the field's type
310
+ * or undefined if the type isn't a struct/class or no such field
311
+ * exists. */
312
+ export declare function fieldType(t: Type, name: string): Type | undefined;
313
+ export declare function isScalar(t: Type): boolean;
314
+ export declare function isScalarRealDouble(t: Type): boolean;
315
+ /** Scalar real numeric: double or logical. Both are stored as `double`
316
+ * in emitted C, so anything operating on real values accepts either. */
317
+ export declare function isScalarRealNumeric(t: Type): boolean;
318
+ /** True when any axis is statically known to be ≠ 1 (or unknown).
319
+ * Drives the scalar/tensor split in codegen: scalars compile to bare
320
+ * `double`; multi-element values compile to `mtoc2_tensor_t`. A
321
+ * zero-sized axis (`{exact, 0}`) also returns true — an empty tensor
322
+ * still needs tensor storage. */
323
+ export declare function isMultiElement(t: Type): boolean;
324
+ /** Row-vector shape: 2-D with a singleton first axis and an exact
325
+ * non-singleton second axis. Matches MATLAB's "row" classification:
326
+ * 1×0 (empty row) qualifies, 1×1 (scalar) does not. */
327
+ export declare function isRowVecTy(t: NumericType): boolean;
328
+ /** Column-vector shape: 2-D with an exact non-singleton first axis and
329
+ * a singleton second axis. Matches MATLAB's "column" classification:
330
+ * 0×1 (empty column) qualifies, 1×1 (scalar) does not. */
331
+ export declare function isColVecTy(t: NumericType): boolean;
332
+ /** Statically provable to contain at least one element. True iff every
333
+ * dim is `exact` with a positive value (equivalently, when `shape` is
334
+ * set, every entry is > 0). Used by reductions to decide whether the
335
+ * empty-input edge case (sum→0, prod→1, min/max→NaN, mean→NaN) is
336
+ * reachable; tighter sign rules apply only on the provably-non-empty
337
+ * branch. */
338
+ export declare function provablyNonEmpty(t: NumericType): boolean;
339
+ /** Owned-heap-value types — i.e. types whose C representation holds a
340
+ * heap pointer the codegen must `free` at scope exit. Multi-element
341
+ * tensors are the original owned kind. Structs, class instances, and
342
+ * function handles all count as owned because their per-shape generated
343
+ * typedef carries the same `_empty()`/`_assign()`/`_copy()`/`_free()`
344
+ * lifecycle — a struct or handle with all-scalar fields would
345
+ * technically be POD, but tracking ownership uniformly keeps the
346
+ * codegen pipeline simple and lets struct fields and handle captures
347
+ * hold tensors transparently. */
348
+ export declare function isOwned(t: Type): boolean;
349
+ /** Types that may appear in an N≥2-output multi-assign slot. Scalar
350
+ * real numeric outputs are stored by `*_mtoc2_o<i> = <local>` struct-
351
+ * copy; owned outputs (tensor, struct, class instance, function
352
+ * handle, Char, String) use the kind's `_assign` helper to transfer
353
+ * ownership of the buffer pointer. Only Void / Unknown stay rejected. */
354
+ export declare function isMultiOutputSlotType(t: Type): boolean;
355
+ export declare function signIsNonneg(s: Sign): boolean;
356
+ export declare function signIsPositive(s: Sign): boolean;
357
+ export declare function numericExactsEqual(a: NumericExact | undefined, b: NumericExact | undefined): boolean;
358
+ /** Widen every entry in `env` whose name is in `names` before lowering
359
+ * a loop body. Used by `lowerFor` / `lowerWhile` — see lower.ts for
360
+ * rationale. Strips `exact` (the one-pass lowerer can't carry exact
361
+ * values across iterations) AND widens narrowing fields like `sign`
362
+ * to `"unknown"`, since a `sign: "nonneg"` set before the loop is no
363
+ * longer valid if the body reassigns the variable to a negative value.
364
+ * Without the sign widen, `sqrt(x)` / `log(x)` domain checks would
365
+ * spuriously pass at lowering time and produce NaN at runtime. For
366
+ * struct / class env entries we recurse via `withoutExact` so any
367
+ * precise field/property exact values introduced by a `struct(...)`
368
+ * literal or a constructor preSeed don't leak from iteration 1 into
369
+ * the rest of the loop's body. */
370
+ export declare function stripExactFromEnv(env: Map<string, {
371
+ cName: string;
372
+ ty: Type;
373
+ }>, names: Iterable<string>): void;
374
+ /** Drop `exact` and widen `sign` toward the rhs sign on the named
375
+ * entry. Called after an indexed write (`x(i) = rhs`, `x(:) = rhs`, …)
376
+ * where the rhs is general enough that we can't carry the pre-write
377
+ * sign forward unchanged.
378
+ *
379
+ * Without this, e.g. `x = zeros(1, 5); x(3) = -10; sqrt(x)` would slip
380
+ * past `sqrt`'s `requireDomain` check because the env still claims
381
+ * `sign = nonneg`. We use `unifySign(current, rhsSign)` so a same-sign
382
+ * rhs (e.g. `x(3) = 4` after `zeros(...)`) doesn't unnecessarily
383
+ * collapse the lattice — the new sign covers both the surviving
384
+ * pre-write elements and the just-written one.
385
+ *
386
+ * `rhsSign` defaults to `"unknown"` for callers that don't have a
387
+ * rhs to inspect (slice writes from an opaque source, etc.). */
388
+ export declare function widenAfterIndexedWrite(env: Map<string, {
389
+ cName: string;
390
+ ty: Type;
391
+ }>, name: string, rhsSign?: Sign): void;
392
+ /** Return a copy of `t` with the type at `fieldPath` replaced by
393
+ * `newLeafTy`. Walks struct/class types; if the path can't be
394
+ * resolved (shouldn't happen — the caller already validated), the
395
+ * original type is returned unchanged. Other type kinds at a path
396
+ * step are returned as-is.
397
+ *
398
+ * Used by the env refresh after a MemberStore / member-rooted
399
+ * IndexStore so subsequent reads of the touched field report the
400
+ * post-write rhs type rather than the construction-site default. */
401
+ export declare function withPathTypeUpdated(t: Type, fieldPath: ReadonlyArray<string>, newLeafTy: Type): Type;
402
+ /** Companion to `widenAfterIndexedWrite` for member-rooted indexed
403
+ * writes (`obj.field(i) = rhs`). Strips `exact` and widens the
404
+ * leaf field's `sign` to `"unknown"`, then rebuilds the parent
405
+ * struct/class type via `withPathTypeUpdated`. The optimisation of
406
+ * refreshing the leaf's exact carrier in place (the way bare-Ident
407
+ * writes do) is deferred — see `tryRefreshExactAfterIndexedWrite`. */
408
+ export declare function widenMemberLeafAfterIndexedWrite(env: Map<string, {
409
+ cName: string;
410
+ ty: Type;
411
+ }>, rootName: string, fieldPath: ReadonlyArray<string>, oldLeafTy: NumericType): void;
412
+ export declare function withoutExact(t: Type): Type;
413
+ /** Merge two types at a join point. Drops exact unless both sides agree.
414
+ * Sign widens via `unifySign`. For MVP, both sides should be scalar real
415
+ * double — mismatches return `UNKNOWN`. */
416
+ export declare function unify(a: Type, b: Type): Type;
417
+ /** Demote a tuple-mode cell to uniform mode if every slot type
418
+ * unifies. Returns undefined if the cell is already uniform (no
419
+ * work) or if the demotion isn't possible (heterogeneous slot
420
+ * types). Used inside `unify` and at non-static-index writes. */
421
+ export declare function cellWidenToUniform(t: CellType): CellType | undefined;
422
+ export declare function typeToString(t: Type): string;
423
+ /** Stable string key used for the specialization-key hash. Includes
424
+ * exact when set, so each unique exact-value gets its own spec. */
425
+ export declare function canonicalizeType(t: Type): string;
426
+ /** True iff two types have the same canonical form. Convenience
427
+ * wrapper around `canonicalizeType` for callers that don't need the
428
+ * string key. */
429
+ export declare function canonicalEq(a: Type, b: Type): boolean;
430
+ /** Storage compatibility: do two types occupy the same C-level slot?
431
+ * This is COARSER than canonical equality — every multi-element
432
+ * tensor shares the same `mtoc2_tensor_t` storage regardless of
433
+ * shape, every scalar real numeric maps to `double`, and every
434
+ * struct/class needs its canonical typedef to match.
435
+ *
436
+ * Used by `MemberStore` to validate that a write doesn't try to
437
+ * cram a tensor into a scalar slot (or vice versa) — the typedef
438
+ * hash is built from storage shapes, so changing the underlying
439
+ * representation would break the C side. Shape, sign, and exact
440
+ * differences are fine: the slot still holds an `mtoc2_tensor_t`. */
441
+ export declare function storageEquivalent(a: Type, b: Type): boolean;
442
+ /** FNV-1a 32-bit; matches the mangling scheme used in current mtoc. */
443
+ export declare function hashType(s: string): string;
444
+ export declare function specializationKey(argTypes: Type[]): string;
445
+ /** Mangled C typedef name for a handle's capture shape. All no-capture
446
+ * handles share `mtoc2_handle_empty_t` regardless of target identity
447
+ * (the function dispatch is static — the struct is just a carrier).
448
+ * Handles with captures get a per-shape `mtoc2_handle__<8hex>` typedef
449
+ * whose hash covers the `(name, cFieldTypeStr)` tuple of each capture
450
+ * in order. Matches the struct/class precedent: the typedef hash sees
451
+ * only the C-level type of each capture, so two handle types that
452
+ * differ only in lattice precision (sign, exact, tensor shape) share
453
+ * one typedef and one set of owned-helpers. */
454
+ export declare function handleTypedefName(t: HandleType): string;
455
+ /** C-level type string for a struct/class field or function-handle
456
+ * capture. This is the load-bearing identity for typedef hashing:
457
+ * the typedef hash depends only on `cFieldTypeStr` per field, so
458
+ * two structs whose internal field types differ only in lattice
459
+ * precision (sign, exact, tensor shape) collapse to the SAME C
460
+ * typedef. The internal `StructType.fields[*].ty` is free to keep
461
+ * full precision — that precision drives function specialization
462
+ * keys and builtin transfer functions but does NOT shard the C
463
+ * typedef.
464
+ *
465
+ * - Scalar real numeric (any sign/exact) → "double"
466
+ * - Multi-element tensor (any shape/exact) → "mtoc2_tensor_t"
467
+ * - Handle → handleTypedefName(t)
468
+ * - Struct (recurse on fields) → structTypedefName(t)
469
+ * - Class (recurse on properties) → classTypedefName(t)
470
+ *
471
+ * String / Void / Unknown are not valid struct/class field types
472
+ * in v1 — the lowerer rejects them at construction sites. */
473
+ export declare function cFieldTypeStr(t: Type): string;
474
+ /** Mangled C typedef name for a struct's shape. Keyed only on the
475
+ * C-level type of each field (`cFieldTypeStr`), so two struct
476
+ * values whose fields' internal types differ only in lattice
477
+ * precision share one typedef. The internal `StructType.fields[*].ty`
478
+ * is still carried at full precision for spec keying + transfer-fn
479
+ * use — but it's separate from the typedef identity. */
480
+ export declare function structTypedefName(t: StructType): string;
481
+ /** Replace every non-C-identifier character (`[^A-Za-z0-9_]`) with `_`.
482
+ * Used to make `<name>__<hex>` mangled names always valid C identifiers
483
+ * when the source carries class/path-like characters (e.g. `pkg.foo`,
484
+ * `MyClass.method`). v1 class names are typically already C-safe, so
485
+ * this is a passthrough for those. */
486
+ export declare function sanitizeCIdent(s: string): string;
487
+ /** Mangled C typedef name for a class instance. Same C-level
488
+ * contract as `structTypedefName` — the hash sees only the C-level
489
+ * type of each property — but salted with `className` so two
490
+ * distinct classes with the same C-level property shape still pick
491
+ * distinct typedefs. */
492
+ export declare function classTypedefName(t: ClassType): string;
493
+ /** Mangled C typedef name for a cell shape. The hash sees the cell's
494
+ * mode, dim shape (with `?` for non-exact axes), and either the
495
+ * list of per-slot `cFieldTypeStr` values (tuple) or the elem
496
+ * `cFieldTypeStr` (uniform). Two cell types whose internal types
497
+ * differ only in lattice precision (sign, exact, tensor shape)
498
+ * share one typedef. */
499
+ export declare function cellTypedefName(t: CellType): string;
500
+ /** Class-method specialization-name source. Becomes the input to
501
+ * `mangleClassMethodName` along with arg-type canonicalization. */
502
+ export declare function classMethodSpecSource(className: string, methodName: string): string;
503
+ export type { Span };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * IR walking helpers — read-only traversal of expression trees and
3
+ * the top-level expressions inside a statement. Used by the liveness
4
+ * analyzer (and any future IR-walking pass) to enumerate sub-
5
+ * expressions without each call site re-discriminating on `IRExpr`
6
+ * kinds.
7
+ */
8
+ import type { IRExpr, IRStmt } from "./ir.js";
9
+ /** Visit every sub-expression of `e`, including `e` itself. Walks
10
+ * pre-order: the outer node is visited first, then children. Pure
11
+ * read-only — `visit` should not mutate the IR. */
12
+ export declare function forEachSubExpr(e: IRExpr, visit: (sub: IRExpr) => void): void;
13
+ /** Visit every top-level expression in `s` (the expressions that
14
+ * live directly under the statement node — NOT recursing into
15
+ * nested control-flow bodies). The visitor can then call
16
+ * `forEachSubExpr` to walk into each. */
17
+ export declare function forEachTopLevelExpr(s: IRStmt, visit: (e: IRExpr) => void): void;