numbl 0.1.0 → 0.1.2

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 (209) hide show
  1. package/README.md +1 -1
  2. package/dist-cli/cli.js +7277 -3344
  3. package/dist-lib/graphics/types.d.ts +262 -0
  4. package/dist-lib/lib.d.ts +19 -0
  5. package/dist-lib/lib.js +53709 -0
  6. package/dist-lib/numbl-core/diagnostics/errors.d.ts +8 -0
  7. package/dist-lib/numbl-core/diagnostics/index.d.ts +27 -0
  8. package/dist-lib/numbl-core/executeCode.d.ts +70 -0
  9. package/dist-lib/numbl-core/externalAccessDirective.d.ts +6 -0
  10. package/dist-lib/numbl-core/fileIOAdapter.d.ts +61 -0
  11. package/dist-lib/numbl-core/functionResolve.d.ts +59 -0
  12. package/dist-lib/numbl-core/helpers/arithmetic.d.ts +47 -0
  13. package/dist-lib/numbl-core/helpers/bessel.d.ts +40 -0
  14. package/dist-lib/numbl-core/helpers/check-helpers.d.ts +50 -0
  15. package/dist-lib/numbl-core/helpers/constants.d.ts +6 -0
  16. package/dist-lib/numbl-core/helpers/dummy.d.ts +5 -0
  17. package/dist-lib/numbl-core/helpers/erf.d.ts +5 -0
  18. package/dist-lib/numbl-core/helpers/linsolve.d.ts +26 -0
  19. package/dist-lib/numbl-core/helpers/ode-rk.d.ts +83 -0
  20. package/dist-lib/numbl-core/helpers/prng.d.ts +17 -0
  21. package/dist-lib/numbl-core/helpers/reduction/cumulative.d.ts +8 -0
  22. package/dist-lib/numbl-core/helpers/reduction/min-max.d.ts +5 -0
  23. package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +58 -0
  24. package/dist-lib/numbl-core/helpers/registry.d.ts +7 -0
  25. package/dist-lib/numbl-core/helpers/shape-utils.d.ts +7 -0
  26. package/dist-lib/numbl-core/helpers/sparse-arithmetic.d.ts +16 -0
  27. package/dist-lib/numbl-core/helpers/string.d.ts +5 -0
  28. package/dist-lib/numbl-core/interpreter/builtins/arithmetic.d.ts +4 -0
  29. package/dist-lib/numbl-core/interpreter/builtins/array-construction.d.ts +4 -0
  30. package/dist-lib/numbl-core/interpreter/builtins/array-extras.d.ts +5 -0
  31. package/dist-lib/numbl-core/interpreter/builtins/array-manipulation.d.ts +7 -0
  32. package/dist-lib/numbl-core/interpreter/builtins/cell-struct.d.ts +5 -0
  33. package/dist-lib/numbl-core/interpreter/builtins/complex.d.ts +4 -0
  34. package/dist-lib/numbl-core/interpreter/builtins/dictionary.d.ts +15 -0
  35. package/dist-lib/numbl-core/interpreter/builtins/fft.d.ts +7 -0
  36. package/dist-lib/numbl-core/interpreter/builtins/help-text.d.ts +5 -0
  37. package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +34 -0
  38. package/dist-lib/numbl-core/interpreter/builtins/introspection.d.ts +6 -0
  39. package/dist-lib/numbl-core/interpreter/builtins/linear-algebra.d.ts +9 -0
  40. package/dist-lib/numbl-core/interpreter/builtins/math.d.ts +4 -0
  41. package/dist-lib/numbl-core/interpreter/builtins/misc.d.ts +4 -0
  42. package/dist-lib/numbl-core/interpreter/builtins/numerical.d.ts +10 -0
  43. package/dist-lib/numbl-core/interpreter/builtins/predicates.d.ts +4 -0
  44. package/dist-lib/numbl-core/interpreter/builtins/prng.d.ts +4 -0
  45. package/dist-lib/numbl-core/interpreter/builtins/reductions.d.ts +6 -0
  46. package/dist-lib/numbl-core/interpreter/builtins/set-operations.d.ts +4 -0
  47. package/dist-lib/numbl-core/interpreter/builtins/sparse.d.ts +4 -0
  48. package/dist-lib/numbl-core/interpreter/builtins/special-math.d.ts +4 -0
  49. package/dist-lib/numbl-core/interpreter/builtins/string-extras.d.ts +5 -0
  50. package/dist-lib/numbl-core/interpreter/builtins/strings.d.ts +7 -0
  51. package/dist-lib/numbl-core/interpreter/builtins/time-system.d.ts +5 -0
  52. package/dist-lib/numbl-core/interpreter/builtins/type-constructors.d.ts +5 -0
  53. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +109 -0
  54. package/dist-lib/numbl-core/interpreter/builtins/utility.d.ts +4 -0
  55. package/dist-lib/numbl-core/interpreter/builtins/validation.d.ts +4 -0
  56. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +146 -0
  57. package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +51 -0
  58. package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +41 -0
  59. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +18 -0
  60. package/dist-lib/numbl-core/interpreter/jit/index.d.ts +7 -0
  61. package/dist-lib/numbl-core/interpreter/jit/jitCodegen.d.ts +5 -0
  62. package/dist-lib/numbl-core/interpreter/jit/jitHelpers.d.ts +5 -0
  63. package/dist-lib/numbl-core/interpreter/jit/jitLoop.d.ts +25 -0
  64. package/dist-lib/numbl-core/interpreter/jit/jitLoopAnalysis.d.ts +25 -0
  65. package/dist-lib/numbl-core/interpreter/jit/jitLower.d.ts +20 -0
  66. package/dist-lib/numbl-core/interpreter/jit/jitTypes.d.ts +168 -0
  67. package/dist-lib/numbl-core/interpreter/types.d.ts +77 -0
  68. package/dist-lib/numbl-core/jsUserFunctions.d.ts +25 -0
  69. package/dist-lib/numbl-core/lexer/helpers.d.ts +15 -0
  70. package/dist-lib/numbl-core/lexer/index.d.ts +4 -0
  71. package/dist-lib/numbl-core/lexer/keywords.d.ts +3 -0
  72. package/dist-lib/numbl-core/lexer/token-config.d.ts +94 -0
  73. package/dist-lib/numbl-core/lexer/tokenizer.d.ts +9 -0
  74. package/dist-lib/numbl-core/lexer/types.d.ts +78 -0
  75. package/dist-lib/numbl-core/lowering/classInfo.d.ts +36 -0
  76. package/dist-lib/numbl-core/lowering/constants.d.ts +4 -0
  77. package/dist-lib/numbl-core/lowering/errors.d.ts +17 -0
  78. package/dist-lib/numbl-core/lowering/index.d.ts +3 -0
  79. package/dist-lib/numbl-core/lowering/itemTypes.d.ts +87 -0
  80. package/dist-lib/numbl-core/lowering/loweringContext.d.ts +206 -0
  81. package/dist-lib/numbl-core/native/bridge-resolve.d.ts +14 -0
  82. package/dist-lib/numbl-core/native/lapack-bridge.d.ts +387 -0
  83. package/dist-lib/numbl-core/native/ts-lapack-bridge.d.ts +9 -0
  84. package/dist-lib/numbl-core/parser/ArgumentsParser.d.ts +28 -0
  85. package/dist-lib/numbl-core/parser/ClassParser.d.ts +18 -0
  86. package/dist-lib/numbl-core/parser/CommandParser.d.ts +31 -0
  87. package/dist-lib/numbl-core/parser/ControlFlowParser.d.ts +16 -0
  88. package/dist-lib/numbl-core/parser/ExpressionParser.d.ts +32 -0
  89. package/dist-lib/numbl-core/parser/FunctionParser.d.ts +10 -0
  90. package/dist-lib/numbl-core/parser/Parser.d.ts +17 -0
  91. package/dist-lib/numbl-core/parser/ParserBase.d.ts +35 -0
  92. package/dist-lib/numbl-core/parser/StatementParser.d.ts +13 -0
  93. package/dist-lib/numbl-core/parser/errors.d.ts +15 -0
  94. package/dist-lib/numbl-core/parser/index.d.ts +7 -0
  95. package/dist-lib/numbl-core/parser/types.d.ts +316 -0
  96. package/dist-lib/numbl-core/runtime/compare.d.ts +5 -0
  97. package/dist-lib/numbl-core/runtime/constructors.d.ts +35 -0
  98. package/dist-lib/numbl-core/runtime/convert.d.ts +10 -0
  99. package/dist-lib/numbl-core/runtime/display.d.ts +6 -0
  100. package/dist-lib/numbl-core/runtime/error.d.ts +73 -0
  101. package/dist-lib/numbl-core/runtime/index.d.ts +12 -0
  102. package/dist-lib/numbl-core/runtime/indexing.d.ts +10 -0
  103. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +215 -0
  104. package/dist-lib/numbl-core/runtime/runtime.d.ts +314 -0
  105. package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +27 -0
  106. package/dist-lib/numbl-core/runtime/runtimeHelpers.d.ts +31 -0
  107. package/dist-lib/numbl-core/runtime/runtimeIndexing.d.ts +28 -0
  108. package/dist-lib/numbl-core/runtime/runtimeMemberAccess.d.ts +26 -0
  109. package/dist-lib/numbl-core/runtime/runtimeOperators.d.ts +24 -0
  110. package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +99 -0
  111. package/dist-lib/numbl-core/runtime/sentinels.d.ts +4 -0
  112. package/dist-lib/numbl-core/runtime/specialBuiltinNames.d.ts +2 -0
  113. package/dist-lib/numbl-core/runtime/specialBuiltins.d.ts +13 -0
  114. package/dist-lib/numbl-core/runtime/struct-access.d.ts +6 -0
  115. package/dist-lib/numbl-core/runtime/syncChannel.d.ts +1 -0
  116. package/dist-lib/numbl-core/runtime/tensor-construction.d.ts +10 -0
  117. package/dist-lib/numbl-core/runtime/types.d.ts +110 -0
  118. package/dist-lib/numbl-core/runtime/utils.d.ts +20 -0
  119. package/dist-lib/numbl-core/stdlib-bundle.d.ts +3 -0
  120. package/dist-lib/numbl-core/systemAdapter.d.ts +23 -0
  121. package/dist-lib/numbl-core/version.d.ts +2 -0
  122. package/dist-lib/numbl-core/workspace/index.d.ts +4 -0
  123. package/dist-lib/numbl-core/workspace/types.d.ts +16 -0
  124. package/dist-lib/ts-lapack/src/BLAS/daxpy.d.ts +1 -0
  125. package/dist-lib/ts-lapack/src/BLAS/dcopy.d.ts +1 -0
  126. package/dist-lib/ts-lapack/src/BLAS/ddot.d.ts +1 -0
  127. package/dist-lib/ts-lapack/src/BLAS/dgemm.d.ts +1 -0
  128. package/dist-lib/ts-lapack/src/BLAS/dgemm_optimized.d.ts +1 -0
  129. package/dist-lib/ts-lapack/src/BLAS/dgemv.d.ts +1 -0
  130. package/dist-lib/ts-lapack/src/BLAS/dger.d.ts +1 -0
  131. package/dist-lib/ts-lapack/src/BLAS/dnrm2.d.ts +1 -0
  132. package/dist-lib/ts-lapack/src/BLAS/drot.d.ts +1 -0
  133. package/dist-lib/ts-lapack/src/BLAS/dscal.d.ts +1 -0
  134. package/dist-lib/ts-lapack/src/BLAS/dswap.d.ts +1 -0
  135. package/dist-lib/ts-lapack/src/BLAS/dtrmm.d.ts +1 -0
  136. package/dist-lib/ts-lapack/src/BLAS/dtrmv.d.ts +1 -0
  137. package/dist-lib/ts-lapack/src/BLAS/dtrsm.d.ts +1 -0
  138. package/dist-lib/ts-lapack/src/BLAS/idamax.d.ts +1 -0
  139. package/dist-lib/ts-lapack/src/SRC/dbdsqr.d.ts +10 -0
  140. package/dist-lib/ts-lapack/src/SRC/dgebak.d.ts +1 -0
  141. package/dist-lib/ts-lapack/src/SRC/dgebal.d.ts +5 -0
  142. package/dist-lib/ts-lapack/src/SRC/dgebd2.d.ts +1 -0
  143. package/dist-lib/ts-lapack/src/SRC/dgebrd.d.ts +1 -0
  144. package/dist-lib/ts-lapack/src/SRC/dgeev.d.ts +3 -0
  145. package/dist-lib/ts-lapack/src/SRC/dgehd2.d.ts +1 -0
  146. package/dist-lib/ts-lapack/src/SRC/dgehrd.d.ts +1 -0
  147. package/dist-lib/ts-lapack/src/SRC/dgelq2.d.ts +1 -0
  148. package/dist-lib/ts-lapack/src/SRC/dgelqf.d.ts +1 -0
  149. package/dist-lib/ts-lapack/src/SRC/dgeqr2.d.ts +1 -0
  150. package/dist-lib/ts-lapack/src/SRC/dgeqrf.d.ts +1 -0
  151. package/dist-lib/ts-lapack/src/SRC/dgeqrf_optimized.d.ts +1 -0
  152. package/dist-lib/ts-lapack/src/SRC/dgesvd.d.ts +28 -0
  153. package/dist-lib/ts-lapack/src/SRC/dgetrf.d.ts +1 -0
  154. package/dist-lib/ts-lapack/src/SRC/dgetrf2.d.ts +1 -0
  155. package/dist-lib/ts-lapack/src/SRC/dgetri.d.ts +1 -0
  156. package/dist-lib/ts-lapack/src/SRC/dhseqr.d.ts +32 -0
  157. package/dist-lib/ts-lapack/src/SRC/dlabrd.d.ts +1 -0
  158. package/dist-lib/ts-lapack/src/SRC/dlacpy.d.ts +18 -0
  159. package/dist-lib/ts-lapack/src/SRC/dladiv.d.ts +9 -0
  160. package/dist-lib/ts-lapack/src/SRC/dlaexc.d.ts +21 -0
  161. package/dist-lib/ts-lapack/src/SRC/dlahqr.d.ts +24 -0
  162. package/dist-lib/ts-lapack/src/SRC/dlahr2.d.ts +1 -0
  163. package/dist-lib/ts-lapack/src/SRC/dlaln2.d.ts +5 -0
  164. package/dist-lib/ts-lapack/src/SRC/dlamch.d.ts +1 -0
  165. package/dist-lib/ts-lapack/src/SRC/dlange.d.ts +1 -0
  166. package/dist-lib/ts-lapack/src/SRC/dlanv2.d.ts +12 -0
  167. package/dist-lib/ts-lapack/src/SRC/dlapy2.d.ts +1 -0
  168. package/dist-lib/ts-lapack/src/SRC/dlaqr1.d.ts +1 -0
  169. package/dist-lib/ts-lapack/src/SRC/dlaqr30.d.ts +81 -0
  170. package/dist-lib/ts-lapack/src/SRC/dlaqr5.d.ts +38 -0
  171. package/dist-lib/ts-lapack/src/SRC/dlarf.d.ts +18 -0
  172. package/dist-lib/ts-lapack/src/SRC/dlarf1f.d.ts +1 -0
  173. package/dist-lib/ts-lapack/src/SRC/dlarfb.d.ts +25 -0
  174. package/dist-lib/ts-lapack/src/SRC/dlarfg.d.ts +4 -0
  175. package/dist-lib/ts-lapack/src/SRC/dlarft.d.ts +20 -0
  176. package/dist-lib/ts-lapack/src/SRC/dlarfx.d.ts +17 -0
  177. package/dist-lib/ts-lapack/src/SRC/dlartg.d.ts +5 -0
  178. package/dist-lib/ts-lapack/src/SRC/dlas2.d.ts +4 -0
  179. package/dist-lib/ts-lapack/src/SRC/dlascl.d.ts +1 -0
  180. package/dist-lib/ts-lapack/src/SRC/dlaset.d.ts +19 -0
  181. package/dist-lib/ts-lapack/src/SRC/dlasr.d.ts +1 -0
  182. package/dist-lib/ts-lapack/src/SRC/dlassq.d.ts +18 -0
  183. package/dist-lib/ts-lapack/src/SRC/dlasv2.d.ts +8 -0
  184. package/dist-lib/ts-lapack/src/SRC/dlaswp.d.ts +1 -0
  185. package/dist-lib/ts-lapack/src/SRC/dlasy2.d.ts +5 -0
  186. package/dist-lib/ts-lapack/src/SRC/dorg2r.d.ts +1 -0
  187. package/dist-lib/ts-lapack/src/SRC/dorgbr.d.ts +1 -0
  188. package/dist-lib/ts-lapack/src/SRC/dorghr.d.ts +1 -0
  189. package/dist-lib/ts-lapack/src/SRC/dorgl2.d.ts +1 -0
  190. package/dist-lib/ts-lapack/src/SRC/dorglq.d.ts +1 -0
  191. package/dist-lib/ts-lapack/src/SRC/dorgqr.d.ts +1 -0
  192. package/dist-lib/ts-lapack/src/SRC/dorgqr_optimized.d.ts +1 -0
  193. package/dist-lib/ts-lapack/src/SRC/dorm2r.d.ts +1 -0
  194. package/dist-lib/ts-lapack/src/SRC/dormhr.d.ts +1 -0
  195. package/dist-lib/ts-lapack/src/SRC/dormqr.d.ts +1 -0
  196. package/dist-lib/ts-lapack/src/SRC/dpotf2.d.ts +1 -0
  197. package/dist-lib/ts-lapack/src/SRC/dtrevc3.d.ts +27 -0
  198. package/dist-lib/ts-lapack/src/SRC/dtrexc.d.ts +24 -0
  199. package/dist-lib/ts-lapack/src/SRC/dtrti2.d.ts +1 -0
  200. package/dist-lib/ts-lapack/src/SRC/dtrtri.d.ts +1 -0
  201. package/dist-lib/ts-lapack/src/utils/constants.d.ts +28 -0
  202. package/dist-lib/ts-lapack/src/utils/iladlc.d.ts +1 -0
  203. package/dist-lib/ts-lapack/src/utils/iladlr.d.ts +1 -0
  204. package/dist-lib/ts-lapack/src/utils/ilaenv.d.ts +1 -0
  205. package/dist-lib/ts-lapack/src/utils/xerbla.d.ts +1 -0
  206. package/dist-plot-viewer/assets/index-BjKyNJgj.js +4426 -0
  207. package/dist-plot-viewer/index.html +1 -1
  208. package/package.json +12 -2
  209. package/dist-plot-viewer/assets/index-BMYdzDaW.js +0 -4426
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Array construction builtins: zeros, ones, nan/NaN, eye, linspace, logspace.
3
+ */
4
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Array extras: colon, tril, triu, toeplitz, magic,
3
+ * bitwise ops, and coordinate transforms.
4
+ */
5
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Array manipulation builtins for the interpreter system:
3
+ * reshape, diag, cat, horzcat, vertcat, flip, fliplr, flipud, rot90,
4
+ * repmat, repelem, squeeze, circshift, permute, ipermute,
5
+ * ndgrid, meshgrid, sub2ind, ind2sub.
6
+ */
7
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Cell/struct operation builtins: cell2mat, cell2struct, mat2cell, num2cell,
3
+ * struct2cell, namedargs2cell, rmfield.
4
+ */
5
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Complex number builtins: real, imag, conj, angle.
3
+ */
4
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Dictionary builtins: dictionary, configureDictionary, keys, values,
3
+ * numEntries, isConfigured, isKey, entries, insert, lookup, remove, types.
4
+ */
5
+ import { type RuntimeValue, type RuntimeDictionary } from "../../runtime/types.js";
6
+ /** Produce a unique string key from a RuntimeValue for Map lookup. */
7
+ export declare function hashKey(v: RuntimeValue): string;
8
+ /** Insert a single key-value pair without expanding arrays. */
9
+ export declare function dictInsertSingle(d: RuntimeDictionary, key: RuntimeValue, value: RuntimeValue): RuntimeDictionary;
10
+ /** Insert key-value pairs into a dictionary, returning a new dictionary. */
11
+ export declare function dictInsert(d: RuntimeDictionary, keysArg: RuntimeValue, valuesArg: RuntimeValue): RuntimeDictionary;
12
+ /** Remove keys from a dictionary, returning a new dictionary. */
13
+ export declare function dictRemove(d: RuntimeDictionary, keysArg: RuntimeValue): RuntimeDictionary;
14
+ /** Lookup values by keys. Returns single value or tensor/cell array. */
15
+ export declare function dictLookup(d: RuntimeDictionary, keysArg: RuntimeValue): RuntimeValue;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Interpreter IBuiltins for FFT functions:
3
+ * fft, ifft, fftshift, ifftshift.
4
+ *
5
+ * Reuses the same algorithmic implementations as the legacy builtins.
6
+ */
7
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Help text for builtins. Registered via registerBuiltinHelp so existing
3
+ * builtin definitions don't need to be modified.
4
+ */
5
+ export {};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Interpreter builtins: register all and re-export.
3
+ *
4
+ * Import order matters — each module registers its builtins on import.
5
+ */
6
+ import "./math.js";
7
+ import "./arithmetic.js";
8
+ import "./complex.js";
9
+ import "./predicates.js";
10
+ import "./utility.js";
11
+ import "./introspection.js";
12
+ import "./array-construction.js";
13
+ import "./reductions.js";
14
+ import "./strings.js";
15
+ import "./set-operations.js";
16
+ import "./linear-algebra.js";
17
+ import "./fft.js";
18
+ import "./array-manipulation.js";
19
+ import "./array-extras.js";
20
+ import "./validation.js";
21
+ import "./numerical.js";
22
+ import "./type-constructors.js";
23
+ import "./string-extras.js";
24
+ import "./prng.js";
25
+ import "./cell-struct.js";
26
+ import "./time-system.js";
27
+ import "./sparse.js";
28
+ import "./special-math.js";
29
+ import "./misc.js";
30
+ import "./dictionary.js";
31
+ import "./help-text.js";
32
+ export { getIBuiltin, getIBuiltinHelp, getIBuiltinNargin, getAllIBuiltinNames, buildIBuiltinHelpers, setDynamicRegisterHook, registerBuiltinHelp, inferJitType, } from "./types.js";
33
+ export type { IBuiltin, IBuiltinResolution, BuiltinHelp } from "./types.js";
34
+ export { resetAppdataStore, convertJsonValue } from "./misc.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Introspection builtins: size, length, numel, ndims, isempty, isscalar,
3
+ * isvector, isrow, iscolumn, ismatrix, islogical, isnumeric, isfloat,
4
+ * isinteger, ischar, isstring, iscell, isstruct, issparse, class.
5
+ */
6
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Interpreter IBuiltins for linear algebra functions:
3
+ * norm, vecnorm, dot, det, trace, cross, inv, svd, qr, lu, eig, chol,
4
+ * linsolve, cond, rank, pinv, kron, blkdiag, pagemtimes, pagetranspose.
5
+ *
6
+ * These delegate to the same runtime implementations as the legacy builtins
7
+ * but provide JitType-level resolve() for the interpreter/JIT pipeline.
8
+ */
9
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Unary math builtins: trig, hyperbolic, exp/log, rounding, abs, sqrt, sign.
3
+ */
4
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { RuntimeValue } from "../../runtime/types.js";
2
+ /** Clear all appdata — called at the start of each executeCode to isolate runs. */
3
+ export declare function resetAppdataStore(): void;
4
+ export declare function convertJsonValue(val: unknown): RuntimeValue;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Numerical builtins for the interpreter system:
3
+ * conv, deconv, polyval, polyfit, trapz, cumtrapz, gradient,
4
+ * interp1, roots, poly, cov, corrcoef, accumarray.
5
+ *
6
+ * These are thin wrappers that delegate to the legacy implementations
7
+ * (which are already well-tested) while registering as IBuiltins for
8
+ * proper JIT type inference.
9
+ */
10
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Predicate builtins: isnan, isinf, isfinite, isreal.
3
+ */
4
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * PRNG builtins: rand, randn, randi, randperm, rng.
3
+ */
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Interpreter IBuiltins for reduction operations:
3
+ * sum, prod, mean, std, var, median, mode, any, all,
4
+ * cumsum, cumprod, cummax, cummin, diff.
5
+ */
6
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Set and search builtins for the interpreter: find, sort, setdiff, ismember.
3
+ */
4
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sparse matrix builtins: sparse, speye, spdiags, spconvert.
3
+ */
4
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Special math builtins: airy, ellipj, legendre, besselj, bessely, besseli, besselk.
3
+ */
4
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * String builtins that return cell arrays or have complex output modes:
3
+ * strsplit, strjoin, regexp, regexpi, regexprep, symvar.
4
+ */
5
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Interpreter IBuiltins for string/char operations.
3
+ *
4
+ * Functions that involve cell arrays (strsplit, strjoin, symvar, regexp/regexpi)
5
+ * or the parser (symvar) are left to legacy builtins since JitType has no cell kind.
6
+ */
7
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Time and system builtins: tic, toc, clock, etime, warning, computer, version,
3
+ * ismac, ispc, isunix.
4
+ */
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type constructor builtins: double, logical, complex, cell, struct, full,
3
+ * isfield, deal, func2str.
4
+ */
5
+ export {};
@@ -0,0 +1,109 @@
1
+ /**
2
+ * IBuiltin interface, registry, and shared helpers for interpreter builtins.
3
+ */
4
+ import type { RuntimeValue, RuntimeTensor, RuntimeComplexNumber } from "../../runtime/types.js";
5
+ import { FloatXArray } from "../../runtime/types.js";
6
+ import { type JitType } from "../jit/jitTypes.js";
7
+ export interface IBuiltinResolution {
8
+ outputTypes: JitType[];
9
+ apply: (args: RuntimeValue[], nargout: number) => RuntimeValue | RuntimeValue[];
10
+ }
11
+ export interface BuiltinHelp {
12
+ signatures: string[];
13
+ description: string;
14
+ }
15
+ export interface IBuiltin {
16
+ name: string;
17
+ help?: BuiltinHelp;
18
+ /** Given input JIT types + nargout, return output types and a specialized apply, or null. */
19
+ resolve: (argTypes: JitType[], nargout: number) => IBuiltinResolution | null;
20
+ /** Optional fast-path JS code emission for JIT. Return null to fall back to $h.ib_<name>. */
21
+ jitEmit?: (argCode: string[], argTypes: JitType[]) => string | null;
22
+ }
23
+ export declare function getIBuiltin(name: string): IBuiltin | undefined;
24
+ export declare function registerIBuiltin(b: IBuiltin): void;
25
+ /** Set a callback for dynamic IBuiltin registration (called by jitHelpers setup). */
26
+ export declare function setDynamicRegisterHook(hook: ((b: IBuiltin) => void) | null): void;
27
+ /** Register a dynamic IBuiltin (e.g. .js user functions), replacing any
28
+ * existing entry with the same name without error. */
29
+ export declare function registerDynamicIBuiltin(b: IBuiltin): void;
30
+ export declare function unregisterIBuiltin(name: string): void;
31
+ export declare function getAllIBuiltinNames(): string[];
32
+ export declare function getIBuiltinHelp(name: string): BuiltinHelp | undefined;
33
+ export declare function registerBuiltinHelp(name: string, help: BuiltinHelp): void;
34
+ /** Probe an IBuiltin to determine its nargin (number of input args).
35
+ * Tries resolve with 1, 2, 3 number-type args to find the accepted count. */
36
+ export declare function getIBuiltinNargin(name: string): number | undefined;
37
+ export declare function inferJitType(value: unknown): JitType;
38
+ /** Build the ib_* entries for the jitHelpers object.
39
+ * The returned object also has _profileEnter/_profileLeave hooks (no-ops by default)
40
+ * that the runtime replaces when profiling is enabled. */
41
+ export declare function buildIBuiltinHelpers(): Record<string, any>;
42
+ export declare function mkc(re: number, im: number): number | RuntimeComplexNumber;
43
+ export declare function makeTensor(data: InstanceType<typeof FloatXArray>, imag: InstanceType<typeof FloatXArray> | undefined, shape: number[]): RuntimeTensor;
44
+ /** Type rule requiring two scalar numbers */
45
+ export declare function binaryNumberOnly(argTypes: JitType[]): JitType[] | null;
46
+ /** Apply a unary element-wise function with complex support */
47
+ export declare function applyUnaryElemwise(v: RuntimeValue, realFn: (x: number) => number, complexFn: (re: number, im: number) => {
48
+ re: number;
49
+ im: number;
50
+ }, name: string): RuntimeValue;
51
+ /** Apply a binary scalar function */
52
+ export declare function applyBinaryScalar(args: RuntimeValue[], fn: (a: number, b: number) => number, name: string): RuntimeValue;
53
+ /** Apply a binary element-wise function supporting scalars, tensors, and broadcast. */
54
+ export declare function applyBinaryElemwise(args: RuntimeValue[], fn: (a: number, b: number) => number, name: string): RuntimeValue;
55
+ /** Match a binary function accepting number/boolean/tensor args (no complex). */
56
+ export declare function binaryElemwiseMatch(argTypes: JitType[]): JitType[] | null;
57
+ /** A single case in a builtin's dispatch table. Bundles type-level matching
58
+ * with runtime implementation so the two paths cannot diverge. */
59
+ export interface BuiltinCase {
60
+ /** Return output types if this case handles the given arg types, or null. */
61
+ match: (argTypes: JitType[], nargout: number) => JitType[] | null;
62
+ /** Runtime implementation — only called when match succeeded. */
63
+ apply: (args: RuntimeValue[], nargout: number) => RuntimeValue | RuntimeValue[];
64
+ }
65
+ /** Register an IBuiltin from a list of cases. The first matching case wins. */
66
+ export declare function defineBuiltin(opts: {
67
+ name: string;
68
+ help?: BuiltinHelp;
69
+ cases: BuiltinCase[];
70
+ jitEmit?: (argCode: string[], argTypes: JitType[]) => string | null;
71
+ }): void;
72
+ type NumberJitType = Extract<JitType, {
73
+ kind: "number";
74
+ }>;
75
+ type BooleanJitType = Extract<JitType, {
76
+ kind: "boolean";
77
+ }>;
78
+ type ComplexJitType = Extract<JitType, {
79
+ kind: "complex_or_number";
80
+ }>;
81
+ type TensorJitType = Extract<JitType, {
82
+ kind: "tensor";
83
+ }>;
84
+ interface UnaryElemwiseSpec {
85
+ numberType?: (a: NumberJitType) => JitType | null;
86
+ booleanType?: (a: BooleanJitType) => JitType | null;
87
+ complexType?: (a: ComplexJitType) => JitType | null;
88
+ tensorType?: (a: TensorJitType) => JitType | null;
89
+ realFn: (x: number) => number;
90
+ complexFn: (re: number, im: number) => {
91
+ re: number;
92
+ im: number;
93
+ };
94
+ /** Use applyUnaryElemwiseMaybeComplex instead of applyUnaryElemwise */
95
+ maybeComplex?: boolean;
96
+ }
97
+ /** Generate cases for a unary element-wise builtin. Each accepted kind gets
98
+ * its own case that bundles the type rule with the corresponding apply. */
99
+ export declare function unaryElemwiseCases(spec: UnaryElemwiseSpec, name: string): BuiltinCase[];
100
+ /** Shorthand: build cases where all kinds return always-real output. */
101
+ export declare function unaryRealResultCases(realFn: (x: number) => number, complexFn: (re: number, im: number) => number, name: string): BuiltinCase[];
102
+ /** Build cases for numeric predicates (isnan, isinf, isfinite) that return logical. */
103
+ export declare function predicateCases(scalarTest: (x: number) => boolean, complexTest: (re: number, im: number) => boolean, tensorTest: (x: number) => boolean, tensorComplexTest: (re: number, im: number) => boolean, name: string): BuiltinCase[];
104
+ /** Fast-path emitter for unary Math.* functions.
105
+ * Emits Math.fn(x) for scalar numbers, $h.tHelper(x) for real tensors. */
106
+ export declare function unaryMathJitEmit(mathFn: string, tensorHelper: string, requireNonneg?: boolean): (argCode: string[], argTypes: JitType[]) => string | null;
107
+ /** Fast-path emitter for binary Math.* functions on two scalar numbers. */
108
+ export declare function binaryMathJitEmit(mathFn: string): (argCode: string[], argTypes: JitType[]) => string | null;
109
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Utility builtins for JIT: isequal, assert, error, abs.
3
+ */
4
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Validation builtins: mustBe* family.
3
+ */
4
+ export {};
@@ -0,0 +1,146 @@
1
+ /**
2
+ * AST-walking interpreter for MATLAB code.
3
+ *
4
+ * Walks the parsed AST directly without lowering or codegen.
5
+ * All dispatch decisions are made at runtime using actual values.
6
+ *
7
+ * Reuses LoweringContext and FunctionIndex from the lowering pipeline
8
+ * for workspace registration, class extraction, and function resolution.
9
+ *
10
+ * The Interpreter class is defined here with all fields.
11
+ * Methods are split across:
12
+ * - interpreterExec.ts (statement + expression evaluation)
13
+ * - interpreterFunctions.ts (function call, resolution, class methods)
14
+ */
15
+ import type { AbstractSyntaxTree } from "../parser/types.js";
16
+ import type { Runtime } from "../runtime/runtime.js";
17
+ import type { RuntimeValue } from "../runtime/types.js";
18
+ import type { LoweringContext, FunctionIndex } from "../lowering/loweringContext.js";
19
+ import { type ResolvedTarget } from "../functionResolve.js";
20
+ import { Environment, type FunctionDef, type ControlSignal } from "./types.js";
21
+ import type { Stmt, Expr, LValue } from "../parser/types.js";
22
+ import type { ClassInfo } from "../lowering/classInfo.js";
23
+ export declare class Interpreter {
24
+ /** @internal */ env: Environment;
25
+ ans: RuntimeValue | undefined;
26
+ /** @internal */ ctx: LoweringContext;
27
+ /** @internal */ functionIndex: FunctionIndex;
28
+ /** @internal */ rt: Runtime;
29
+ /** @internal */ currentFile: string;
30
+ /** @internal */ currentClassName: string | undefined;
31
+ /** @internal */ currentMethodName: string | undefined;
32
+ /** @internal */ mainLocalFunctions: Map<string, FunctionDef>;
33
+ /** @internal The main script (workspace) environment — for evalin/assignin('workspace', ...) */
34
+ workspaceEnv: Environment | undefined;
35
+ /** @internal The caller's environment — for evalin/assignin('caller', ...) */
36
+ callerEnv: Environment | undefined;
37
+ /** @internal Stack of [base, dimIndex, numIndices] for resolving `end` keyword in indexing. */
38
+ endContextStack: Array<{
39
+ base: unknown;
40
+ dimIndex: number;
41
+ numIndices: number;
42
+ }>;
43
+ /** @internal */
44
+ functionDefCache: Map<string, FunctionDef>;
45
+ /** @internal Pre-built line break tables for offset→line lookup per file. */
46
+ lineTableCache: Map<string, number[]>;
47
+ /** @internal file→source mapping for line number computation */
48
+ fileSources: Map<string, string>;
49
+ /** @internal Guard against infinite recursion in compileSpecialized */
50
+ compileInProgress: Set<string>;
51
+ /** @internal Per-instance cache for JIT-compiled loops (avoids cross-execution collisions). */
52
+ loopJitCache: Map<string, {
53
+ fn: (...args: unknown[]) => unknown;
54
+ source: string;
55
+ } | null>;
56
+ /** @internal Progressive type widening for loop JIT: location -> last unified input types. */
57
+ loopLastInputTypes: Map<string, import("./jit/jitTypes.js").JitType[]>;
58
+ /** Optimization level (0 = pure interpreter, >=1 = JIT scalar functions). */
59
+ optimization: number;
60
+ /** Callback for JIT compilation logging. */
61
+ onJitCompile?: (description: string, jsCode: string) => void;
62
+ constructor(rt: Runtime, ctx: LoweringContext, functionIndex: FunctionIndex, mainFileName: string, initialVariableValues?: Record<string, RuntimeValue>);
63
+ /** Clear all JIT and function resolution caches. Called after addpath/rmpath. */
64
+ clearAllCaches(): void;
65
+ /** Wire up runtime callbacks so dispatch() routes through the interpreter. */
66
+ installRuntimeCallbacks(): void;
67
+ /** Run a complete AST (main script). */
68
+ run(ast: AbstractSyntaxTree): void;
69
+ /** Get variable values for ExecResult. */
70
+ getVariableValues(): Record<string, RuntimeValue>;
71
+ execStmt: (stmt: Stmt) => ControlSignal | null;
72
+ execStmts: (stmts: Stmt[]) => ControlSignal | null;
73
+ evalExpr: (expr: Expr) => unknown;
74
+ evalExprNargout: (expr: Expr, nargout: number) => unknown;
75
+ evalBinary: (expr: Extract<Expr, {
76
+ type: "Binary";
77
+ }>) => unknown;
78
+ evalUnary: (expr: Extract<Expr, {
79
+ type: "Unary";
80
+ }>) => unknown;
81
+ evalRange: (expr: Extract<Expr, {
82
+ type: "Range";
83
+ }>) => unknown;
84
+ evalFuncCall: (expr: Extract<Expr, {
85
+ type: "FuncCall";
86
+ }>, nargout: number) => unknown;
87
+ evalIndex: (expr: Extract<Expr, {
88
+ type: "Index";
89
+ }>) => unknown;
90
+ evalIndexCell: (expr: Extract<Expr, {
91
+ type: "IndexCell";
92
+ }>) => unknown;
93
+ evalIndicesWithEnd: (base: unknown, indexExprs: Expr[]) => unknown[];
94
+ evalArgs: (argExprs: Expr[]) => unknown[];
95
+ evalMember: (expr: Extract<Expr, {
96
+ type: "Member";
97
+ }>, nargout: number) => unknown;
98
+ tryExtractDottedName: (expr: Expr) => string | null;
99
+ evalAnonFunc: (expr: Extract<Expr, {
100
+ type: "AnonFunc";
101
+ }>) => RuntimeValue;
102
+ makeFuncHandle: (name: string) => RuntimeValue;
103
+ evalTensorLiteral: (expr: Extract<Expr, {
104
+ type: "Tensor";
105
+ }>) => unknown;
106
+ evalCellLiteral: (expr: Extract<Expr, {
107
+ type: "Cell";
108
+ }>) => unknown;
109
+ assignLValue: (lv: LValue, value: RuntimeValue) => void;
110
+ writeLValueBase: (base: Expr, value: RuntimeValue) => void;
111
+ evalLValueBase: (base: Expr, defaultVal: RuntimeValue) => unknown;
112
+ switchMatch: (switchVal: unknown, caseVal: unknown) => boolean;
113
+ isOutputExpr: (expr: Expr) => boolean;
114
+ callFunction: (name: string, args: unknown[], nargout: number) => unknown;
115
+ interpretTarget: (target: ResolvedTarget, args: unknown[], nargout: number) => unknown;
116
+ interpretLocalFunction: (target: Extract<ResolvedTarget, {
117
+ kind: "localFunction";
118
+ }>, args: unknown[], nargout: number) => unknown;
119
+ interpretWorkspaceFunction: (target: Extract<ResolvedTarget, {
120
+ kind: "workspaceFunction";
121
+ }>, args: unknown[], nargout: number) => unknown;
122
+ interpretClassMethod: (target: Extract<ResolvedTarget, {
123
+ kind: "classMethod";
124
+ }>, args: unknown[], nargout: number) => unknown;
125
+ interpretPrivateFunction: (target: Extract<ResolvedTarget, {
126
+ kind: "privateFunction";
127
+ }>, args: unknown[], nargout: number) => unknown;
128
+ instantiateClass: (className: string, args: unknown[], nargout: number) => unknown;
129
+ interpretConstructor: (classInfo: ClassInfo, args: unknown[], nargout: number) => unknown;
130
+ callUserFunction: (fn: FunctionDef, args: unknown[], nargout: number, narginOverride?: number) => unknown;
131
+ callNestedFunction: (fn: FunctionDef, parentEnv: Environment, args: unknown[], nargout: number) => unknown;
132
+ withFileContext: <T>(file: string, className: string | undefined, methodName: string | undefined, fn: () => T) => T;
133
+ getWorkspaceFileName: (funcName: string) => string;
134
+ getClassFileName: (className: string) => string;
135
+ findFunctionInWorkspaceFile: (wsName: string, funcName: string) => FunctionDef | null;
136
+ findFunctionInClassFile: (className: string, funcName: string, methodScope?: string) => FunctionDef | null;
137
+ findMethodInClass: (classInfo: ClassInfo, methodName: string) => FunctionDef | null;
138
+ findExternalMethod: (classInfo: ClassInfo, methodName: string) => FunctionDef | null;
139
+ collectClassProperties: (classInfo: ClassInfo) => {
140
+ propertyNames: string[];
141
+ propertyDefaults: Map<string, Expr>;
142
+ };
143
+ isHandleClass: (classInfo: ClassInfo) => boolean;
144
+ evalInLocalScope: (codeArg: unknown, fileName?: string) => unknown;
145
+ processArgumentsBlocks: (fn: FunctionDef, args: unknown[]) => unknown[];
146
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Interpreter statement execution and expression evaluation methods.
3
+ * Augments the Interpreter class via prototype assignment.
4
+ */
5
+ import type { Stmt, Expr, LValue } from "../parser/types.js";
6
+ import type { RuntimeValue } from "../runtime/types.js";
7
+ import { type ControlSignal } from "./types.js";
8
+ import type { Interpreter } from "./interpreter.js";
9
+ export declare function execStmt(this: Interpreter, stmt: Stmt): ControlSignal | null;
10
+ export declare function execStmts(this: Interpreter, stmts: Stmt[]): ControlSignal | null;
11
+ export declare function evalExpr(this: Interpreter, expr: Expr): unknown;
12
+ export declare function evalExprNargout(this: Interpreter, expr: Expr, nargout: number): unknown;
13
+ export declare function evalArgs(this: Interpreter, argExprs: Expr[]): unknown[];
14
+ export declare function evalBinary(this: Interpreter, expr: Extract<Expr, {
15
+ type: "Binary";
16
+ }>): unknown;
17
+ export declare function evalUnary(this: Interpreter, expr: Extract<Expr, {
18
+ type: "Unary";
19
+ }>): unknown;
20
+ export declare function evalRange(this: Interpreter, expr: Extract<Expr, {
21
+ type: "Range";
22
+ }>): unknown;
23
+ export declare function evalFuncCall(this: Interpreter, expr: Extract<Expr, {
24
+ type: "FuncCall";
25
+ }>, nargout: number): unknown;
26
+ export declare function evalMember(this: Interpreter, expr: Extract<Expr, {
27
+ type: "Member";
28
+ }>, nargout: number): unknown;
29
+ export declare function tryExtractDottedName(this: Interpreter, expr: Expr): string | null;
30
+ export declare function evalIndex(this: Interpreter, expr: Extract<Expr, {
31
+ type: "Index";
32
+ }>): unknown;
33
+ export declare function evalIndexCell(this: Interpreter, expr: Extract<Expr, {
34
+ type: "IndexCell";
35
+ }>): unknown;
36
+ export declare function evalIndicesWithEnd(this: Interpreter, base: unknown, indexExprs: Expr[]): unknown[];
37
+ export declare function evalAnonFunc(this: Interpreter, expr: Extract<Expr, {
38
+ type: "AnonFunc";
39
+ }>): RuntimeValue;
40
+ export declare function makeFuncHandle(this: Interpreter, name: string): RuntimeValue;
41
+ export declare function evalTensorLiteral(this: Interpreter, expr: Extract<Expr, {
42
+ type: "Tensor";
43
+ }>): unknown;
44
+ export declare function evalCellLiteral(this: Interpreter, expr: Extract<Expr, {
45
+ type: "Cell";
46
+ }>): unknown;
47
+ export declare function assignLValue(this: Interpreter, lv: LValue, value: RuntimeValue): void;
48
+ export declare function writeLValueBase(this: Interpreter, base: Expr, value: RuntimeValue): void;
49
+ export declare function evalLValueBase(this: Interpreter, base: Expr, defaultVal: RuntimeValue): unknown;
50
+ export declare function switchMatch(this: Interpreter, switchVal: unknown, caseVal: unknown): boolean;
51
+ export declare function isOutputExpr(this: Interpreter, expr: Expr): boolean;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Interpreter function call, resolution, and class method methods.
3
+ * Augments the Interpreter class via prototype assignment.
4
+ */
5
+ import type { Expr } from "../parser/types.js";
6
+ import { type ResolvedTarget } from "../functionResolve.js";
7
+ import type { ClassInfo } from "../lowering/classInfo.js";
8
+ import { Environment, type FunctionDef } from "./types.js";
9
+ import type { Interpreter } from "./interpreter.js";
10
+ export declare function callFunction(this: Interpreter, name: string, args: unknown[], nargout: number): unknown;
11
+ export declare function interpretTarget(this: Interpreter, target: ResolvedTarget, args: unknown[], nargout: number): unknown;
12
+ export declare function interpretLocalFunction(this: Interpreter, target: Extract<ResolvedTarget, {
13
+ kind: "localFunction";
14
+ }>, args: unknown[], nargout: number): unknown;
15
+ export declare function interpretWorkspaceFunction(this: Interpreter, target: Extract<ResolvedTarget, {
16
+ kind: "workspaceFunction";
17
+ }>, args: unknown[], nargout: number): unknown;
18
+ export declare function interpretClassMethod(this: Interpreter, target: Extract<ResolvedTarget, {
19
+ kind: "classMethod";
20
+ }>, args: unknown[], nargout: number): unknown;
21
+ export declare function interpretPrivateFunction(this: Interpreter, target: Extract<ResolvedTarget, {
22
+ kind: "privateFunction";
23
+ }>, args: unknown[], nargout: number): unknown;
24
+ export declare function instantiateClass(this: Interpreter, className: string, args: unknown[], nargout: number): unknown;
25
+ export declare function interpretConstructor(this: Interpreter, classInfo: ClassInfo, args: unknown[], nargout: number): unknown;
26
+ export declare function callUserFunction(this: Interpreter, fn: FunctionDef, args: unknown[], nargout: number, narginOverride?: number): unknown;
27
+ export declare function callNestedFunction(this: Interpreter, fn: FunctionDef, parentEnv: Environment, args: unknown[], nargout: number): unknown;
28
+ export declare function withFileContext<T>(this: Interpreter, file: string, className: string | undefined, methodName: string | undefined, fn: () => T): T;
29
+ export declare function getWorkspaceFileName(this: Interpreter, funcName: string): string;
30
+ export declare function getClassFileName(this: Interpreter, className: string): string;
31
+ export declare function findFunctionInWorkspaceFile(this: Interpreter, wsName: string, funcName: string): FunctionDef | null;
32
+ export declare function findFunctionInClassFile(this: Interpreter, className: string, funcName: string, methodScope?: string): FunctionDef | null;
33
+ export declare function findMethodInClass(this: Interpreter, classInfo: ClassInfo, methodName: string): FunctionDef | null;
34
+ export declare function findExternalMethod(this: Interpreter, classInfo: ClassInfo, methodName: string): FunctionDef | null;
35
+ export declare function collectClassProperties(this: Interpreter, classInfo: ClassInfo): {
36
+ propertyNames: string[];
37
+ propertyDefaults: Map<string, Expr>;
38
+ };
39
+ export declare function isHandleClass(this: Interpreter, classInfo: ClassInfo): boolean;
40
+ export declare function evalInLocalScope(this: Interpreter, codeArg: unknown, fileName?: string): unknown;
41
+ export declare function processArgumentsBlocks(this: Interpreter, fn: FunctionDef, args: unknown[]): unknown[];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Interpreter special builtins: functions that need access to interpreter
3
+ * context (env, callerEnv, etc.) and run before normal function resolution.
4
+ */
5
+ import type { Environment } from "./types.js";
6
+ import type { Runtime } from "../runtime/runtime.js";
7
+ export interface InterpreterContext {
8
+ env: Environment;
9
+ setEnv: (env: Environment) => void;
10
+ callerEnv: Environment | undefined;
11
+ workspaceEnv: Environment | undefined;
12
+ evalInLocalScope: (codeArg: unknown, fileName?: string) => unknown;
13
+ callFunction: (name: string, args: unknown[], nargout: number) => unknown;
14
+ rt: Runtime;
15
+ }
16
+ export declare const FALL_THROUGH: unique symbol;
17
+ export type InterpreterSpecialBuiltinHandler = (ctx: InterpreterContext, args: unknown[], nargout: number) => unknown | typeof FALL_THROUGH;
18
+ export declare function getInterpreterSpecialBuiltin(name: string): InterpreterSpecialBuiltinHandler | undefined;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * JIT compilation entry point for interpreter function calls.
3
+ */
4
+ import type { Interpreter } from "../interpreter.js";
5
+ import type { FunctionDef } from "../types.js";
6
+ export declare const JIT_SKIP: unique symbol;
7
+ export declare function tryJitCall(interp: Interpreter, fn: FunctionDef, args: unknown[], nargout: number): unknown | typeof JIT_SKIP;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * JIT IR -> JavaScript code generation.
3
+ */
4
+ import { type JitStmt } from "./jitTypes.js";
5
+ export declare function generateJS(body: JitStmt[], params: string[], outputs: string[], nargout: number, localVars: Set<string>, fileName?: string): string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Runtime helpers for JIT-compiled tensor and complex operations.
3
+ * Passed as `$h` to generated functions.
4
+ */
5
+ export declare const jitHelpers: Record<string, unknown>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * JIT compilation for inline for/while loops.
3
+ *
4
+ * When the interpreter encounters a for or while loop, these functions
5
+ * attempt to JIT-compile the loop as a synthetic function: inputs are
6
+ * variables from the enclosing scope, outputs are variables assigned
7
+ * inside the loop body. On success the compiled code runs and output
8
+ * values are written back to the interpreter environment.
9
+ */
10
+ import type { Interpreter } from "../interpreter.js";
11
+ import type { Stmt } from "../../parser/types.js";
12
+ /**
13
+ * Attempt to JIT-compile and execute a for-loop statement.
14
+ * Returns true if JIT succeeded, false to fall back to interpretation.
15
+ */
16
+ export declare function tryJitFor(interp: Interpreter, stmt: Stmt & {
17
+ type: "For";
18
+ }): boolean;
19
+ /**
20
+ * Attempt to JIT-compile and execute a while-loop statement.
21
+ * Returns true if JIT succeeded, false to fall back to interpretation.
22
+ */
23
+ export declare function tryJitWhile(interp: Interpreter, stmt: Stmt & {
24
+ type: "While";
25
+ }): boolean;