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,215 @@
1
+ /**
2
+ * Utilities for parsing plot() arguments at runtime.
3
+ *
4
+ * Handles: plot(Y), plot(X,Y), plot(X1,Y1,...,Xn,Yn),
5
+ * plot(X1,Y1,LineSpec1,...), and Name-Value pairs like 'Color','r','LineWidth',2.
6
+ */
7
+ import { type RuntimeValue } from "./types.js";
8
+ export type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace, } from "../../graphics/types.js";
9
+ import type { PlotTrace, Plot3Trace, SurfTrace, ImagescTrace, ContourTrace, BarTrace, Bar3Trace, ErrorBarTrace, BoxTrace, PieTrace, HeatmapTrace } from "../../graphics/types.js";
10
+ export interface ParsedLineSpec {
11
+ color?: string;
12
+ lineStyle?: string;
13
+ marker?: string;
14
+ }
15
+ export declare function parsePlotArgs(args: RuntimeValue[]): PlotTrace[];
16
+ /**
17
+ * Parse plot3() arguments.
18
+ *
19
+ * Supported forms:
20
+ * plot3(X, Y, Z)
21
+ * plot3(X, Y, Z, LineSpec)
22
+ * plot3(X1,Y1,Z1,...,Xn,Yn,Zn)
23
+ * plot3(X1,Y1,Z1,LineSpec1,...,Xn,Yn,Zn,LineSpecn)
24
+ * plot3(..., Name, Value)
25
+ */
26
+ export declare function parsePlot3Args(args: RuntimeValue[]): Plot3Trace[];
27
+ /**
28
+ * Parse surf() arguments.
29
+ *
30
+ * Supported forms:
31
+ * surf(Z) — Z is m×n, X = 1:n, Y = 1:m
32
+ * surf(Z, C) — Z is m×n, C is m×n color data
33
+ * surf(X, Y, Z) — X, Y, Z are m×n matrices (or X is 1×n / Y is m×1)
34
+ * surf(X, Y, Z, C) — with explicit color data
35
+ * surf(..., Name, Value) — name-value pairs
36
+ */
37
+ export declare function parseSurfArgs(args: RuntimeValue[]): SurfTrace;
38
+ /**
39
+ * Parse scatter() arguments.
40
+ *
41
+ * Supported forms:
42
+ * scatter(X, Y)
43
+ * scatter(X, Y, sz)
44
+ * scatter(X, Y, sz, c)
45
+ * scatter(X, Y, ..., 'filled')
46
+ * scatter(X, Y, ..., mkr)
47
+ * scatter(X, Y, ..., Name, Value)
48
+ */
49
+ export declare function parseScatterArgs(args: RuntimeValue[]): PlotTrace[];
50
+ /**
51
+ * Parse imagesc() arguments.
52
+ *
53
+ * Supported forms:
54
+ * imagesc(C) — C is m×n matrix
55
+ * imagesc(x, y, C) — x and y are vectors defining axis limits
56
+ */
57
+ export declare function parseImagescArgs(args: RuntimeValue[]): ImagescTrace;
58
+ /**
59
+ * Parse contour()/contourf() arguments.
60
+ *
61
+ * Supported forms:
62
+ * contour(Z)
63
+ * contour(Z, N)
64
+ * contour(X, Y, Z)
65
+ * contour(X, Y, Z, N)
66
+ * contour(..., Name, Value)
67
+ */
68
+ export declare function parseContourArgs(args: RuntimeValue[], filled: boolean): ContourTrace;
69
+ /**
70
+ * Parse mesh() arguments — same as surf but with different default rendering.
71
+ */
72
+ export declare function parseMeshArgs(args: RuntimeValue[]): SurfTrace;
73
+ /**
74
+ * Parse bar() arguments.
75
+ *
76
+ * Supported forms:
77
+ * bar(Y) — Y values with x = 1:length(Y)
78
+ * bar(X, Y) — explicit X positions
79
+ * bar(..., width) — relative bar width (scalar 0–1)
80
+ * bar(..., color) — single-char color spec
81
+ */
82
+ export declare function parseBarArgs(args: RuntimeValue[]): BarTrace[];
83
+ /**
84
+ * Parse barh() arguments — same forms as bar() but rendered horizontally.
85
+ *
86
+ * Supported forms:
87
+ * barh(Y) — Y values (bar lengths) with positions = 1:length(Y)
88
+ * barh(X, Y) — explicit positions X, bar lengths Y
89
+ * barh(..., width) — relative bar thickness (scalar 0–1)
90
+ * barh(..., color) — single-char color spec
91
+ */
92
+ export declare function parseBarHArgs(args: RuntimeValue[]): BarTrace[];
93
+ /**
94
+ * Parse bar3() / bar3h() arguments.
95
+ *
96
+ * Supported forms:
97
+ * bar3(Z) — Z values with y = 1:m, x = 1:n
98
+ * bar3(Y, Z) — explicit Y positions
99
+ * bar3(..., width) — relative bar width (scalar 0–1)
100
+ * bar3(..., color) — single-char color spec
101
+ */
102
+ export declare function parseBar3Args(args: RuntimeValue[]): Bar3Trace;
103
+ /**
104
+ * Parse stairs() arguments — same forms as plot() but with staircase-transformed coordinates.
105
+ *
106
+ * Supported forms:
107
+ * stairs(Y)
108
+ * stairs(X, Y)
109
+ * stairs(..., LineSpec)
110
+ * stairs(..., Name, Value)
111
+ */
112
+ export declare function parseStairsArgs(args: RuntimeValue[]): PlotTrace[];
113
+ /**
114
+ * Parse errorbar() arguments.
115
+ *
116
+ * Supported forms:
117
+ * errorbar(y, err) — symmetric vertical
118
+ * errorbar(x, y, err) — symmetric vertical with explicit x
119
+ * errorbar(x, y, neg, pos) — asymmetric vertical
120
+ * errorbar(x, y, yneg, ypos, xneg, xpos) — both axes
121
+ * errorbar(..., LineSpec)
122
+ */
123
+ export declare function parseErrorBarArgs(args: RuntimeValue[]): ErrorBarTrace[];
124
+ /**
125
+ * Parse area() arguments.
126
+ *
127
+ * Supported forms:
128
+ * area(Y) — fill under Y with x = 1:length(Y)
129
+ * area(X, Y) — explicit X
130
+ * area(..., basevalue) — scalar baseline (default 0)
131
+ * area(..., Name, Value)
132
+ *
133
+ * Returns { traces, baseValue }.
134
+ */
135
+ export declare function parseAreaArgs(args: RuntimeValue[]): {
136
+ traces: PlotTrace[];
137
+ baseValue: number;
138
+ };
139
+ /**
140
+ * Parse scatter3() arguments.
141
+ *
142
+ * Supported forms:
143
+ * scatter3(X, Y, Z)
144
+ * scatter3(X, Y, Z, S)
145
+ * scatter3(X, Y, Z, S, C)
146
+ * scatter3(..., 'filled')
147
+ * scatter3(..., markertype)
148
+ */
149
+ export declare function parseScatter3Args(args: RuntimeValue[]): Plot3Trace[];
150
+ /**
151
+ * Parse histogram() arguments.
152
+ *
153
+ * Supported forms:
154
+ * histogram(X)
155
+ * histogram(X, nbins)
156
+ * histogram(X, edges)
157
+ */
158
+ export declare function parseHistogramArgs(args: RuntimeValue[]): BarTrace[];
159
+ /**
160
+ * Parse histogram2() arguments.
161
+ *
162
+ * Supported forms:
163
+ * histogram2(X, Y)
164
+ * histogram2(X, Y, nbins) — nbins is scalar or [nx, ny]
165
+ * histogram2(X, Y, Xedges, Yedges)
166
+ */
167
+ export declare function parseHistogram2Args(args: RuntimeValue[]): Bar3Trace;
168
+ /**
169
+ * Parse boxchart() arguments.
170
+ *
171
+ * Supported forms:
172
+ * boxchart(ydata) — one box per column of ydata
173
+ * boxchart(xgroupdata, ydata) — group ydata by unique values in xgroupdata
174
+ */
175
+ export declare function parseBoxchartArgs(args: RuntimeValue[]): BoxTrace[];
176
+ /**
177
+ * Parse swarmchart() arguments.
178
+ *
179
+ * Supported forms:
180
+ * swarmchart(x, y)
181
+ * swarmchart(x, y, sz)
182
+ * swarmchart(x, y, sz, c)
183
+ * swarmchart(..., 'filled')
184
+ * swarmchart(..., markertype)
185
+ */
186
+ export declare function parseSwarmchartArgs(args: RuntimeValue[]): PlotTrace[];
187
+ /**
188
+ * Parse swarmchart3() arguments.
189
+ *
190
+ * Supported forms:
191
+ * swarmchart3(x, y, z)
192
+ * swarmchart3(x, y, z, sz)
193
+ * swarmchart3(x, y, z, sz, c)
194
+ * swarmchart3(..., 'filled')
195
+ * swarmchart3(..., markertype)
196
+ */
197
+ export declare function parseSwarmchart3Args(args: RuntimeValue[]): Plot3Trace[];
198
+ /**
199
+ * Parse piechart() / donutchart() arguments.
200
+ *
201
+ * Supported forms:
202
+ * piechart(data)
203
+ * piechart(data, names)
204
+ *
205
+ * @param innerRadius 0 for pie, >0 for donut
206
+ */
207
+ export declare function parsePiechartArgs(args: RuntimeValue[], innerRadius: number): PieTrace;
208
+ /**
209
+ * Parse heatmap() arguments.
210
+ *
211
+ * Supported forms:
212
+ * heatmap(cdata) — matrix of values
213
+ * heatmap(xvalues, yvalues, cdata) — with axis labels
214
+ */
215
+ export declare function parseHeatmapArgs(args: RuntimeValue[]): HeatmapTrace;
@@ -0,0 +1,314 @@
1
+ /**
2
+ * Simplified runtime providing the $rt interface for generated JS.
3
+ *
4
+ * This is a focused rewrite of runtime/runtime.ts (~3300 lines) that provides
5
+ * exactly the methods the codegen emits, without class support, namespace
6
+ * dispatch, WebGPU, subsref/subsasgn overloads, or property accessors.
7
+ *
8
+ * It reuses existing runtime value types, operations, indexing, and builtins.
9
+ *
10
+ * Operator functions are in runtimeOperators.ts, dispatch/registration in
11
+ * runtimeDispatch.ts, and helper types/utilities in runtimeHelpers.ts.
12
+ */
13
+ import { type RuntimeValue, type RuntimeLogical, type RuntimeTensor, type RuntimeStruct, type RuntimeString, type RuntimeFunction, RuntimeError, type CallFrame } from "../runtime/index.js";
14
+ import { RuntimeChar, RuntimeCell, type RuntimeComplexNumber } from "../runtime/types.js";
15
+ import { type ItemType } from "../lowering/itemTypes.js";
16
+ import type { PlotInstruction } from "../../graphics/types.js";
17
+ import type { ExecOptions } from "../executeCode.js";
18
+ import type { FileIOAdapter } from "../fileIOAdapter.js";
19
+ import type { SystemAdapter } from "../systemAdapter.js";
20
+ import { type CallSite } from "./runtimeHelpers.js";
21
+ export declare class Runtime {
22
+ private options;
23
+ private initialVariableValues?;
24
+ outputLines: string[];
25
+ plotInstructions: PlotInstruction[];
26
+ variableValues: Record<string, RuntimeValue>;
27
+ holdState: boolean;
28
+ $line: number;
29
+ $file: string | null;
30
+ $callStack: CallFrame[];
31
+ COLON: symbol;
32
+ END: symbol;
33
+ RTV: {
34
+ num(value: number): import("../runtime/types.js").RuntimeNumber;
35
+ tensor(data: import("../runtime/types.js").FloatXArrayType | number[], shape: number[], imag?: import("../runtime/types.js").FloatXArrayType | number[]): RuntimeTensor;
36
+ tensorRaw(data: import("../runtime/types.js").FloatXArrayType, shape: number[]): RuntimeTensor;
37
+ scalar(value: number): import("../runtime/types.js").RuntimeNumber;
38
+ row(data: number[], imag?: number[]): RuntimeTensor;
39
+ col(data: number[], imag?: number[]): RuntimeTensor;
40
+ matrix(rows: number, cols: number, data: number[] | import("../runtime/types.js").FloatXArrayType, imag?: number[] | import("../runtime/types.js").FloatXArrayType): RuntimeTensor;
41
+ string(value: string): RuntimeString;
42
+ char(value: string): RuntimeChar;
43
+ logical(value: boolean): RuntimeLogical;
44
+ cell(data: RuntimeValue[], shape: number[]): RuntimeCell;
45
+ struct(fields: Map<string, RuntimeValue> | Record<string, RuntimeValue>): RuntimeStruct;
46
+ func(name: string, impl: "builtin" | "user", captures?: RuntimeValue[]): RuntimeFunction;
47
+ classInstance(className: string, propertyNames: string[], isHandleClass?: boolean, defaults?: Map<string, RuntimeValue>): import("../runtime/types.js").RuntimeClassInstance;
48
+ complex(re: number, im: number): RuntimeComplexNumber;
49
+ dummyHandle(): import("../runtime/types.js").RuntimeDummyHandle;
50
+ structArray(fieldNames: string[], elements: RuntimeStruct[]): import("../runtime/types.js").RuntimeStructArray;
51
+ sparseMatrix(m: number, n: number, ir: Int32Array, jc: Int32Array, pr: Float64Array, pi?: Float64Array): import("../runtime/types.js").RuntimeSparseMatrix;
52
+ dictionary(entries?: Map<string, {
53
+ key: RuntimeValue;
54
+ value: RuntimeValue;
55
+ }>, keyType?: string, valueType?: string): import("../runtime/types.js").RuntimeDictionary;
56
+ };
57
+ private persistentStore;
58
+ $g: Record<string, RuntimeValue>;
59
+ activeAccessors: Set<string>;
60
+ resolveClassMethod: ((className: string, methodName: string) => ((...args: any[]) => any) | null) | null;
61
+ getClassParent: ((className: string) => string | null) | null;
62
+ classMethodCache: Map<string, ((...args: any[]) => any) | null>;
63
+ /** Callback for addpath/rmpath — mutates search paths and rebuilds function index. */
64
+ onPathChange: ((action: "add" | "remove", dir: string, position: "begin" | "end") => void) | null;
65
+ /** Reference to the active search paths (set by executeCode). */
66
+ searchPaths: string[];
67
+ workspaceAccessors: Map<string, {
68
+ get: () => unknown;
69
+ set: (v: unknown) => void;
70
+ }>;
71
+ dynamicWorkspaceVars: Map<string, unknown>;
72
+ callerAccessorStack: (Record<string, [
73
+ () => unknown,
74
+ (v: unknown) => void
75
+ ]> | null)[];
76
+ private dynamicCallerVarStack;
77
+ fileIO?: FileIOAdapter;
78
+ system?: SystemAdapter;
79
+ builtins: Record<string, (nargout: number, args: unknown[]) => unknown>;
80
+ customBuiltins: Record<string, (nargout: number, args: unknown[]) => unknown>;
81
+ compileSpecialized: ((name: string, argTypes: ItemType[], callSite: CallSite) => ((...args: any[]) => any) | null) | null;
82
+ evalLocalCallback: ((code: string, initialVars: Record<string, RuntimeValue>, onOutput: (text: string) => void, fileName?: string) => {
83
+ returnValue: unknown;
84
+ variableValues: Record<string, RuntimeValue>;
85
+ searchPaths?: string[];
86
+ workspaceFiles?: import("../../numbl-core/workspace/index.js").WorkspaceFile[];
87
+ }) | null;
88
+ jitFunctionCode: Map<string, string>;
89
+ private dispatchUnknownCache;
90
+ dispatchUnknownCounts: Map<string, number>;
91
+ profilingEnabled: boolean;
92
+ private profileStack;
93
+ private profileAccum;
94
+ private profileCounts;
95
+ constructor(options: ExecOptions, initialVariableValues?: Record<string, RuntimeValue> | undefined);
96
+ private initBuiltins;
97
+ profileEnter(key: string): void;
98
+ profileLeave(): void;
99
+ getBuiltinProfile(): Record<string, {
100
+ fallback: {
101
+ totalTimeMs: number;
102
+ callCount: number;
103
+ };
104
+ interp: {
105
+ totalTimeMs: number;
106
+ callCount: number;
107
+ };
108
+ jit: {
109
+ totalTimeMs: number;
110
+ callCount: number;
111
+ };
112
+ }>;
113
+ getDispatchProfile(): Record<string, {
114
+ totalTimeMs: number;
115
+ callCount: number;
116
+ }>;
117
+ getJitCompileTimeMs(): number;
118
+ getDispatchUnknownCounts(): Record<string, number>;
119
+ output(text: string): void;
120
+ error(message: string): RuntimeError;
121
+ annotateError(e: unknown): void;
122
+ wrapError(e: unknown): RuntimeStruct;
123
+ pushCallFrame(name: string): void;
124
+ popCallFrame(): void;
125
+ toBool(v: unknown): boolean;
126
+ toNumber(v: unknown): number;
127
+ lg(v: boolean): RuntimeLogical;
128
+ /** Scalar power that returns complex for negative base with fractional exponent */
129
+ pow(a: number, b: number): number | RuntimeComplexNumber;
130
+ share(v: unknown): RuntimeValue;
131
+ displayResult(v: unknown): void;
132
+ displayAssign(name: string, v: unknown): void;
133
+ getConstant(name: string): RuntimeValue;
134
+ makeChar(raw: string): RuntimeChar;
135
+ makeString(raw: string): RuntimeString;
136
+ getInitialVariableValue(name: string): RuntimeValue | undefined;
137
+ setVariableValue(name: string, value: RuntimeValue | undefined): void;
138
+ /** Collect defined variable names from getters and apply argument filters. */
139
+ private filterVarNames;
140
+ /** Get shape of a runtime value as a number array. */
141
+ private static varShape;
142
+ /** Estimate bytes for a runtime value. */
143
+ private static varBytes;
144
+ /** Check if a runtime value is complex. */
145
+ private static varIsComplex;
146
+ /** Check if a runtime value is sparse. */
147
+ private static varIsSparse;
148
+ who(nargout: number, getters: Record<string, () => unknown>, args: unknown[]): unknown;
149
+ /** Build info record for a single variable. */
150
+ private static varInfo;
151
+ private static whosStruct;
152
+ whos(nargout: number, getters: Record<string, () => unknown>, args: unknown[]): unknown;
153
+ setWorkspaceAccessor(name: string, getter: () => unknown, setter: (v: unknown) => void): void;
154
+ getWorkspaceVariable(name: string): unknown | undefined;
155
+ setWorkspaceVariable(name: string, value: unknown): void;
156
+ pushCallerAccessors(accessors: Record<string, [() => unknown, (v: unknown) => void]> | null): void;
157
+ popCallerAccessors(): void;
158
+ getCallerVariable(name: string): unknown | undefined;
159
+ setCallerVariable(name: string, value: unknown): void;
160
+ evalLocal(code: unknown, accessors: Record<string, [() => unknown, (v: unknown) => void]>): unknown;
161
+ getPersistent(funcId: string, varName: string): RuntimeValue;
162
+ setPersistent(funcId: string, varName: string, value: RuntimeValue): void;
163
+ uplus(v: unknown): RuntimeValue;
164
+ uminus(v: unknown): unknown;
165
+ transpose(v: unknown): unknown;
166
+ ctranspose(v: unknown): unknown;
167
+ not(v: unknown): RuntimeLogical | RuntimeTensor;
168
+ private static readonly binopMethodMap;
169
+ binop(op: string, a: unknown, b: unknown): unknown;
170
+ range(start: unknown, step: unknown, end: unknown): unknown;
171
+ forIter(v: unknown): unknown[];
172
+ emptyTensor(): RuntimeTensor;
173
+ emptyStruct(): RuntimeStruct;
174
+ makeCell(elems: unknown[], shape: number[]): RuntimeCell;
175
+ /**
176
+ * Build a struct from trailing name-value pair arguments.
177
+ * @param nvArgs The rest-parameter array of trailing name-value pairs
178
+ * @param defaults An object mapping field names to default values
179
+ */
180
+ buildNameValueStruct(nvArgs: unknown[], defaults: Record<string, unknown>): RuntimeStruct;
181
+ horzcat(elems: unknown[]): unknown;
182
+ vertcat(rows: unknown[]): unknown;
183
+ switchMatch(control: unknown, caseVal: unknown): boolean;
184
+ getFuncHandle(name: string): RuntimeFunction;
185
+ makeUserFuncHandle(jsFn: (...args: unknown[]) => unknown, nargin?: number): RuntimeFunction;
186
+ isa(value: unknown, classNameArg: unknown): RuntimeLogical;
187
+ callSuperConstructor(target: unknown, superInstance: unknown): unknown;
188
+ createClassInstance(className: string, propertyNames: string[], defaults?: Record<string, unknown>, isHandleClass?: boolean): RuntimeValue;
189
+ /**
190
+ * Resolve a class method by name, using cache + JIT compilation.
191
+ * Returns the compiled method function or null if it doesn't exist.
192
+ */
193
+ cachedResolveClassMethod(className: string, methodName: string): ((...args: any[]) => any) | null;
194
+ /**
195
+ * Get the parent class name, using the compiler callback.
196
+ * Returns null if no parent or no callback registered.
197
+ */
198
+ getClassParentName(className: string): string | null;
199
+ /** Get the class name from a runtime value (for dynamic static method dispatch). */
200
+ getClassName(value: unknown): string;
201
+ dispatch(name: string, nargout: number, args: unknown[]): unknown;
202
+ methodDispatch(name: string, nargout: number, args: unknown[]): unknown;
203
+ callBuiltin(name: string, nargout: number, args: unknown[]): unknown;
204
+ callClassMethod(className: string, methodName: string, nargout: number, args: unknown[]): unknown;
205
+ /**
206
+ * JIT dispatch for function calls where argument types were unknown at
207
+ * compile time. Inspects runtime values to infer types, asks the compiler
208
+ * to JIT-compile a specialized version, then calls it. The compiler
209
+ * handles the full resolution chain (local → class method → workspace)
210
+ * internally using the callSite for context.
211
+ */
212
+ dispatchUnknown(name: string, nargout: number, args: unknown[], callSite: CallSite): unknown;
213
+ index(base: unknown, indices: unknown[], nargout?: number, skipSubsref?: boolean | string): unknown;
214
+ indexCell(base: unknown, indices: unknown[]): unknown;
215
+ /** Normalize a cell indexing result into an array for CSL spreading.
216
+ * If the result is already an array (multi-element indexing), return it as-is.
217
+ * If it's a single value (scalar indexing), wrap it in an array. */
218
+ asCsl(value: unknown): unknown[];
219
+ /** Like index() but returns an empty struct instead of throwing.
220
+ * Used for chained lvalue assignment: V(i).field = rhs where V may be uninitialized. */
221
+ indexOrEmpty(base: unknown, indices: unknown[]): unknown;
222
+ /** Like indexOrEmpty() but uses built-in indexing (bypasses subsref) for
223
+ * class instances. For scalar class instances, V(1) returns V itself.
224
+ * Used in V(i).field = rhs patterns where the () part should always use
225
+ * built-in array indexing, not the class's overloaded subsref. */
226
+ builtinIndexOrEmpty(base: unknown, indices: unknown[]): unknown;
227
+ /** Like indexCell() but returns 0 instead of throwing.
228
+ * Used for chained lvalue assignment: data{i}.field = rhs where data may be uninitialized. */
229
+ indexCellOrEmpty(base: unknown, indices: unknown[]): unknown;
230
+ indexStore(base: unknown, indices: unknown[], rhs: unknown, skipSubsasgn?: boolean): unknown;
231
+ /** Built-in index store for V(i).field = rhs patterns.
232
+ * For class instances, the element was already modified via setMemberReturn
233
+ * so we just return the new value. For other types, delegate to indexStore. */
234
+ builtinIndexStore(base: unknown, indices: unknown[], value: unknown): unknown;
235
+ /** Check if a value is a class instance of the given class name.
236
+ * Used by codegen for runtime skipSubsasgn checks on Unknown-type variables. */
237
+ isClassInstance(value: unknown, className: string): boolean;
238
+ indexCellStore(base: unknown, indices: unknown[], rhs: unknown): unknown;
239
+ multiOutputCellAssign(base: unknown, indices: unknown, results: unknown[]): unknown;
240
+ getMember(base: unknown, name: string): unknown;
241
+ getMemberDynamic(base: unknown, nameExpr: unknown): RuntimeValue;
242
+ getMemberOrEmpty(base: unknown, name: string): RuntimeValue;
243
+ setMember(_base: unknown, _name: string, _rhs: unknown): void;
244
+ setMemberReturn(base: unknown, name: string, rhs: unknown): unknown;
245
+ setMemberDynamicReturn(base: unknown, nameExpr: unknown, rhs: unknown): RuntimeValue;
246
+ subsrefCall(base: unknown, names: string[]): unknown;
247
+ subsasgnCall(base: unknown, names: string[], rhs: unknown): unknown;
248
+ memberChainAssign(base: unknown, names: string[], rhs: unknown): unknown;
249
+ narginchk(actualNargin: unknown, minArgs: unknown, maxArgs: unknown): void;
250
+ nargoutchk(actualNargout: unknown, minArgs: unknown, maxArgs: unknown): void;
251
+ plot_instr(instr: {
252
+ type: "set_figure_handle";
253
+ handle: unknown;
254
+ } | {
255
+ type: "plot";
256
+ x: unknown;
257
+ y: unknown;
258
+ } | {
259
+ type: "set_hold";
260
+ value: unknown;
261
+ } | {
262
+ type: "close";
263
+ } | {
264
+ type: "close_all";
265
+ } | {
266
+ type: "clf";
267
+ } | {
268
+ type: "set_subplot";
269
+ rows: unknown;
270
+ cols: unknown;
271
+ index: unknown;
272
+ } | {
273
+ type: "set_sgtitle";
274
+ text: unknown;
275
+ } | {
276
+ type: "set_grid";
277
+ value: unknown;
278
+ }): void;
279
+ ishold(): RuntimeValue;
280
+ plot_call(args: RuntimeValue[]): void;
281
+ plot3_call(args: RuntimeValue[]): void;
282
+ surf_call(args: RuntimeValue[]): void;
283
+ scatter_call(args: RuntimeValue[]): void;
284
+ imagesc_call(args: RuntimeValue[]): void;
285
+ contour_call(args: RuntimeValue[], filled: boolean): void;
286
+ mesh_call(args: RuntimeValue[]): void;
287
+ bar_call(args: RuntimeValue[]): void;
288
+ barh_call(args: RuntimeValue[]): void;
289
+ bar3_call(args: RuntimeValue[]): void;
290
+ bar3h_call(args: RuntimeValue[]): void;
291
+ stairs_call(args: RuntimeValue[]): void;
292
+ errorbar_call(args: RuntimeValue[]): void;
293
+ semilogx_call(args: RuntimeValue[]): void;
294
+ semilogy_call(args: RuntimeValue[]): void;
295
+ loglog_call(args: RuntimeValue[]): void;
296
+ area_call(args: RuntimeValue[]): void;
297
+ fplot_call(args: RuntimeValue[]): void;
298
+ fplot3_call(args: RuntimeValue[]): void;
299
+ scatter3_call(args: RuntimeValue[]): void;
300
+ histogram_call(args: RuntimeValue[]): void;
301
+ histogram2_call(args: RuntimeValue[]): void;
302
+ boxchart_call(args: RuntimeValue[]): void;
303
+ swarmchart_call(args: RuntimeValue[]): void;
304
+ swarmchart3_call(args: RuntimeValue[]): void;
305
+ piechart_call(args: RuntimeValue[]): void;
306
+ donutchart_call(args: RuntimeValue[]): void;
307
+ heatmap_call(args: RuntimeValue[]): void;
308
+ view_call(args: RuntimeValue[]): void;
309
+ legend_call(args: RuntimeValue[]): void;
310
+ drawnow(): void;
311
+ pause(seconds: unknown): void;
312
+ readInput(prompt: string): string;
313
+ }
314
+ export declare const rstr: (s: RuntimeString | RuntimeChar) => string;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Runtime dispatch, registration, and higher-order functions.
3
+ *
4
+ * Standalone functions that take the Runtime instance as the first parameter.
5
+ * Handles function/class dispatch, arrayfun/cellfun/bsxfun, and subsref/subsasgn.
6
+ */
7
+ import { type RuntimeValue, type RuntimeLogical, type RuntimeFunction } from "../runtime/index.js";
8
+ import type { Runtime } from "./runtime.js";
9
+ export declare function getFuncHandle(name: string): RuntimeFunction;
10
+ export declare function makeUserFuncHandle(jsFn: (...args: unknown[]) => unknown, nargin?: number): RuntimeFunction;
11
+ export declare function isa(rt: Runtime, value: unknown, classNameArg: unknown): RuntimeLogical;
12
+ export declare function callSuperConstructor(target: unknown, superInstance: unknown): RuntimeValue;
13
+ export declare function createClassInstance(_rt: Runtime, className: string, propertyNames: string[], defaults?: Record<string, unknown>, isHandleClass?: boolean): RuntimeValue;
14
+ export declare function dispatch(rt: Runtime, name: string, nargout: number, args: unknown[], targetClassName?: string): unknown;
15
+ /** Direct builtin call — skips local/workspace/registry lookup. */
16
+ export declare function callBuiltin(rt: Runtime, name: string, nargout: number, args: unknown[]): unknown;
17
+ /** Direct class method call — delegates to unified dispatch with targetClassName. */
18
+ export declare function callClassMethod(rt: Runtime, className: string, methodName: string, nargout: number, args: unknown[]): unknown;
19
+ export declare function methodDispatch(rt: Runtime, name: string, nargout: number, args: unknown[]): unknown;
20
+ export declare function arrayfunImpl(rt: Runtime, nargout: number, args: unknown[]): unknown;
21
+ export declare function cellfunImpl(rt: Runtime, nargout: number, args: unknown[]): unknown;
22
+ export declare function structfunImpl(rt: Runtime, _nargout: number, args: unknown[]): unknown;
23
+ export declare function bsxfunImpl(rt: Runtime, _nargout: number, args: unknown[]): unknown;
24
+ /** Return the class name for a runtime value */
25
+ export declare function numblClass(v: RuntimeValue): string;
26
+ export declare function subsrefBuiltin(rt: Runtime, nargout: number, args: unknown[]): unknown;
27
+ export declare function subsasgnBuiltin(rt: Runtime, _nargout: number, args: unknown[]): unknown;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Runtime helper types and standalone utility functions.
3
+ *
4
+ * Types and pure functions
5
+ * These have no dependency on the Runtime class.
6
+ */
7
+ import { type RuntimeValue } from "../runtime/index.js";
8
+ import { END_SENTINEL } from "./sentinels.js";
9
+ export type DeferredRange = {
10
+ _deferredRange: true;
11
+ start: RuntimeValue | typeof END_SENTINEL;
12
+ step: RuntimeValue | typeof END_SENTINEL;
13
+ end: RuntimeValue | typeof END_SENTINEL;
14
+ };
15
+ export declare function isDeferredRange(v: unknown): v is DeferredRange;
16
+ export type DeferredHorzcat = {
17
+ _deferredHorzcat: true;
18
+ elems: (RuntimeValue | typeof END_SENTINEL | DeferredRange)[];
19
+ };
20
+ export declare function isDeferredHorzcat(v: unknown): v is DeferredHorzcat;
21
+ export declare function ensureRuntimeValue(v: unknown): RuntimeValue;
22
+ export declare function switchValuesMatch(a: RuntimeValue, b: RuntimeValue): boolean;
23
+ export declare function isNumericKind(v: RuntimeValue): boolean;
24
+ export declare function elementWiseLogicalOp(a: RuntimeValue, b: RuntimeValue, op: (x: number, y: number) => number): RuntimeValue;
25
+ /** Where a function call originates (passed from codegen into runtime). */
26
+ export type CallSite = {
27
+ file: string;
28
+ className?: string;
29
+ methodName?: string;
30
+ targetClassName?: string;
31
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Runtime indexing operations.
3
+ *
4
+ * This module contains all indexing-related functionality for the runtime,
5
+ * including array indexing, cell indexing, and indexed assignment operations.
6
+ */
7
+ import type { Runtime } from "./runtime.js";
8
+ /**
9
+ * Index into a runtime value or call a function with arguments.
10
+ */
11
+ export declare function index(rt: Runtime, base: unknown, indices: unknown[], nargout?: number, skipSubsref?: boolean | string): unknown;
12
+ /**
13
+ * Cell indexing with support for comma-separated lists (CSL).
14
+ */
15
+ export declare function indexCell(rt: Runtime, base: unknown, indices: unknown[]): unknown;
16
+ /**
17
+ * Indexed assignment with support for struct arrays, cell deletion, and scalar expansion.
18
+ */
19
+ export declare function indexStore(rt: Runtime, base: unknown, indices: unknown[], rhs: unknown, skipSubsasgn?: boolean): unknown;
20
+ /**
21
+ * Cell-indexed assignment (curly braces).
22
+ */
23
+ export declare function indexCellStore(base: unknown, indices: unknown[], rhs: unknown): unknown;
24
+ /**
25
+ * Multi-output assignment to cell elements: [c{idx}] = func()
26
+ * Distributes individual results to individual cell positions.
27
+ */
28
+ export declare function multiOutputCellAssign(base: unknown, indices: unknown, results: unknown[]): unknown;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Member access operations for the runtime.
3
+ */
4
+ import { type RuntimeValue } from "../runtime/index.js";
5
+ import type { Runtime } from "./runtime.js";
6
+ export declare function getMember(rt: Runtime, base: unknown, name: string): unknown;
7
+ export declare function getMemberDynamic(base: unknown, nameExpr: unknown): RuntimeValue;
8
+ export declare function getMemberOrEmpty(base: unknown, name: string): RuntimeValue;
9
+ export declare function setMemberReturn(rt: Runtime, base: unknown, name: string, rhs: unknown): unknown;
10
+ export declare function setMemberDynamicReturn(base: unknown, nameExpr: unknown, rhs: unknown): RuntimeValue;
11
+ /**
12
+ * Call a user-defined subsref method on a class instance.
13
+ * Constructs S = struct('type', '.', 'subs', name) for each name in the chain.
14
+ */
15
+ export declare function subsrefCall(rt: Runtime, base: unknown, names: string[]): unknown;
16
+ /**
17
+ * Call a user-defined subsasgn method on a class instance.
18
+ * Constructs S = struct('type', '.', 'subs', name) for each name in the chain.
19
+ */
20
+ export declare function subsasgnCall(rt: Runtime, base: unknown, names: string[], rhs: unknown): unknown;
21
+ /**
22
+ * Runtime dispatch for member chain assignment when the type is unknown
23
+ * at compile time. If the base is a class instance with overloaded
24
+ * subsasgn, routes through subsasgnCall; otherwise uses normal chain.
25
+ */
26
+ export declare function memberChainAssign(rt: Runtime, base: unknown, names: string[], rhs: unknown): unknown;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Runtime operator and construction functions.
3
+ *
4
+ * Standalone functions for operators, range/iteration, and data construction.
5
+ * None of these depend on the Runtime class instance.
6
+ */
7
+ import { type RuntimeValue, type RuntimeLogical, type RuntimeTensor, type RuntimeStruct, type RuntimeCell } from "../runtime/index.js";
8
+ import { END_SENTINEL } from "./sentinels.js";
9
+ import { type DeferredHorzcat } from "./runtimeHelpers.js";
10
+ export declare function uplus(v: unknown): RuntimeValue;
11
+ export declare function uminus(v: unknown): unknown;
12
+ export declare function transpose(v: unknown): unknown;
13
+ export declare function ctranspose(v: unknown): unknown;
14
+ export declare function not(v: unknown): RuntimeLogical | RuntimeTensor;
15
+ export declare function binop(op: string, a: unknown, b: unknown): unknown;
16
+ export declare function range(start: unknown, step: unknown, end: unknown): unknown;
17
+ export declare function forIter(v: unknown): unknown[];
18
+ export declare function emptyTensor(): RuntimeTensor;
19
+ export declare function emptyStruct(): RuntimeStruct;
20
+ export declare function makeCell(elems: unknown[], shape: number[]): RuntimeCell;
21
+ export declare function opHorzcat(elems: unknown[]): unknown;
22
+ export declare function resolveHorzcat(dh: DeferredHorzcat, resolve: (v: RuntimeValue | typeof END_SENTINEL) => number): RuntimeValue;
23
+ export declare function opVertcat(rows: unknown[]): unknown;
24
+ export declare function switchMatch(control: unknown, caseVal: unknown): boolean;