openalgo-script 0.1.0-alpha.1 → 0.4.0
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.
- package/CHANGELOG.md +1469 -0
- package/README.md +85 -30
- package/dist/adapters/charts/alerts.d.ts +70 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -0
- package/dist/adapters/charts/alerts.js +52 -0
- package/dist/adapters/charts/alerts.js.map +1 -0
- package/dist/adapters/charts/bars.d.ts +39 -0
- package/dist/adapters/charts/bars.d.ts.map +1 -0
- package/dist/adapters/charts/bars.js +32 -0
- package/dist/adapters/charts/bars.js.map +1 -0
- package/dist/adapters/charts/candles.d.ts +40 -0
- package/dist/adapters/charts/candles.d.ts.map +1 -0
- package/dist/adapters/charts/candles.js +85 -0
- package/dist/adapters/charts/candles.js.map +1 -0
- package/dist/adapters/charts/colours.d.ts +47 -0
- package/dist/adapters/charts/colours.d.ts.map +1 -0
- package/dist/adapters/charts/colours.js +80 -0
- package/dist/adapters/charts/colours.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +37 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -0
- package/dist/adapters/charts/columns.js +56 -0
- package/dist/adapters/charts/columns.js.map +1 -0
- package/dist/adapters/charts/contract.d.ts +278 -0
- package/dist/adapters/charts/contract.d.ts.map +1 -0
- package/dist/adapters/charts/contract.js +2 -0
- package/dist/adapters/charts/contract.js.map +1 -0
- package/dist/adapters/charts/descriptor.d.ts +48 -0
- package/dist/adapters/charts/descriptor.d.ts.map +1 -0
- package/dist/adapters/charts/descriptor.js +111 -0
- package/dist/adapters/charts/descriptor.js.map +1 -0
- package/dist/adapters/charts/drawings.d.ts +43 -0
- package/dist/adapters/charts/drawings.d.ts.map +1 -0
- package/dist/adapters/charts/drawings.js +172 -0
- package/dist/adapters/charts/drawings.js.map +1 -0
- package/dist/adapters/charts/errors.d.ts +28 -0
- package/dist/adapters/charts/errors.d.ts.map +1 -0
- package/dist/adapters/charts/errors.js +21 -0
- package/dist/adapters/charts/errors.js.map +1 -0
- package/dist/adapters/charts/fields.d.ts +33 -0
- package/dist/adapters/charts/fields.d.ts.map +1 -0
- package/dist/adapters/charts/fields.js +51 -0
- package/dist/adapters/charts/fields.js.map +1 -0
- package/dist/adapters/charts/fills.d.ts +23 -0
- package/dist/adapters/charts/fills.d.ts.map +1 -0
- package/dist/adapters/charts/fills.js +48 -0
- package/dist/adapters/charts/fills.js.map +1 -0
- package/dist/adapters/charts/index.d.ts +37 -0
- package/dist/adapters/charts/index.d.ts.map +1 -0
- package/dist/adapters/charts/index.js +33 -0
- package/dist/adapters/charts/index.js.map +1 -0
- package/dist/adapters/charts/levels.d.ts +39 -0
- package/dist/adapters/charts/levels.d.ts.map +1 -0
- package/dist/adapters/charts/levels.js +61 -0
- package/dist/adapters/charts/levels.js.map +1 -0
- package/dist/adapters/charts/markers.d.ts +41 -0
- package/dist/adapters/charts/markers.d.ts.map +1 -0
- package/dist/adapters/charts/markers.js +75 -0
- package/dist/adapters/charts/markers.js.map +1 -0
- package/dist/adapters/charts/paint.d.ts +61 -0
- package/dist/adapters/charts/paint.d.ts.map +1 -0
- package/dist/adapters/charts/paint.js +47 -0
- package/dist/adapters/charts/paint.js.map +1 -0
- package/dist/adapters/charts/plots.d.ts +39 -0
- package/dist/adapters/charts/plots.d.ts.map +1 -0
- package/dist/adapters/charts/plots.js +117 -0
- package/dist/adapters/charts/plots.js.map +1 -0
- package/dist/adapters/charts/produced.d.ts +57 -0
- package/dist/adapters/charts/produced.d.ts.map +1 -0
- package/dist/adapters/charts/produced.js +11 -0
- package/dist/adapters/charts/produced.js.map +1 -0
- package/dist/adapters/charts/requests.d.ts +114 -0
- package/dist/adapters/charts/requests.d.ts.map +1 -0
- package/dist/adapters/charts/requests.js +277 -0
- package/dist/adapters/charts/requests.js.map +1 -0
- package/dist/adapters/charts/run.d.ts +147 -0
- package/dist/adapters/charts/run.d.ts.map +1 -0
- package/dist/adapters/charts/run.js +148 -0
- package/dist/adapters/charts/run.js.map +1 -0
- package/dist/adapters/charts/settings.d.ts +78 -0
- package/dist/adapters/charts/settings.d.ts.map +1 -0
- package/dist/adapters/charts/settings.js +225 -0
- package/dist/adapters/charts/settings.js.map +1 -0
- package/dist/adapters/charts/surfaces.d.ts +221 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -0
- package/dist/adapters/charts/surfaces.js +2 -0
- package/dist/adapters/charts/surfaces.js.map +1 -0
- package/dist/adapters/charts/tables.d.ts +65 -0
- package/dist/adapters/charts/tables.d.ts.map +1 -0
- package/dist/adapters/charts/tables.js +166 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/adapters/codemirror/commands.d.ts +14 -0
- package/dist/adapters/codemirror/commands.d.ts.map +1 -0
- package/dist/adapters/codemirror/commands.js +52 -0
- package/dist/adapters/codemirror/commands.js.map +1 -0
- package/dist/adapters/codemirror/completion.d.ts +15 -0
- package/dist/adapters/codemirror/completion.d.ts.map +1 -0
- package/dist/adapters/codemirror/completion.js +64 -0
- package/dist/adapters/codemirror/completion.js.map +1 -0
- package/dist/adapters/codemirror/contract.d.ts +156 -0
- package/dist/adapters/codemirror/contract.d.ts.map +1 -0
- package/dist/adapters/codemirror/contract.js +42 -0
- package/dist/adapters/codemirror/contract.js.map +1 -0
- package/dist/adapters/codemirror/index.d.ts +43 -0
- package/dist/adapters/codemirror/index.d.ts.map +1 -0
- package/dist/adapters/codemirror/index.js +8 -0
- package/dist/adapters/codemirror/index.js.map +1 -0
- package/dist/adapters/codemirror/lint.d.ts +17 -0
- package/dist/adapters/codemirror/lint.d.ts.map +1 -0
- package/dist/adapters/codemirror/lint.js +62 -0
- package/dist/adapters/codemirror/lint.js.map +1 -0
- package/dist/adapters/codemirror/positions.d.ts +16 -0
- package/dist/adapters/codemirror/positions.d.ts.map +1 -0
- package/dist/adapters/codemirror/positions.js +65 -0
- package/dist/adapters/codemirror/positions.js.map +1 -0
- package/dist/adapters/codemirror/stream.d.ts +23 -0
- package/dist/adapters/codemirror/stream.d.ts.map +1 -0
- package/dist/adapters/codemirror/stream.js +70 -0
- package/dist/adapters/codemirror/stream.js.map +1 -0
- package/dist/adapters/codemirror/tokens.d.ts +44 -0
- package/dist/adapters/codemirror/tokens.d.ts.map +1 -0
- package/dist/adapters/codemirror/tokens.js +34 -0
- package/dist/adapters/codemirror/tokens.js.map +1 -0
- package/dist/adapters/codemirror/tooltips.d.ts +35 -0
- package/dist/adapters/codemirror/tooltips.d.ts.map +1 -0
- package/dist/adapters/codemirror/tooltips.js +108 -0
- package/dist/adapters/codemirror/tooltips.js.map +1 -0
- package/dist/core/accounting/charges.d.ts +136 -0
- package/dist/core/accounting/charges.d.ts.map +1 -0
- package/dist/core/accounting/charges.js +362 -0
- package/dist/core/accounting/charges.js.map +1 -0
- package/dist/core/accounting/equity.d.ts +158 -0
- package/dist/core/accounting/equity.d.ts.map +1 -0
- package/dist/core/accounting/equity.js +155 -0
- package/dist/core/accounting/equity.js.map +1 -0
- package/dist/core/accounting/index.d.ts +44 -0
- package/dist/core/accounting/index.d.ts.map +1 -0
- package/dist/core/accounting/index.js +36 -0
- package/dist/core/accounting/index.js.map +1 -0
- package/dist/core/accounting/markers.d.ts +43 -0
- package/dist/core/accounting/markers.d.ts.map +1 -0
- package/dist/core/accounting/markers.js +64 -0
- package/dist/core/accounting/markers.js.map +1 -0
- package/dist/core/accounting/monthly.d.ts +52 -0
- package/dist/core/accounting/monthly.d.ts.map +1 -0
- package/dist/core/accounting/monthly.js +99 -0
- package/dist/core/accounting/monthly.js.map +1 -0
- package/dist/core/accounting/report.d.ts +38 -0
- package/dist/core/accounting/report.d.ts.map +1 -0
- package/dist/core/accounting/report.js +63 -0
- package/dist/core/accounting/report.js.map +1 -0
- package/dist/core/accounting/shapes.d.ts +70 -0
- package/dist/core/accounting/shapes.d.ts.map +1 -0
- package/dist/core/accounting/shapes.js +21 -0
- package/dist/core/accounting/shapes.js.map +1 -0
- package/dist/core/accounting/statistics.d.ts +75 -0
- package/dist/core/accounting/statistics.d.ts.map +1 -0
- package/dist/core/accounting/statistics.js +246 -0
- package/dist/core/accounting/statistics.js.map +1 -0
- package/dist/core/accounting/trades.d.ts +118 -0
- package/dist/core/accounting/trades.d.ts.map +1 -0
- package/dist/core/accounting/trades.js +186 -0
- package/dist/core/accounting/trades.js.map +1 -0
- package/dist/core/backtest/compare.d.ts +38 -0
- package/dist/core/backtest/compare.d.ts.map +1 -0
- package/dist/core/backtest/compare.js +189 -0
- package/dist/core/backtest/compare.js.map +1 -0
- package/dist/core/backtest/declaration.d.ts +52 -0
- package/dist/core/backtest/declaration.d.ts.map +1 -0
- package/dist/core/backtest/declaration.js +48 -0
- package/dist/core/backtest/declaration.js.map +1 -0
- package/dist/core/backtest/drive.d.ts +29 -0
- package/dist/core/backtest/drive.d.ts.map +1 -0
- package/dist/core/backtest/drive.js +262 -0
- package/dist/core/backtest/drive.js.map +1 -0
- package/dist/core/backtest/index.d.ts +46 -0
- package/dist/core/backtest/index.d.ts.map +1 -0
- package/dist/core/backtest/index.js +36 -0
- package/dist/core/backtest/index.js.map +1 -0
- package/dist/core/backtest/range.d.ts +84 -0
- package/dist/core/backtest/range.d.ts.map +1 -0
- package/dist/core/backtest/range.js +90 -0
- package/dist/core/backtest/range.js.map +1 -0
- package/dist/core/backtest/record.d.ts +238 -0
- package/dist/core/backtest/record.d.ts.map +1 -0
- package/dist/core/backtest/record.js +176 -0
- package/dist/core/backtest/record.js.map +1 -0
- package/dist/core/backtest/replay.d.ts +48 -0
- package/dist/core/backtest/replay.d.ts.map +1 -0
- package/dist/core/backtest/replay.js +127 -0
- package/dist/core/backtest/replay.js.map +1 -0
- package/dist/core/backtest/resting.d.ts +62 -0
- package/dist/core/backtest/resting.d.ts.map +1 -0
- package/dist/core/backtest/resting.js +59 -0
- package/dist/core/backtest/resting.js.map +1 -0
- package/dist/core/backtest/settings.d.ts +117 -0
- package/dist/core/backtest/settings.d.ts.map +1 -0
- package/dist/core/backtest/settings.js +207 -0
- package/dist/core/backtest/settings.js.map +1 -0
- package/dist/core/backtest/simulate.d.ts +146 -0
- package/dist/core/backtest/simulate.d.ts.map +1 -0
- package/dist/core/backtest/simulate.js +217 -0
- package/dist/core/backtest/simulate.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +164 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +23 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +49 -0
- package/dist/core/catalogue/values.generated.d.ts.map +1 -1
- package/dist/core/check/arguments.d.ts +41 -0
- package/dist/core/check/arguments.d.ts.map +1 -0
- package/dist/core/check/arguments.js +84 -0
- package/dist/core/check/arguments.js.map +1 -0
- package/dist/core/check/call-sites.d.ts +22 -0
- package/dist/core/check/call-sites.d.ts.map +1 -0
- package/dist/core/check/call-sites.js +329 -0
- package/dist/core/check/call-sites.js.map +1 -0
- package/dist/core/check/call-warmup.d.ts +37 -0
- package/dist/core/check/call-warmup.d.ts.map +1 -0
- package/dist/core/check/call-warmup.js +97 -0
- package/dist/core/check/call-warmup.js.map +1 -0
- package/dist/core/check/calls.d.ts +33 -0
- package/dist/core/check/calls.d.ts.map +1 -0
- package/dist/core/check/calls.js +348 -0
- package/dist/core/check/calls.js.map +1 -0
- package/dist/core/check/check.d.ts +23 -0
- package/dist/core/check/check.d.ts.map +1 -0
- package/dist/core/check/check.js +163 -0
- package/dist/core/check/check.js.map +1 -0
- package/dist/core/check/checked.d.ts +198 -0
- package/dist/core/check/checked.d.ts.map +1 -0
- package/dist/core/check/checked.js +19 -0
- package/dist/core/check/checked.js.map +1 -0
- package/dist/core/check/checker.d.ts +182 -0
- package/dist/core/check/checker.d.ts.map +1 -0
- package/dist/core/check/checker.js +280 -0
- package/dist/core/check/checker.js.map +1 -0
- package/dist/core/check/conditional.d.ts +35 -0
- package/dist/core/check/conditional.d.ts.map +1 -0
- package/dist/core/check/conditional.js +100 -0
- package/dist/core/check/conditional.js.map +1 -0
- package/dist/core/check/constant.d.ts +47 -0
- package/dist/core/check/constant.d.ts.map +1 -0
- package/dist/core/check/constant.js +101 -0
- package/dist/core/check/constant.js.map +1 -0
- package/dist/core/check/declaration.d.ts +33 -0
- package/dist/core/check/declaration.d.ts.map +1 -0
- package/dist/core/check/declaration.js +181 -0
- package/dist/core/check/declaration.js.map +1 -0
- package/dist/core/check/expressions.d.ts +36 -0
- package/dist/core/check/expressions.d.ts.map +1 -0
- package/dist/core/check/expressions.js +398 -0
- package/dist/core/check/expressions.js.map +1 -0
- package/dist/core/check/functions.d.ts +31 -0
- package/dist/core/check/functions.d.ts.map +1 -0
- package/dist/core/check/functions.js +238 -0
- package/dist/core/check/functions.js.map +1 -0
- package/dist/core/check/handles.d.ts +48 -0
- package/dist/core/check/handles.d.ts.map +1 -0
- package/dist/core/check/handles.js +43 -0
- package/dist/core/check/handles.js.map +1 -0
- package/dist/core/check/index.d.ts +31 -0
- package/dist/core/check/index.d.ts.map +1 -0
- package/dist/core/check/index.js +26 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/library-bars.d.ts +7 -0
- package/dist/core/check/library-bars.d.ts.map +1 -0
- package/dist/core/check/library-bars.js +181 -0
- package/dist/core/check/library-bars.js.map +1 -0
- package/dist/core/check/library-orders.d.ts +5 -0
- package/dist/core/check/library-orders.d.ts.map +1 -0
- package/dist/core/check/library-orders.js +250 -0
- package/dist/core/check/library-orders.js.map +1 -0
- package/dist/core/check/library-output.d.ts +7 -0
- package/dist/core/check/library-output.d.ts.map +1 -0
- package/dist/core/check/library-output.js +195 -0
- package/dist/core/check/library-output.js.map +1 -0
- package/dist/core/check/library-prose.generated.d.ts +16 -0
- package/dist/core/check/library-prose.generated.d.ts.map +1 -0
- package/dist/core/check/library-prose.generated.js +353 -0
- package/dist/core/check/library-prose.generated.js.map +1 -0
- package/dist/core/check/library-series.d.ts +3 -0
- package/dist/core/check/library-series.d.ts.map +1 -0
- package/dist/core/check/library-series.js +415 -0
- package/dist/core/check/library-series.js.map +1 -0
- package/dist/core/check/library.d.ts +204 -0
- package/dist/core/check/library.d.ts.map +1 -0
- package/dist/core/check/library.js +198 -0
- package/dist/core/check/library.js.map +1 -0
- package/dist/core/check/literals.d.ts +19 -0
- package/dist/core/check/literals.d.ts.map +1 -0
- package/dist/core/check/literals.js +22 -0
- package/dist/core/check/literals.js.map +1 -0
- package/dist/core/check/outputs.d.ts +31 -0
- package/dist/core/check/outputs.d.ts.map +1 -0
- package/dist/core/check/outputs.js +113 -0
- package/dist/core/check/outputs.js.map +1 -0
- package/dist/core/check/statements.d.ts +25 -0
- package/dist/core/check/statements.d.ts.map +1 -0
- package/dist/core/check/statements.js +377 -0
- package/dist/core/check/statements.js.map +1 -0
- package/dist/core/check/suggest.d.ts +25 -0
- package/dist/core/check/suggest.d.ts.map +1 -0
- package/dist/core/check/suggest.js +61 -0
- package/dist/core/check/suggest.js.map +1 -0
- package/dist/core/check/surface.d.ts +62 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +129 -0
- package/dist/core/check/surface.js.map +1 -0
- package/dist/core/check/tags.d.ts +4 -0
- package/dist/core/check/tags.d.ts.map +1 -0
- package/dist/core/check/tags.js +54 -0
- package/dist/core/check/tags.js.map +1 -0
- package/dist/core/check/types.d.ts +153 -0
- package/dist/core/check/types.d.ts.map +1 -0
- package/dist/core/check/types.js +221 -0
- package/dist/core/check/types.js.map +1 -0
- package/dist/core/check/warmup.d.ts +73 -0
- package/dist/core/check/warmup.d.ts.map +1 -0
- package/dist/core/check/warmup.js +62 -0
- package/dist/core/check/warmup.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +12 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -1
- package/dist/core/diagnostics/collector.js +27 -1
- package/dist/core/diagnostics/collector.js.map +1 -1
- package/dist/core/emit/calls.d.ts +38 -0
- package/dist/core/emit/calls.d.ts.map +1 -0
- package/dist/core/emit/calls.js +347 -0
- package/dist/core/emit/calls.js.map +1 -0
- package/dist/core/emit/canonical.d.ts +39 -0
- package/dist/core/emit/canonical.d.ts.map +1 -0
- package/dist/core/emit/canonical.js +71 -0
- package/dist/core/emit/canonical.js.map +1 -0
- package/dist/core/emit/channels.d.ts +28 -0
- package/dist/core/emit/channels.d.ts.map +1 -0
- package/dist/core/emit/channels.js +110 -0
- package/dist/core/emit/channels.js.map +1 -0
- package/dist/core/emit/code.d.ts +75 -0
- package/dist/core/emit/code.d.ts.map +1 -0
- package/dist/core/emit/code.js +104 -0
- package/dist/core/emit/code.js.map +1 -0
- package/dist/core/emit/colours.d.ts +35 -0
- package/dist/core/emit/colours.d.ts.map +1 -0
- package/dist/core/emit/colours.js +50 -0
- package/dist/core/emit/colours.js.map +1 -0
- package/dist/core/emit/context.d.ts +271 -0
- package/dist/core/emit/context.d.ts.map +1 -0
- package/dist/core/emit/context.js +358 -0
- package/dist/core/emit/context.js.map +1 -0
- package/dist/core/emit/defaults.d.ts +64 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +182 -0
- package/dist/core/emit/defaults.js.map +1 -0
- package/dist/core/emit/emit.d.ts +13 -0
- package/dist/core/emit/emit.d.ts.map +1 -0
- package/dist/core/emit/emit.js +281 -0
- package/dist/core/emit/emit.js.map +1 -0
- package/dist/core/emit/events.d.ts +21 -0
- package/dist/core/emit/events.d.ts.map +1 -0
- package/dist/core/emit/events.js +112 -0
- package/dist/core/emit/events.js.map +1 -0
- package/dist/core/emit/expressions.d.ts +23 -0
- package/dist/core/emit/expressions.d.ts.map +1 -0
- package/dist/core/emit/expressions.js +253 -0
- package/dist/core/emit/expressions.js.map +1 -0
- package/dist/core/emit/functions.d.ts +30 -0
- package/dist/core/emit/functions.d.ts.map +1 -0
- package/dist/core/emit/functions.js +171 -0
- package/dist/core/emit/functions.js.map +1 -0
- package/dist/core/emit/gaps.d.ts +34 -0
- package/dist/core/emit/gaps.d.ts.map +1 -0
- package/dist/core/emit/gaps.js +16 -0
- package/dist/core/emit/gaps.js.map +1 -0
- package/dist/core/emit/index.d.ts +31 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +25 -0
- package/dist/core/emit/index.js.map +1 -0
- package/dist/core/emit/inputs.d.ts +47 -0
- package/dist/core/emit/inputs.d.ts.map +1 -0
- package/dist/core/emit/inputs.js +150 -0
- package/dist/core/emit/inputs.js.map +1 -0
- package/dist/core/emit/layout.d.ts +73 -0
- package/dist/core/emit/layout.d.ts.map +1 -0
- package/dist/core/emit/layout.js +126 -0
- package/dist/core/emit/layout.js.map +1 -0
- package/dist/core/emit/meta.d.ts +14 -0
- package/dist/core/emit/meta.d.ts.map +1 -0
- package/dist/core/emit/meta.js +68 -0
- package/dist/core/emit/meta.js.map +1 -0
- package/dist/core/emit/opcodes.d.ts +28 -0
- package/dist/core/emit/opcodes.d.ts.map +1 -0
- package/dist/core/emit/opcodes.js +137 -0
- package/dist/core/emit/opcodes.js.map +1 -0
- package/dist/core/emit/outputs.d.ts +67 -0
- package/dist/core/emit/outputs.d.ts.map +1 -0
- package/dist/core/emit/outputs.js +293 -0
- package/dist/core/emit/outputs.js.map +1 -0
- package/dist/core/emit/pool.d.ts +33 -0
- package/dist/core/emit/pool.d.ts.map +1 -0
- package/dist/core/emit/pool.js +79 -0
- package/dist/core/emit/pool.js.map +1 -0
- package/dist/core/emit/program.d.ts +333 -0
- package/dist/core/emit/program.d.ts.map +1 -0
- package/dist/core/emit/program.js +15 -0
- package/dist/core/emit/program.js.map +1 -0
- package/dist/core/emit/registers.d.ts +35 -0
- package/dist/core/emit/registers.d.ts.map +1 -0
- package/dist/core/emit/registers.js +170 -0
- package/dist/core/emit/registers.js.map +1 -0
- package/dist/core/emit/request-scope.d.ts +36 -0
- package/dist/core/emit/request-scope.d.ts.map +1 -0
- package/dist/core/emit/request-scope.js +41 -0
- package/dist/core/emit/request-scope.js.map +1 -0
- package/dist/core/emit/requests.d.ts +69 -0
- package/dist/core/emit/requests.d.ts.map +1 -0
- package/dist/core/emit/requests.js +230 -0
- package/dist/core/emit/requests.js.map +1 -0
- package/dist/core/emit/requires.d.ts +4 -0
- package/dist/core/emit/requires.d.ts.map +1 -0
- package/dist/core/emit/requires.js +71 -0
- package/dist/core/emit/requires.js.map +1 -0
- package/dist/core/emit/sha256.d.ts +24 -0
- package/dist/core/emit/sha256.d.ts.map +1 -0
- package/dist/core/emit/sha256.js +109 -0
- package/dist/core/emit/sha256.js.map +1 -0
- package/dist/core/emit/statements.d.ts +20 -0
- package/dist/core/emit/statements.d.ts.map +1 -0
- package/dist/core/emit/statements.js +393 -0
- package/dist/core/emit/statements.js.map +1 -0
- package/dist/core/emit/values.d.ts +80 -0
- package/dist/core/emit/values.d.ts.map +1 -0
- package/dist/core/emit/values.js +242 -0
- package/dist/core/emit/values.js.map +1 -0
- package/dist/core/engine/alerts.d.ts +66 -0
- package/dist/core/engine/alerts.d.ts.map +1 -0
- package/dist/core/engine/alerts.js +119 -0
- package/dist/core/engine/alerts.js.map +1 -0
- package/dist/core/engine/arithmetic.d.ts +82 -0
- package/dist/core/engine/arithmetic.d.ts.map +1 -0
- package/dist/core/engine/arithmetic.js +141 -0
- package/dist/core/engine/arithmetic.js.map +1 -0
- package/dist/core/engine/bars.d.ts +95 -0
- package/dist/core/engine/bars.d.ts.map +1 -0
- package/dist/core/engine/bars.js +133 -0
- package/dist/core/engine/bars.js.map +1 -0
- package/dist/core/engine/budget.d.ts +162 -0
- package/dist/core/engine/budget.d.ts.map +1 -0
- package/dist/core/engine/budget.js +188 -0
- package/dist/core/engine/budget.js.map +1 -0
- package/dist/core/engine/channels.d.ts +106 -0
- package/dist/core/engine/channels.d.ts.map +1 -0
- package/dist/core/engine/channels.js +99 -0
- package/dist/core/engine/channels.js.map +1 -0
- package/dist/core/engine/drawings.d.ts +64 -0
- package/dist/core/engine/drawings.d.ts.map +1 -0
- package/dist/core/engine/drawings.js +67 -0
- package/dist/core/engine/drawings.js.map +1 -0
- package/dist/core/engine/engine.d.ts +140 -0
- package/dist/core/engine/engine.d.ts.map +1 -0
- package/dist/core/engine/engine.js +405 -0
- package/dist/core/engine/engine.js.map +1 -0
- package/dist/core/engine/errors.d.ts +64 -0
- package/dist/core/engine/errors.d.ts.map +1 -0
- package/dist/core/engine/errors.js +63 -0
- package/dist/core/engine/errors.js.map +1 -0
- package/dist/core/engine/frames.d.ts +48 -0
- package/dist/core/engine/frames.d.ts.map +1 -0
- package/dist/core/engine/frames.js +41 -0
- package/dist/core/engine/frames.js.map +1 -0
- package/dist/core/engine/grids.d.ts +25 -0
- package/dist/core/engine/grids.d.ts.map +1 -0
- package/dist/core/engine/grids.js +77 -0
- package/dist/core/engine/grids.js.map +1 -0
- package/dist/core/engine/guard.d.ts +4 -0
- package/dist/core/engine/guard.d.ts.map +1 -0
- package/dist/core/engine/guard.js +46 -0
- package/dist/core/engine/guard.js.map +1 -0
- package/dist/core/engine/host.d.ts +219 -0
- package/dist/core/engine/host.d.ts.map +1 -0
- package/dist/core/engine/host.js +38 -0
- package/dist/core/engine/host.js.map +1 -0
- package/dist/core/engine/index.d.ts +49 -0
- package/dist/core/engine/index.d.ts.map +1 -0
- package/dist/core/engine/index.js +33 -0
- package/dist/core/engine/index.js.map +1 -0
- package/dist/core/engine/inputs.d.ts +77 -0
- package/dist/core/engine/inputs.d.ts.map +1 -0
- package/dist/core/engine/inputs.js +205 -0
- package/dist/core/engine/inputs.js.map +1 -0
- package/dist/core/engine/ledger/call.d.ts +63 -0
- package/dist/core/engine/ledger/call.d.ts.map +1 -0
- package/dist/core/engine/ledger/call.js +136 -0
- package/dist/core/engine/ledger/call.js.map +1 -0
- package/dist/core/engine/ledger/closable.d.ts +155 -0
- package/dist/core/engine/ledger/closable.d.ts.map +1 -0
- package/dist/core/engine/ledger/closable.js +173 -0
- package/dist/core/engine/ledger/closable.js.map +1 -0
- package/dist/core/engine/ledger/holdings.d.ts +194 -0
- package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
- package/dist/core/engine/ledger/holdings.js +237 -0
- package/dist/core/engine/ledger/holdings.js.map +1 -0
- package/dist/core/engine/ledger/index.d.ts +19 -0
- package/dist/core/engine/ledger/index.d.ts.map +1 -0
- package/dist/core/engine/ledger/index.js +2 -0
- package/dist/core/engine/ledger/index.js.map +1 -0
- package/dist/core/engine/ledger/intent.d.ts +106 -0
- package/dist/core/engine/ledger/intent.d.ts.map +1 -0
- package/dist/core/engine/ledger/intent.js +21 -0
- package/dist/core/engine/ledger/intent.js.map +1 -0
- package/dist/core/engine/ledger/ledger.d.ts +143 -0
- package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
- package/dist/core/engine/ledger/ledger.js +237 -0
- package/dist/core/engine/ledger/ledger.js.map +1 -0
- package/dist/core/engine/ledger/place.d.ts +75 -0
- package/dist/core/engine/ledger/place.d.ts.map +1 -0
- package/dist/core/engine/ledger/place.js +174 -0
- package/dist/core/engine/ledger/place.js.map +1 -0
- package/dist/core/engine/ledger/positions.d.ts +68 -0
- package/dist/core/engine/ledger/positions.d.ts.map +1 -0
- package/dist/core/engine/ledger/positions.js +114 -0
- package/dist/core/engine/ledger/positions.js.map +1 -0
- package/dist/core/engine/ledger/refuse.d.ts +43 -0
- package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
- package/dist/core/engine/ledger/refuse.js +329 -0
- package/dist/core/engine/ledger/refuse.js.map +1 -0
- package/dist/core/engine/ledger/row.d.ts +176 -0
- package/dist/core/engine/ledger/row.d.ts.map +1 -0
- package/dist/core/engine/ledger/row.js +169 -0
- package/dist/core/engine/ledger/row.js.map +1 -0
- package/dist/core/engine/ledger/sizing.d.ts +142 -0
- package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
- package/dist/core/engine/ledger/sizing.js +223 -0
- package/dist/core/engine/ledger/sizing.js.map +1 -0
- package/dist/core/engine/library/arrays.d.ts +14 -0
- package/dist/core/engine/library/arrays.d.ts.map +1 -0
- package/dist/core/engine/library/arrays.js +285 -0
- package/dist/core/engine/library/arrays.js.map +1 -0
- package/dist/core/engine/library/averages.d.ts +9 -0
- package/dist/core/engine/library/averages.d.ts.map +1 -0
- package/dist/core/engine/library/averages.js +41 -0
- package/dist/core/engine/library/averages.js.map +1 -0
- package/dist/core/engine/library/binding.d.ts +230 -0
- package/dist/core/engine/library/binding.d.ts.map +1 -0
- package/dist/core/engine/library/binding.js +109 -0
- package/dist/core/engine/library/binding.js.map +1 -0
- package/dist/core/engine/library/chart.d.ts +3 -0
- package/dist/core/engine/library/chart.d.ts.map +1 -0
- package/dist/core/engine/library/chart.js +83 -0
- package/dist/core/engine/library/chart.js.map +1 -0
- package/dist/core/engine/library/colours.d.ts +26 -0
- package/dist/core/engine/library/colours.d.ts.map +1 -0
- package/dist/core/engine/library/colours.js +81 -0
- package/dist/core/engine/library/colours.js.map +1 -0
- package/dist/core/engine/library/dates.d.ts +3 -0
- package/dist/core/engine/library/dates.d.ts.map +1 -0
- package/dist/core/engine/library/dates.js +75 -0
- package/dist/core/engine/library/dates.js.map +1 -0
- package/dist/core/engine/library/index.d.ts +13 -0
- package/dist/core/engine/library/index.d.ts.map +1 -0
- package/dist/core/engine/library/index.js +86 -0
- package/dist/core/engine/library/index.js.map +1 -0
- package/dist/core/engine/library/maths.d.ts +3 -0
- package/dist/core/engine/library/maths.d.ts.map +1 -0
- package/dist/core/engine/library/maths.js +89 -0
- package/dist/core/engine/library/maths.js.map +1 -0
- package/dist/core/engine/library/objects.d.ts +3 -0
- package/dist/core/engine/library/objects.d.ts.map +1 -0
- package/dist/core/engine/library/objects.js +199 -0
- package/dist/core/engine/library/objects.js.map +1 -0
- package/dist/core/engine/library/oscillators.d.ts +3 -0
- package/dist/core/engine/library/oscillators.d.ts.map +1 -0
- package/dist/core/engine/library/oscillators.js +29 -0
- package/dist/core/engine/library/oscillators.js.map +1 -0
- package/dist/core/engine/library/ranges.d.ts +3 -0
- package/dist/core/engine/library/ranges.d.ts.map +1 -0
- package/dist/core/engine/library/ranges.js +23 -0
- package/dist/core/engine/library/ranges.js.map +1 -0
- package/dist/core/engine/library/series.d.ts +3 -0
- package/dist/core/engine/library/series.d.ts.map +1 -0
- package/dist/core/engine/library/series.js +46 -0
- package/dist/core/engine/library/series.js.map +1 -0
- package/dist/core/engine/library/state.d.ts +35 -0
- package/dist/core/engine/library/state.d.ts.map +1 -0
- package/dist/core/engine/library/state.js +19 -0
- package/dist/core/engine/library/state.js.map +1 -0
- package/dist/core/engine/library/studies.d.ts +3 -0
- package/dist/core/engine/library/studies.d.ts.map +1 -0
- package/dist/core/engine/library/studies.js +35 -0
- package/dist/core/engine/library/studies.js.map +1 -0
- package/dist/core/engine/library/text.d.ts +6 -0
- package/dist/core/engine/library/text.d.ts.map +1 -0
- package/dist/core/engine/library/text.js +280 -0
- package/dist/core/engine/library/text.js.map +1 -0
- package/dist/core/engine/library/trend.d.ts +3 -0
- package/dist/core/engine/library/trend.d.ts.map +1 -0
- package/dist/core/engine/library/trend.js +29 -0
- package/dist/core/engine/library/trend.js.map +1 -0
- package/dist/core/engine/library/volume.d.ts +3 -0
- package/dist/core/engine/library/volume.d.ts.map +1 -0
- package/dist/core/engine/library/volume.js +51 -0
- package/dist/core/engine/library/volume.js.map +1 -0
- package/dist/core/engine/load.d.ts +59 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +61 -0
- package/dist/core/engine/load.js.map +1 -0
- package/dist/core/engine/machine.d.ts +107 -0
- package/dist/core/engine/machine.d.ts.map +1 -0
- package/dist/core/engine/machine.js +337 -0
- package/dist/core/engine/machine.js.map +1 -0
- package/dist/core/engine/memory.d.ts +60 -0
- package/dist/core/engine/memory.d.ts.map +1 -0
- package/dist/core/engine/memory.js +92 -0
- package/dist/core/engine/memory.js.map +1 -0
- package/dist/core/engine/operations.d.ts +62 -0
- package/dist/core/engine/operations.d.ts.map +1 -0
- package/dist/core/engine/operations.js +149 -0
- package/dist/core/engine/operations.js.map +1 -0
- package/dist/core/engine/orders.d.ts +56 -0
- package/dist/core/engine/orders.d.ts.map +1 -0
- package/dist/core/engine/orders.js +83 -0
- package/dist/core/engine/orders.js.map +1 -0
- package/dist/core/engine/registers.d.ts +50 -0
- package/dist/core/engine/registers.d.ts.map +1 -0
- package/dist/core/engine/registers.js +85 -0
- package/dist/core/engine/registers.js.map +1 -0
- package/dist/core/engine/request-body.d.ts +138 -0
- package/dist/core/engine/request-body.d.ts.map +1 -0
- package/dist/core/engine/request-body.js +227 -0
- package/dist/core/engine/request-body.js.map +1 -0
- package/dist/core/engine/request-plan.d.ts +79 -0
- package/dist/core/engine/request-plan.d.ts.map +1 -0
- package/dist/core/engine/request-plan.js +228 -0
- package/dist/core/engine/request-plan.js.map +1 -0
- package/dist/core/engine/requests.d.ts +105 -0
- package/dist/core/engine/requests.d.ts.map +1 -0
- package/dist/core/engine/requests.js +260 -0
- package/dist/core/engine/requests.js.map +1 -0
- package/dist/core/engine/results.d.ts +40 -0
- package/dist/core/engine/results.d.ts.map +1 -0
- package/dist/core/engine/results.js +2 -0
- package/dist/core/engine/results.js.map +1 -0
- package/dist/core/engine/series.d.ts +61 -0
- package/dist/core/engine/series.d.ts.map +1 -0
- package/dist/core/engine/series.js +41 -0
- package/dist/core/engine/series.js.map +1 -0
- package/dist/core/engine/session/hours.d.ts +49 -0
- package/dist/core/engine/session/hours.d.ts.map +1 -0
- package/dist/core/engine/session/hours.js +31 -0
- package/dist/core/engine/session/hours.js.map +1 -0
- package/dist/core/engine/session/index.d.ts +17 -0
- package/dist/core/engine/session/index.d.ts.map +1 -0
- package/dist/core/engine/session/index.js +3 -0
- package/dist/core/engine/session/index.js.map +1 -0
- package/dist/core/engine/session/record.d.ts +56 -0
- package/dist/core/engine/session/record.d.ts.map +1 -0
- package/dist/core/engine/session/record.js +165 -0
- package/dist/core/engine/session/record.js.map +1 -0
- package/dist/core/engine/session/spec.d.ts +19 -0
- package/dist/core/engine/session/spec.d.ts.map +1 -0
- package/dist/core/engine/session/spec.js +31 -0
- package/dist/core/engine/session/spec.js.map +1 -0
- package/dist/core/engine/timeframe.d.ts +59 -0
- package/dist/core/engine/timeframe.d.ts.map +1 -0
- package/dist/core/engine/timeframe.js +140 -0
- package/dist/core/engine/timeframe.js.map +1 -0
- package/dist/core/engine/types.d.ts +15 -0
- package/dist/core/engine/types.d.ts.map +1 -0
- package/dist/core/engine/types.js +2 -0
- package/dist/core/engine/types.js.map +1 -0
- package/dist/core/engine/values/heap.d.ts +134 -0
- package/dist/core/engine/values/heap.d.ts.map +1 -0
- package/dist/core/engine/values/heap.js +230 -0
- package/dist/core/engine/values/heap.js.map +1 -0
- package/dist/core/engine/values/index.d.ts +13 -0
- package/dist/core/engine/values/index.d.ts.map +1 -0
- package/dist/core/engine/values/index.js +3 -0
- package/dist/core/engine/values/index.js.map +1 -0
- package/dist/core/engine/values/value.d.ts +82 -0
- package/dist/core/engine/values/value.d.ts.map +1 -0
- package/dist/core/engine/values/value.js +134 -0
- package/dist/core/engine/values/value.js.map +1 -0
- package/dist/core/engine/verify-budgets.d.ts +35 -0
- package/dist/core/engine/verify-budgets.d.ts.map +1 -0
- package/dist/core/engine/verify-budgets.js +172 -0
- package/dist/core/engine/verify-budgets.js.map +1 -0
- package/dist/core/engine/verify-code.d.ts +32 -0
- package/dist/core/engine/verify-code.d.ts.map +1 -0
- package/dist/core/engine/verify-code.js +278 -0
- package/dist/core/engine/verify-code.js.map +1 -0
- package/dist/core/engine/verify-requests.d.ts +44 -0
- package/dist/core/engine/verify-requests.d.ts.map +1 -0
- package/dist/core/engine/verify-requests.js +220 -0
- package/dist/core/engine/verify-requests.js.map +1 -0
- package/dist/core/engine/verify-shape.d.ts +46 -0
- package/dist/core/engine/verify-shape.d.ts.map +1 -0
- package/dist/core/engine/verify-shape.js +147 -0
- package/dist/core/engine/verify-shape.js.map +1 -0
- package/dist/core/engine/verify-tables.d.ts +19 -0
- package/dist/core/engine/verify-tables.d.ts.map +1 -0
- package/dist/core/engine/verify-tables.js +171 -0
- package/dist/core/engine/verify-tables.js.map +1 -0
- package/dist/core/engine/verify.d.ts +19 -0
- package/dist/core/engine/verify.d.ts.map +1 -0
- package/dist/core/engine/verify.js +309 -0
- package/dist/core/engine/verify.js.map +1 -0
- package/dist/core/index.d.ts +95 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +64 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/parse/expressions.js +1 -1
- package/dist/core/parse/expressions.js.map +1 -1
- package/dist/core/parse/names.d.ts +7 -1
- package/dist/core/parse/names.d.ts.map +1 -1
- package/dist/core/parse/names.js +28 -2
- package/dist/core/parse/names.js.map +1 -1
- package/dist/core/stdlib/averages/exponential.d.ts +51 -0
- package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
- package/dist/core/stdlib/averages/exponential.js +72 -0
- package/dist/core/stdlib/averages/exponential.js.map +1 -0
- package/dist/core/stdlib/averages/index.d.ts +7 -0
- package/dist/core/stdlib/averages/index.d.ts.map +1 -0
- package/dist/core/stdlib/averages/index.js +5 -0
- package/dist/core/stdlib/averages/index.js.map +1 -0
- package/dist/core/stdlib/averages/select.d.ts +35 -0
- package/dist/core/stdlib/averages/select.d.ts.map +1 -0
- package/dist/core/stdlib/averages/select.js +43 -0
- package/dist/core/stdlib/averages/select.js.map +1 -0
- package/dist/core/stdlib/averages/shaped.d.ts +61 -0
- package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
- package/dist/core/stdlib/averages/shaped.js +126 -0
- package/dist/core/stdlib/averages/shaped.js.map +1 -0
- package/dist/core/stdlib/averages/simple.d.ts +58 -0
- package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
- package/dist/core/stdlib/averages/simple.js +92 -0
- package/dist/core/stdlib/averages/simple.js.map +1 -0
- package/dist/core/stdlib/calendar/civil.d.ts +56 -0
- package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/civil.js +70 -0
- package/dist/core/stdlib/calendar/civil.js.map +1 -0
- package/dist/core/stdlib/calendar/fields.d.ts +36 -0
- package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/fields.js +93 -0
- package/dist/core/stdlib/calendar/fields.js.map +1 -0
- package/dist/core/stdlib/calendar/format.d.ts +19 -0
- package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/format.js +51 -0
- package/dist/core/stdlib/calendar/format.js.map +1 -0
- package/dist/core/stdlib/calendar/index.d.ts +7 -0
- package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/index.js +5 -0
- package/dist/core/stdlib/calendar/index.js.map +1 -0
- package/dist/core/stdlib/calendar/zone.d.ts +53 -0
- package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/zone.js +138 -0
- package/dist/core/stdlib/calendar/zone.js.map +1 -0
- package/dist/core/stdlib/index.d.ts +57 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/index.js +51 -0
- package/dist/core/stdlib/index.js.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.js +66 -0
- package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
- package/dist/core/stdlib/maths/elementary.d.ts +65 -0
- package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
- package/dist/core/stdlib/maths/elementary.js +93 -0
- package/dist/core/stdlib/maths/elementary.js.map +1 -0
- package/dist/core/stdlib/maths/index.d.ts +4 -0
- package/dist/core/stdlib/maths/index.d.ts.map +1 -0
- package/dist/core/stdlib/maths/index.js +4 -0
- package/dist/core/stdlib/maths/index.js.map +1 -0
- package/dist/core/stdlib/maths/rounding.d.ts +43 -0
- package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
- package/dist/core/stdlib/maths/rounding.js +62 -0
- package/dist/core/stdlib/maths/rounding.js.map +1 -0
- package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
- package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/convergence.js +48 -0
- package/dist/core/stdlib/momentum/convergence.js.map +1 -0
- package/dist/core/stdlib/momentum/index.d.ts +6 -0
- package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/index.js +6 -0
- package/dist/core/stdlib/momentum/index.js.map +1 -0
- package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
- package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/pressure.js +103 -0
- package/dist/core/stdlib/momentum/pressure.js.map +1 -0
- package/dist/core/stdlib/momentum/rates.d.ts +74 -0
- package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rates.js +134 -0
- package/dist/core/stdlib/momentum/rates.js.map +1 -0
- package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
- package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rsi.js +30 -0
- package/dist/core/stdlib/momentum/rsi.js.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.js +97 -0
- package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
- package/dist/core/stdlib/series/changes.d.ts +59 -0
- package/dist/core/stdlib/series/changes.d.ts.map +1 -0
- package/dist/core/stdlib/series/changes.js +129 -0
- package/dist/core/stdlib/series/changes.js.map +1 -0
- package/dist/core/stdlib/series/conditions.d.ts +34 -0
- package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
- package/dist/core/stdlib/series/conditions.js +52 -0
- package/dist/core/stdlib/series/conditions.js.map +1 -0
- package/dist/core/stdlib/series/extremes.d.ts +29 -0
- package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
- package/dist/core/stdlib/series/extremes.js +62 -0
- package/dist/core/stdlib/series/extremes.js.map +1 -0
- package/dist/core/stdlib/series/index.d.ts +9 -0
- package/dist/core/stdlib/series/index.d.ts.map +1 -0
- package/dist/core/stdlib/series/index.js +7 -0
- package/dist/core/stdlib/series/index.js.map +1 -0
- package/dist/core/stdlib/series/pivots.d.ts +25 -0
- package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
- package/dist/core/stdlib/series/pivots.js +42 -0
- package/dist/core/stdlib/series/pivots.js.map +1 -0
- package/dist/core/stdlib/series/statistics.d.ts +64 -0
- package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
- package/dist/core/stdlib/series/statistics.js +148 -0
- package/dist/core/stdlib/series/statistics.js.map +1 -0
- package/dist/core/stdlib/series/totals.d.ts +68 -0
- package/dist/core/stdlib/series/totals.d.ts.map +1 -0
- package/dist/core/stdlib/series/totals.js +115 -0
- package/dist/core/stdlib/series/totals.js.map +1 -0
- package/dist/core/stdlib/trend/directional.d.ts +69 -0
- package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
- package/dist/core/stdlib/trend/directional.js +151 -0
- package/dist/core/stdlib/trend/directional.js.map +1 -0
- package/dist/core/stdlib/trend/index.d.ts +4 -0
- package/dist/core/stdlib/trend/index.d.ts.map +1 -0
- package/dist/core/stdlib/trend/index.js +4 -0
- package/dist/core/stdlib/trend/index.js.map +1 -0
- package/dist/core/stdlib/trend/psar.d.ts +33 -0
- package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
- package/dist/core/stdlib/trend/psar.js +86 -0
- package/dist/core/stdlib/trend/psar.js.map +1 -0
- package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
- package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
- package/dist/core/stdlib/trend/supertrend.js +65 -0
- package/dist/core/stdlib/trend/supertrend.js.map +1 -0
- package/dist/core/stdlib/values/bar.d.ts +39 -0
- package/dist/core/stdlib/values/bar.d.ts.map +1 -0
- package/dist/core/stdlib/values/bar.js +33 -0
- package/dist/core/stdlib/values/bar.js.map +1 -0
- package/dist/core/stdlib/values/index.d.ts +11 -0
- package/dist/core/stdlib/values/index.d.ts.map +1 -0
- package/dist/core/stdlib/values/index.js +6 -0
- package/dist/core/stdlib/values/index.js.map +1 -0
- package/dist/core/stdlib/values/lookback.d.ts +83 -0
- package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
- package/dist/core/stdlib/values/lookback.js +134 -0
- package/dist/core/stdlib/values/lookback.js.map +1 -0
- package/dist/core/stdlib/values/region.d.ts +55 -0
- package/dist/core/stdlib/values/region.d.ts.map +1 -0
- package/dist/core/stdlib/values/region.js +73 -0
- package/dist/core/stdlib/values/region.js.map +1 -0
- package/dist/core/stdlib/values/tail.d.ts +44 -0
- package/dist/core/stdlib/values/tail.d.ts.map +1 -0
- package/dist/core/stdlib/values/tail.js +23 -0
- package/dist/core/stdlib/values/tail.js.map +1 -0
- package/dist/core/stdlib/values/value.d.ts +64 -0
- package/dist/core/stdlib/values/value.d.ts.map +1 -0
- package/dist/core/stdlib/values/value.js +61 -0
- package/dist/core/stdlib/values/value.js.map +1 -0
- package/dist/core/stdlib/volatility/bands.d.ts +50 -0
- package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/bands.js +101 -0
- package/dist/core/stdlib/volatility/bands.js.map +1 -0
- package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
- package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/deviation.js +75 -0
- package/dist/core/stdlib/volatility/deviation.js.map +1 -0
- package/dist/core/stdlib/volatility/index.d.ts +6 -0
- package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/index.js +5 -0
- package/dist/core/stdlib/volatility/index.js.map +1 -0
- package/dist/core/stdlib/volatility/measures.d.ts +48 -0
- package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/measures.js +73 -0
- package/dist/core/stdlib/volatility/measures.js.map +1 -0
- package/dist/core/stdlib/volatility/range.d.ts +69 -0
- package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/range.js +86 -0
- package/dist/core/stdlib/volatility/range.js.map +1 -0
- package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
- package/dist/core/stdlib/volume/accumulation.js +127 -0
- package/dist/core/stdlib/volume/accumulation.js.map +1 -0
- package/dist/core/stdlib/volume/flow.d.ts +60 -0
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
- package/dist/core/stdlib/volume/flow.js +125 -0
- package/dist/core/stdlib/volume/flow.js.map +1 -0
- package/dist/core/stdlib/volume/index.d.ts +5 -0
- package/dist/core/stdlib/volume/index.d.ts.map +1 -0
- package/dist/core/stdlib/volume/index.js +4 -0
- package/dist/core/stdlib/volume/index.js.map +1 -0
- package/dist/core/stdlib/volume/weighted.d.ts +52 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
- package/dist/core/stdlib/volume/weighted.js +64 -0
- package/dist/core/stdlib/volume/weighted.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +2 -2
- package/dist/core/version/version.generated.d.ts.map +1 -1
- package/dist/core/version/version.generated.js +2 -2
- package/dist/core/version/version.generated.js.map +1 -1
- package/dist/editor/complete.d.ts +40 -0
- package/dist/editor/complete.d.ts.map +1 -0
- package/dist/editor/complete.js +206 -0
- package/dist/editor/complete.js.map +1 -0
- package/dist/editor/diagnose.d.ts +18 -0
- package/dist/editor/diagnose.d.ts.map +1 -0
- package/dist/editor/diagnose.js +70 -0
- package/dist/editor/diagnose.js.map +1 -0
- package/dist/editor/format.d.ts +11 -0
- package/dist/editor/format.d.ts.map +1 -0
- package/dist/editor/format.js +50 -0
- package/dist/editor/format.js.map +1 -0
- package/dist/editor/highlight.d.ts +28 -0
- package/dist/editor/highlight.d.ts.map +1 -0
- package/dist/editor/highlight.js +65 -0
- package/dist/editor/highlight.js.map +1 -0
- package/dist/editor/hover.d.ts +40 -0
- package/dist/editor/hover.d.ts.map +1 -0
- package/dist/editor/hover.js +147 -0
- package/dist/editor/hover.js.map +1 -0
- package/dist/editor/index.d.ts +60 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +7 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/kinds.d.ts +27 -0
- package/dist/editor/kinds.d.ts.map +1 -0
- package/dist/editor/kinds.js +118 -0
- package/dist/editor/kinds.js.map +1 -0
- package/dist/editor/layout.d.ts +47 -0
- package/dist/editor/layout.d.ts.map +1 -0
- package/dist/editor/layout.js +135 -0
- package/dist/editor/layout.js.map +1 -0
- package/dist/editor/manifest.d.ts +47 -0
- package/dist/editor/manifest.d.ts.map +1 -0
- package/dist/editor/manifest.js +93 -0
- package/dist/editor/manifest.js.map +1 -0
- package/dist/editor/reading.d.ts +41 -0
- package/dist/editor/reading.d.ts.map +1 -0
- package/dist/editor/reading.js +51 -0
- package/dist/editor/reading.js.map +1 -0
- package/dist/editor/scan.d.ts +26 -0
- package/dist/editor/scan.d.ts.map +1 -0
- package/dist/editor/scan.js +139 -0
- package/dist/editor/scan.js.map +1 -0
- package/dist/editor/scope.d.ts +19 -0
- package/dist/editor/scope.d.ts.map +1 -0
- package/dist/editor/scope.js +99 -0
- package/dist/editor/scope.js.map +1 -0
- package/dist/editor/signature.d.ts +38 -0
- package/dist/editor/signature.d.ts.map +1 -0
- package/dist/editor/signature.js +112 -0
- package/dist/editor/signature.js.map +1 -0
- package/dist/editor/site.d.ts +46 -0
- package/dist/editor/site.d.ts.map +1 -0
- package/dist/editor/site.js +184 -0
- package/dist/editor/site.js.map +1 -0
- package/dist/editor/spacing.d.ts +29 -0
- package/dist/editor/spacing.d.ts.map +1 -0
- package/dist/editor/spacing.js +116 -0
- package/dist/editor/spacing.js.map +1 -0
- package/package.json +66 -15
- package/spec/errors.json +522 -183
- package/src/adapters/charts/alerts.ts +116 -0
- package/src/adapters/charts/bars.ts +63 -0
- package/src/adapters/charts/candles.ts +137 -0
- package/src/adapters/charts/colours.ts +113 -0
- package/src/adapters/charts/columns.ts +99 -0
- package/src/adapters/charts/contract.ts +320 -0
- package/src/adapters/charts/descriptor.ts +199 -0
- package/src/adapters/charts/drawings.ts +213 -0
- package/src/adapters/charts/errors.ts +45 -0
- package/src/adapters/charts/fields.ts +74 -0
- package/src/adapters/charts/fills.ts +71 -0
- package/src/adapters/charts/index.ts +78 -0
- package/src/adapters/charts/levels.ts +92 -0
- package/src/adapters/charts/markers.ts +119 -0
- package/src/adapters/charts/paint.ts +101 -0
- package/src/adapters/charts/plots.ts +185 -0
- package/src/adapters/charts/produced.ts +68 -0
- package/src/adapters/charts/requests.ts +357 -0
- package/src/adapters/charts/run.ts +327 -0
- package/src/adapters/charts/settings.ts +273 -0
- package/src/adapters/charts/surfaces.ts +255 -0
- package/src/adapters/charts/tables.ts +243 -0
- package/src/adapters/codemirror/commands.ts +53 -0
- package/src/adapters/codemirror/completion.ts +74 -0
- package/src/adapters/codemirror/contract.ts +156 -0
- package/src/adapters/codemirror/index.ts +66 -0
- package/src/adapters/codemirror/lint.ts +66 -0
- package/src/adapters/codemirror/positions.ts +79 -0
- package/src/adapters/codemirror/stream.ts +87 -0
- package/src/adapters/codemirror/tokens.ts +64 -0
- package/src/adapters/codemirror/tooltips.ts +113 -0
- package/src/core/accounting/charges.ts +452 -0
- package/src/core/accounting/equity.ts +276 -0
- package/src/core/accounting/index.ts +49 -0
- package/src/core/accounting/markers.ts +95 -0
- package/src/core/accounting/monthly.ts +137 -0
- package/src/core/accounting/report.ts +89 -0
- package/src/core/accounting/shapes.ts +73 -0
- package/src/core/accounting/statistics.ts +350 -0
- package/src/core/accounting/trades.ts +313 -0
- package/src/core/backtest/compare.ts +244 -0
- package/src/core/backtest/declaration.ts +97 -0
- package/src/core/backtest/drive.ts +364 -0
- package/src/core/backtest/index.ts +52 -0
- package/src/core/backtest/range.ts +137 -0
- package/src/core/backtest/record.ts +341 -0
- package/src/core/backtest/replay.ts +158 -0
- package/src/core/backtest/resting.ts +125 -0
- package/src/core/backtest/settings.ts +280 -0
- package/src/core/backtest/simulate.ts +304 -0
- package/src/core/catalogue/catalogue.generated.ts +23 -9
- package/src/core/catalogue/values.generated.ts +14 -0
- package/src/core/check/arguments.ts +126 -0
- package/src/core/check/call-sites.ts +385 -0
- package/src/core/check/call-warmup.ts +121 -0
- package/src/core/check/calls.ts +412 -0
- package/src/core/check/check.ts +183 -0
- package/src/core/check/checked.ts +228 -0
- package/src/core/check/checker.ts +393 -0
- package/src/core/check/conditional.ts +143 -0
- package/src/core/check/constant.ts +127 -0
- package/src/core/check/declaration.ts +230 -0
- package/src/core/check/expressions.ts +471 -0
- package/src/core/check/functions.ts +283 -0
- package/src/core/check/handles.ts +75 -0
- package/src/core/check/index.ts +70 -0
- package/src/core/check/library-bars.ts +194 -0
- package/src/core/check/library-orders.ts +290 -0
- package/src/core/check/library-output.ts +241 -0
- package/src/core/check/library-prose.generated.ts +367 -0
- package/src/core/check/library-series.ts +457 -0
- package/src/core/check/library.ts +374 -0
- package/src/core/check/literals.ts +35 -0
- package/src/core/check/outputs.ts +152 -0
- package/src/core/check/statements.ts +465 -0
- package/src/core/check/suggest.ts +63 -0
- package/src/core/check/surface.ts +149 -0
- package/src/core/check/tags.ts +94 -0
- package/src/core/check/types.ts +260 -0
- package/src/core/check/warmup.ts +100 -0
- package/src/core/diagnostics/collector.ts +27 -1
- package/src/core/emit/calls.ts +415 -0
- package/src/core/emit/canonical.ts +81 -0
- package/src/core/emit/channels.ts +144 -0
- package/src/core/emit/code.ts +155 -0
- package/src/core/emit/colours.ts +75 -0
- package/src/core/emit/context.ts +461 -0
- package/src/core/emit/defaults.ts +220 -0
- package/src/core/emit/emit.ts +313 -0
- package/src/core/emit/events.ts +141 -0
- package/src/core/emit/expressions.ts +292 -0
- package/src/core/emit/functions.ts +195 -0
- package/src/core/emit/gaps.ts +44 -0
- package/src/core/emit/index.ts +76 -0
- package/src/core/emit/inputs.ts +179 -0
- package/src/core/emit/layout.ts +165 -0
- package/src/core/emit/meta.ts +104 -0
- package/src/core/emit/opcodes.ts +160 -0
- package/src/core/emit/outputs.ts +357 -0
- package/src/core/emit/pool.ts +102 -0
- package/src/core/emit/program.ts +385 -0
- package/src/core/emit/registers.ts +179 -0
- package/src/core/emit/request-scope.ts +52 -0
- package/src/core/emit/requests.ts +258 -0
- package/src/core/emit/requires.ts +91 -0
- package/src/core/emit/sha256.ts +119 -0
- package/src/core/emit/statements.ts +438 -0
- package/src/core/emit/values.ts +284 -0
- package/src/core/engine/alerts.ts +152 -0
- package/src/core/engine/arithmetic.ts +165 -0
- package/src/core/engine/bars.ts +224 -0
- package/src/core/engine/budget.ts +284 -0
- package/src/core/engine/channels.ts +171 -0
- package/src/core/engine/drawings.ts +127 -0
- package/src/core/engine/engine.ts +498 -0
- package/src/core/engine/errors.ts +100 -0
- package/src/core/engine/frames.ts +85 -0
- package/src/core/engine/grids.ts +98 -0
- package/src/core/engine/guard.ts +71 -0
- package/src/core/engine/host.ts +251 -0
- package/src/core/engine/index.ts +93 -0
- package/src/core/engine/inputs.ts +263 -0
- package/src/core/engine/ledger/call.ts +218 -0
- package/src/core/engine/ledger/closable.ts +269 -0
- package/src/core/engine/ledger/holdings.ts +354 -0
- package/src/core/engine/ledger/index.ts +28 -0
- package/src/core/engine/ledger/intent.ts +112 -0
- package/src/core/engine/ledger/ledger.ts +314 -0
- package/src/core/engine/ledger/place.ts +277 -0
- package/src/core/engine/ledger/positions.ts +123 -0
- package/src/core/engine/ledger/refuse.ts +378 -0
- package/src/core/engine/ledger/row.ts +318 -0
- package/src/core/engine/ledger/sizing.ts +292 -0
- package/src/core/engine/library/arrays.ts +316 -0
- package/src/core/engine/library/averages.ts +97 -0
- package/src/core/engine/library/binding.ts +325 -0
- package/src/core/engine/library/chart.ts +115 -0
- package/src/core/engine/library/colours.ts +111 -0
- package/src/core/engine/library/dates.ts +109 -0
- package/src/core/engine/library/index.ts +103 -0
- package/src/core/engine/library/maths.ts +134 -0
- package/src/core/engine/library/objects.ts +265 -0
- package/src/core/engine/library/oscillators.ts +124 -0
- package/src/core/engine/library/ranges.ts +51 -0
- package/src/core/engine/library/series.ts +236 -0
- package/src/core/engine/library/state.ts +47 -0
- package/src/core/engine/library/studies.ts +150 -0
- package/src/core/engine/library/text.ts +303 -0
- package/src/core/engine/library/trend.ts +79 -0
- package/src/core/engine/library/volume.ts +101 -0
- package/src/core/engine/load.ts +118 -0
- package/src/core/engine/machine.ts +446 -0
- package/src/core/engine/memory.ts +129 -0
- package/src/core/engine/operations.ts +171 -0
- package/src/core/engine/orders.ts +121 -0
- package/src/core/engine/registers.ts +104 -0
- package/src/core/engine/request-body.ts +328 -0
- package/src/core/engine/request-plan.ts +270 -0
- package/src/core/engine/requests.ts +382 -0
- package/src/core/engine/results.ts +41 -0
- package/src/core/engine/series.ts +82 -0
- package/src/core/engine/session/hours.ts +86 -0
- package/src/core/engine/session/index.ts +17 -0
- package/src/core/engine/session/record.ts +191 -0
- package/src/core/engine/session/spec.ts +45 -0
- package/src/core/engine/timeframe.ts +161 -0
- package/src/core/engine/types.ts +47 -0
- package/src/core/engine/values/heap.ts +295 -0
- package/src/core/engine/values/index.ts +34 -0
- package/src/core/engine/values/value.ts +158 -0
- package/src/core/engine/verify-budgets.ts +202 -0
- package/src/core/engine/verify-code.ts +332 -0
- package/src/core/engine/verify-requests.ts +255 -0
- package/src/core/engine/verify-shape.ts +164 -0
- package/src/core/engine/verify-tables.ts +176 -0
- package/src/core/engine/verify.ts +341 -0
- package/src/core/index.ts +212 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/names.ts +29 -2
- package/src/core/stdlib/averages/exponential.ts +119 -0
- package/src/core/stdlib/averages/index.ts +45 -0
- package/src/core/stdlib/averages/select.ts +71 -0
- package/src/core/stdlib/averages/shaped.ts +161 -0
- package/src/core/stdlib/averages/simple.ts +139 -0
- package/src/core/stdlib/calendar/civil.ts +89 -0
- package/src/core/stdlib/calendar/fields.ts +124 -0
- package/src/core/stdlib/calendar/format.ts +71 -0
- package/src/core/stdlib/calendar/index.ts +15 -0
- package/src/core/stdlib/calendar/zone.ts +161 -0
- package/src/core/stdlib/index.ts +400 -0
- package/src/core/stdlib/maths/arithmetic.ts +74 -0
- package/src/core/stdlib/maths/elementary.ts +124 -0
- package/src/core/stdlib/maths/index.ts +43 -0
- package/src/core/stdlib/maths/rounding.ts +78 -0
- package/src/core/stdlib/momentum/convergence.ts +82 -0
- package/src/core/stdlib/momentum/index.ts +47 -0
- package/src/core/stdlib/momentum/pressure.ts +141 -0
- package/src/core/stdlib/momentum/rates.ts +188 -0
- package/src/core/stdlib/momentum/rsi.ts +49 -0
- package/src/core/stdlib/momentum/stochastic.ts +147 -0
- package/src/core/stdlib/series/changes.ts +177 -0
- package/src/core/stdlib/series/conditions.ts +74 -0
- package/src/core/stdlib/series/extremes.ts +92 -0
- package/src/core/stdlib/series/index.ts +83 -0
- package/src/core/stdlib/series/pivots.ts +63 -0
- package/src/core/stdlib/series/statistics.ts +207 -0
- package/src/core/stdlib/series/totals.ts +164 -0
- package/src/core/stdlib/trend/directional.ts +196 -0
- package/src/core/stdlib/trend/index.ts +13 -0
- package/src/core/stdlib/trend/psar.ts +131 -0
- package/src/core/stdlib/trend/supertrend.ts +100 -0
- package/src/core/stdlib/values/bar.ts +54 -0
- package/src/core/stdlib/values/index.ts +14 -0
- package/src/core/stdlib/values/lookback.ts +198 -0
- package/src/core/stdlib/values/region.ts +86 -0
- package/src/core/stdlib/values/tail.ts +58 -0
- package/src/core/stdlib/values/value.ts +82 -0
- package/src/core/stdlib/volatility/bands.ts +178 -0
- package/src/core/stdlib/volatility/deviation.ts +111 -0
- package/src/core/stdlib/volatility/index.ts +48 -0
- package/src/core/stdlib/volatility/measures.ts +96 -0
- package/src/core/stdlib/volatility/range.ts +143 -0
- package/src/core/stdlib/volume/accumulation.ts +152 -0
- package/src/core/stdlib/volume/flow.ts +173 -0
- package/src/core/stdlib/volume/index.ts +43 -0
- package/src/core/stdlib/volume/weighted.ts +101 -0
- package/src/core/version/version.generated.ts +2 -2
- package/src/editor/complete.ts +266 -0
- package/src/editor/diagnose.ts +71 -0
- package/src/editor/format.ts +85 -0
- package/src/editor/highlight.ts +110 -0
- package/src/editor/hover.ts +199 -0
- package/src/editor/index.ts +65 -0
- package/src/editor/kinds.ts +157 -0
- package/src/editor/layout.ts +189 -0
- package/src/editor/manifest.ts +119 -0
- package/src/editor/reading.ts +69 -0
- package/src/editor/scan.ts +162 -0
- package/src/editor/scope.ts +122 -0
- package/src/editor/signature.ts +150 -0
- package/src/editor/site.ts +233 -0
- package/src/editor/spacing.ts +132 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An instruction list under construction, with its source positions.
|
|
3
|
+
*
|
|
4
|
+
* Two things live here rather than in the passes that emit code, because both
|
|
5
|
+
* are easy to get subtly wrong in a hundred places and right in one.
|
|
6
|
+
*
|
|
7
|
+
* **Positions.** `compiled-program.md` 2.15 stores one triple per change of
|
|
8
|
+
* position, and the position of any instruction is the triple with the greatest
|
|
9
|
+
* index at or below it. So the builder is told where it is and works out which
|
|
10
|
+
* triples to keep; a pass that appended a triple per instruction would produce a
|
|
11
|
+
* correct program and a debug table four times the size of the code.
|
|
12
|
+
*
|
|
13
|
+
* **Stack depth.** Section 3.5 check 5 is the verifier's, and a compiler that
|
|
14
|
+
* cannot compute the same number cannot know it emitted a loadable program. The
|
|
15
|
+
* builder walks its own list on demand, so an emitter can assert the depth is
|
|
16
|
+
* zero where the language says a statement has finished.
|
|
17
|
+
*/
|
|
18
|
+
import type { Span } from '../span/index.js';
|
|
19
|
+
import type { Instruction, Position } from './program.js';
|
|
20
|
+
import type { Opcode } from './opcodes.js';
|
|
21
|
+
import { depthChange, operandCount, targetPositions } from './opcodes.js';
|
|
22
|
+
|
|
23
|
+
export class CodeBuilder {
|
|
24
|
+
private readonly instructions: Instruction[] = [];
|
|
25
|
+
private readonly positions: Position[] = [];
|
|
26
|
+
private line = 0;
|
|
27
|
+
private column = 0;
|
|
28
|
+
|
|
29
|
+
/** Where the instructions pushed after this call came from. */
|
|
30
|
+
at(span: Span): void {
|
|
31
|
+
this.line = span.line;
|
|
32
|
+
this.column = span.column;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The index the next instruction will take, which is what a jump targets. */
|
|
36
|
+
get here(): number {
|
|
37
|
+
return this.instructions.length;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Appends one instruction and returns its index.
|
|
42
|
+
*
|
|
43
|
+
* The operand count is checked here because an instruction with the wrong
|
|
44
|
+
* number of operands is a program an engine refuses at load with one code and
|
|
45
|
+
* no line (3.5 check 2), and this is the last place that still knows the line.
|
|
46
|
+
*/
|
|
47
|
+
push(opcode: Opcode, ...operands: number[]): number {
|
|
48
|
+
if (operands.length !== operandCount(opcode)) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`${opcode} takes ${operandCount(opcode)} operands and was given ${operands.length}`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const index = this.instructions.length;
|
|
54
|
+
const last = this.positions[this.positions.length - 1];
|
|
55
|
+
if (last === undefined || last[1] !== this.line || last[2] !== this.column) {
|
|
56
|
+
this.positions.push([index, this.line, this.column]);
|
|
57
|
+
}
|
|
58
|
+
this.instructions.push([opcode, ...operands] as Instruction);
|
|
59
|
+
return index;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Fills in a jump whose target was not known when it was emitted. */
|
|
63
|
+
patch(index: number, operand: number, target: number): void {
|
|
64
|
+
const instruction = this.instructions[index];
|
|
65
|
+
if (instruction === undefined) throw new Error(`no instruction at ${index}`);
|
|
66
|
+
const operands = instruction.slice(1) as number[];
|
|
67
|
+
operands[operand] = target;
|
|
68
|
+
this.instructions[index] = [instruction[0], ...operands] as Instruction;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get code(): readonly Instruction[] {
|
|
72
|
+
return this.instructions;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get pos(): readonly Position[] {
|
|
76
|
+
return this.positions;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** What walking an instruction list found, or the first place it stopped making sense. */
|
|
81
|
+
export interface Walk {
|
|
82
|
+
/** The depth at each instruction, before it executes. */
|
|
83
|
+
readonly depths: readonly number[];
|
|
84
|
+
/** The first instruction whose depth two paths disagreed about, or nothing. */
|
|
85
|
+
readonly conflict: number | undefined;
|
|
86
|
+
/** The first instruction the walk reached with a negative depth, or nothing. */
|
|
87
|
+
readonly underflow: number | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The first `RET` or `HALT` the stack is not empty at, or nothing.
|
|
90
|
+
*
|
|
91
|
+
* Section 3.5 check 5 is three sentences and this is the third: the depth
|
|
92
|
+
* agrees on every path, it never goes below zero, and **it is zero at the
|
|
93
|
+
* terminator**. Only the first two were walked here, and the difference is
|
|
94
|
+
* not academic. A `RET` reaches nothing after it, so an expression that left
|
|
95
|
+
* the stack one short took it to minus one exactly at the `RET`, where
|
|
96
|
+
* nothing was ever asked; the walk finished clean and a body whose stack does
|
|
97
|
+
* not add up was emitted, for an engine to refuse at load with a code about
|
|
98
|
+
* the compiler. Every `RET` is checked rather than the last one, because an
|
|
99
|
+
* early `return` is a terminator too and owes the same debt.
|
|
100
|
+
*/
|
|
101
|
+
readonly terminal: number | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The stack depth at every instruction, computed exactly as section 3.5 does.
|
|
106
|
+
*
|
|
107
|
+
* A forward pass is enough because every backward jump in a program this
|
|
108
|
+
* compiler emits targets a `TICK` at a loop header, and a loop body leaves the
|
|
109
|
+
* stack as it found it. The walk still records a disagreement rather than
|
|
110
|
+
* assuming one, so a bug in a pass shows up here and not in an engine.
|
|
111
|
+
*/
|
|
112
|
+
export function walkDepths(
|
|
113
|
+
code: readonly Instruction[],
|
|
114
|
+
argcOf: (site: number) => number,
|
|
115
|
+
): Walk {
|
|
116
|
+
const depths: (number | undefined)[] = new Array<number | undefined>(code.length).fill(undefined);
|
|
117
|
+
let conflict: number | undefined;
|
|
118
|
+
let underflow: number | undefined;
|
|
119
|
+
let terminal: number | undefined;
|
|
120
|
+
|
|
121
|
+
const reach = (index: number, depth: number): void => {
|
|
122
|
+
if (index < 0 || index > code.length) return;
|
|
123
|
+
if (depth < 0 && underflow === undefined) underflow = index;
|
|
124
|
+
const known = depths[index];
|
|
125
|
+
if (known === undefined) depths[index] = depth;
|
|
126
|
+
else if (known !== depth && conflict === undefined) conflict = index;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
reach(0, 0);
|
|
130
|
+
for (let i = 0; i < code.length; i += 1) {
|
|
131
|
+
const instruction = code[i];
|
|
132
|
+
const depth = depths[i];
|
|
133
|
+
if (instruction === undefined || depth === undefined) continue;
|
|
134
|
+
const opcode = instruction[0] as Opcode;
|
|
135
|
+
const operands = instruction.slice(1) as number[];
|
|
136
|
+
const after = depth + depthChange(opcode, operands, argcOf);
|
|
137
|
+
|
|
138
|
+
if (opcode === 'RET' || opcode === 'HALT') {
|
|
139
|
+
if (after !== 0 && terminal === undefined) terminal = i;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
for (const position of targetPositions(opcode)) {
|
|
143
|
+
const target = operands[position];
|
|
144
|
+
if (target !== undefined) reach(target, after);
|
|
145
|
+
}
|
|
146
|
+
if (opcode !== 'JUMP') reach(i + 1, after);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
depths: depths.map((one) => one ?? 0),
|
|
151
|
+
conflict,
|
|
152
|
+
underflow,
|
|
153
|
+
terminal,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The nineteen named colours, as channel values.
|
|
3
|
+
*
|
|
4
|
+
* **This table is standing in for something that does not exist yet, and it
|
|
5
|
+
* should move the moment it does.** `stdlib.md` 11.1 says the exact channel
|
|
6
|
+
* values of the named colours are fixed in the library manifest and are part of
|
|
7
|
+
* the conformance suite. There is no library manifest in this repository, so an
|
|
8
|
+
* emitter that has to write `["c", [r, g, b, a]]` into a plot's `color` field
|
|
9
|
+
* has nowhere to read them from.
|
|
10
|
+
*
|
|
11
|
+
* The alternative was to give every named colour a per-bar channel and let the
|
|
12
|
+
* engine's own manifest supply the value, which is a legal representation and
|
|
13
|
+
* is what `colorChannel` is for. It does not work: a level's colour, a table's
|
|
14
|
+
* `textColor` and a marker's `color` are declaration fields with no channel
|
|
15
|
+
* beside them, so there are three places in the format where a named colour has
|
|
16
|
+
* to be a value before bar 0 or it cannot be carried at all.
|
|
17
|
+
*
|
|
18
|
+
* The values are the long-standing web colour keywords of the same names, which
|
|
19
|
+
* is what `language.md` 3.8's list is drawn from. They are written here rather
|
|
20
|
+
* than guessed at three call sites, and `emit()` reports them as a gap so that
|
|
21
|
+
* nobody mistakes this file for the authority it is standing in for.
|
|
22
|
+
*/
|
|
23
|
+
import type { Colour } from './program.js';
|
|
24
|
+
|
|
25
|
+
const OPAQUE = 1;
|
|
26
|
+
|
|
27
|
+
const CHANNELS: Readonly<Record<string, readonly [number, number, number]>> = {
|
|
28
|
+
aqua: [0, 255, 255],
|
|
29
|
+
black: [0, 0, 0],
|
|
30
|
+
blue: [0, 0, 255],
|
|
31
|
+
brown: [165, 42, 42],
|
|
32
|
+
fuchsia: [255, 0, 255],
|
|
33
|
+
gray: [128, 128, 128],
|
|
34
|
+
green: [0, 128, 0],
|
|
35
|
+
lime: [0, 255, 0],
|
|
36
|
+
maroon: [128, 0, 0],
|
|
37
|
+
navy: [0, 0, 128],
|
|
38
|
+
olive: [128, 128, 0],
|
|
39
|
+
orange: [255, 165, 0],
|
|
40
|
+
pink: [255, 192, 203],
|
|
41
|
+
purple: [128, 0, 128],
|
|
42
|
+
red: [255, 0, 0],
|
|
43
|
+
silver: [192, 192, 192],
|
|
44
|
+
teal: [0, 128, 128],
|
|
45
|
+
white: [255, 255, 255],
|
|
46
|
+
yellow: [255, 255, 0],
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function isColourName(name: string): boolean {
|
|
50
|
+
return Object.prototype.hasOwnProperty.call(CHANNELS, name);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The colour a name denotes, at full opacity, or nothing if it is not one. */
|
|
54
|
+
export function namedColour(name: string): Colour | undefined {
|
|
55
|
+
const channels = CHANNELS[name];
|
|
56
|
+
return channels === undefined
|
|
57
|
+
? undefined
|
|
58
|
+
: [channels[0], channels[1], channels[2], OPAQUE];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A `#rrggbb` or `#rrggbbaa` literal, `language.md` 3.8.
|
|
63
|
+
*
|
|
64
|
+
* The alpha byte is divided by 255 here rather than left to an engine, because
|
|
65
|
+
* `compiled-program.md` 2.9 requires the pool to carry the divided number: two
|
|
66
|
+
* engines dividing separately is a place they can differ by one part in 255.
|
|
67
|
+
*/
|
|
68
|
+
export function hexColour(text: string): Colour | undefined {
|
|
69
|
+
const digits = text.startsWith('#') ? text.slice(1) : text;
|
|
70
|
+
if (digits.length !== 6 && digits.length !== 8) return undefined;
|
|
71
|
+
if (!/^[0-9a-fA-F]+$/.test(digits)) return undefined;
|
|
72
|
+
const byte = (at: number): number => Number.parseInt(digits.slice(at, at + 2), 16);
|
|
73
|
+
const alpha = digits.length === 8 ? byte(6) / 255 : OPAQUE;
|
|
74
|
+
return [byte(0), byte(2), byte(4), alpha];
|
|
75
|
+
}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The state one compile of one file shares, and the small answers every pass
|
|
3
|
+
* asks of it.
|
|
4
|
+
*
|
|
5
|
+
* The passes that emit code are ordinary functions taking this and a node, on
|
|
6
|
+
* the same arrangement the checker uses, so a reader can follow one expression
|
|
7
|
+
* from its syntax to its instructions without holding a class hierarchy in
|
|
8
|
+
* their head. Everything mutable is here and nowhere else.
|
|
9
|
+
*/
|
|
10
|
+
import type { Argument, Call, Expression, Name, NameReference } from '../ast/index.js';
|
|
11
|
+
import { withoutGrouping } from '../ast/index.js';
|
|
12
|
+
import type {
|
|
13
|
+
Binding,
|
|
14
|
+
CheckedCall,
|
|
15
|
+
CheckedInput,
|
|
16
|
+
CheckedScript,
|
|
17
|
+
LibraryEntry,
|
|
18
|
+
} from '../check/index.js';
|
|
19
|
+
import { inputHeldBy } from '../check/index.js';
|
|
20
|
+
import type { RequestScope } from './request-scope.js';
|
|
21
|
+
import type { DiagnosticSink } from '../diagnostics/index.js';
|
|
22
|
+
import type { SourceFile } from '../source/index.js';
|
|
23
|
+
import type { Span } from '../span/index.js';
|
|
24
|
+
import { CodeBuilder } from './code.js';
|
|
25
|
+
import { GapLog } from './gaps.js';
|
|
26
|
+
import { FrameLayout, Layout } from './layout.js';
|
|
27
|
+
import { ConstantPool } from './pool.js';
|
|
28
|
+
import type {
|
|
29
|
+
Alert,
|
|
30
|
+
Band,
|
|
31
|
+
CompiledFunction,
|
|
32
|
+
CompiledInput,
|
|
33
|
+
Grid,
|
|
34
|
+
LibraryFunction,
|
|
35
|
+
Level,
|
|
36
|
+
Loop,
|
|
37
|
+
Marker,
|
|
38
|
+
Paint,
|
|
39
|
+
Plot,
|
|
40
|
+
Request,
|
|
41
|
+
} from './program.js';
|
|
42
|
+
import { fold } from './values.js';
|
|
43
|
+
import type { FoldEnvironment, Value } from './values.js';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The calls that declare part of the file's fixed shape and compile to no
|
|
47
|
+
* `CALL_LIB` at all.
|
|
48
|
+
*
|
|
49
|
+
* This is the split the format turns on. A `plot` call is an entry in
|
|
50
|
+
* `outputs.plots` plus one `EMIT` per bar; `input` is a row of the settings
|
|
51
|
+
* dialog and an engine writing a slot at step 5; `table` is a declared grid.
|
|
52
|
+
* None of them is a function an engine calls, so none of them belongs in
|
|
53
|
+
* `lib.functions`, whose only purpose is to be named by a `CALL_LIB` (2.5).
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* The calls that declare part of the file rather than computing anything.
|
|
57
|
+
*
|
|
58
|
+
* None of them is a `CALL_LIB`, so none of them is in the engine's library
|
|
59
|
+
* manifest and none of them can be looked for there. The list is exported so a
|
|
60
|
+
* test that asks which names an engine has to implement can subtract these
|
|
61
|
+
* rather than carry a second copy of them.
|
|
62
|
+
*/
|
|
63
|
+
export const DECLARATION_CALLS: ReadonlySet<string> = new Set([
|
|
64
|
+
'plot',
|
|
65
|
+
'plotCandles',
|
|
66
|
+
'fill',
|
|
67
|
+
'level',
|
|
68
|
+
'table',
|
|
69
|
+
'input',
|
|
70
|
+
'signal',
|
|
71
|
+
'alert',
|
|
72
|
+
'barColor',
|
|
73
|
+
'background',
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
export interface EmitOptions {
|
|
77
|
+
/** The library manifest version, tied to `openscript.language` (2.5). */
|
|
78
|
+
readonly manifest?: number;
|
|
79
|
+
/** The engine's declared state region count, for OS5004. */
|
|
80
|
+
readonly maxStates?: number;
|
|
81
|
+
/** The engine's instruction ceiling, for OS5009. */
|
|
82
|
+
readonly maxInstructions?: number;
|
|
83
|
+
/** Give every top-level name a register, which is `debug.retain` (2.10). */
|
|
84
|
+
readonly retain?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** One call site under construction; its bases are filled once totals are known. */
|
|
88
|
+
export interface Site {
|
|
89
|
+
readonly index: number;
|
|
90
|
+
fn: number;
|
|
91
|
+
argc: number;
|
|
92
|
+
cellBase: number;
|
|
93
|
+
stateBase: number;
|
|
94
|
+
series: number[];
|
|
95
|
+
/** The body this site's `fn` entry was built from, for the base walk. */
|
|
96
|
+
frame: FrameLayout | undefined;
|
|
97
|
+
/** Sites reached from inside that body, so bases nest without overlapping. */
|
|
98
|
+
children: number[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A loop being emitted, and where `break` and `continue` jump to. */
|
|
102
|
+
export interface LoopFrame {
|
|
103
|
+
readonly id: number;
|
|
104
|
+
readonly breaks: number[];
|
|
105
|
+
readonly continues: number[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The frame a pass is emitting into: the top level, or one function body. */
|
|
109
|
+
export class Frame {
|
|
110
|
+
readonly layout = new FrameLayout();
|
|
111
|
+
readonly builder = new CodeBuilder();
|
|
112
|
+
readonly loops: LoopFrame[] = [];
|
|
113
|
+
/** Sites created while emitting this frame, in the order they were created. */
|
|
114
|
+
readonly sites: number[] = [];
|
|
115
|
+
/** A parameter's position, for `HISTP`, by the binding that declared it. */
|
|
116
|
+
readonly parameters = new Map<number, number>();
|
|
117
|
+
readonly topLevel: boolean;
|
|
118
|
+
|
|
119
|
+
constructor(topLevel: boolean) {
|
|
120
|
+
this.topLevel = topLevel;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export class Emitter {
|
|
125
|
+
readonly pool: ConstantPool;
|
|
126
|
+
readonly layout = new Layout();
|
|
127
|
+
readonly gaps: GapLog;
|
|
128
|
+
readonly libraryFunctions: LibraryFunction[];
|
|
129
|
+
/** The signature behind each entry, which is what `requires` is derived from. */
|
|
130
|
+
readonly calledEntries: LibraryEntry[];
|
|
131
|
+
readonly sites: Site[] = [];
|
|
132
|
+
readonly functions: CompiledFunction[] = [];
|
|
133
|
+
readonly functionPos: (readonly [number, readonly (readonly [number, number, number])[]])[] = [];
|
|
134
|
+
readonly loops: Loop[] = [];
|
|
135
|
+
/** A frame per emitted function entry, for the cell and state base walk. */
|
|
136
|
+
readonly functionFrames: FrameLayout[] = [];
|
|
137
|
+
/**
|
|
138
|
+
* File-scope names given a register although nothing reads their history.
|
|
139
|
+
*
|
|
140
|
+
* A slot belongs to one frame, so a name a function body reads has to live
|
|
141
|
+
* somewhere every frame can address; `registers.ts` is where that is decided.
|
|
142
|
+
*/
|
|
143
|
+
readonly promoted = new Set<number>();
|
|
144
|
+
/** Cells and input slots carrying a register beside them, kept in step per bar. */
|
|
145
|
+
readonly shadowed = new Set<number>();
|
|
146
|
+
/**
|
|
147
|
+
* Cells a function body reads, whose register is kept in step within the bar.
|
|
148
|
+
*
|
|
149
|
+
* A cell operand is relative to its own frame (2.11, 3.3), so a body has no
|
|
150
|
+
* instruction that reaches a file-scope `var`. A register is addressed the
|
|
151
|
+
* same way from every frame, so the value goes in one beside the cell: read
|
|
152
|
+
* from the cell at the start of the bar, written again at every assignment,
|
|
153
|
+
* so a body called at any point in the bar reads what the cell holds then.
|
|
154
|
+
*/
|
|
155
|
+
readonly carried = new Set<number>();
|
|
156
|
+
/** Bodies being emitted, so a call graph with a cycle in it stops (11.4). */
|
|
157
|
+
readonly emitting = new Set<number>();
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The file's fixed shape, filled in source order as the declarations are met.
|
|
161
|
+
*
|
|
162
|
+
* Source order is declaration order is legend order, so nothing sorts these
|
|
163
|
+
* afterwards: the script already decided, and a second decision here would be
|
|
164
|
+
* a second answer (2.8).
|
|
165
|
+
*/
|
|
166
|
+
readonly plots: Plot[] = [];
|
|
167
|
+
readonly fills: Band[] = [];
|
|
168
|
+
readonly levels: Level[] = [];
|
|
169
|
+
readonly markers: Marker[] = [];
|
|
170
|
+
readonly tables: Grid[] = [];
|
|
171
|
+
readonly alerts: Alert[] = [];
|
|
172
|
+
readonly inputs: CompiledInput[] = [];
|
|
173
|
+
barColor: Paint | null = null;
|
|
174
|
+
background: Paint | null = null;
|
|
175
|
+
/** The plot key a declaration handle holds, so `fill` can name two of them. */
|
|
176
|
+
readonly handleKeys = new Map<number, string>();
|
|
177
|
+
/** Names holding a declaration handle, which lives where the declaration put it. */
|
|
178
|
+
readonly handles = new Set<number>();
|
|
179
|
+
/** The reads of 2.16, and the request a name holding one came from. */
|
|
180
|
+
readonly requests: Request[] = [];
|
|
181
|
+
readonly requestOf = new Map<number, number>();
|
|
182
|
+
/** The register one read's value lands in, so one call asks one question. */
|
|
183
|
+
readonly requestSeries = new Map<number, number>();
|
|
184
|
+
/**
|
|
185
|
+
* The read whose expression is being emitted, when this emitter is one.
|
|
186
|
+
*
|
|
187
|
+
* An expression inside a read is compiled over other bars, so it gets an
|
|
188
|
+
* emitter of its own rather than a flag on a frame: its registers, its cells
|
|
189
|
+
* and its state regions are counted from zero on the requested bars, and a
|
|
190
|
+
* pass that read the parent's would emit a program that computes this
|
|
191
|
+
* chart's numbers under another chart's name.
|
|
192
|
+
*/
|
|
193
|
+
readonly request: RequestScope | undefined;
|
|
194
|
+
|
|
195
|
+
private readonly libraryIndex: Map<string, number>;
|
|
196
|
+
/** A leaf body, which calls no user function, is shared by every call site. */
|
|
197
|
+
private readonly sharedBodies = new Map<number, number>();
|
|
198
|
+
|
|
199
|
+
readonly file: SourceFile;
|
|
200
|
+
readonly checked: CheckedScript;
|
|
201
|
+
readonly sink: DiagnosticSink;
|
|
202
|
+
readonly options: EmitOptions;
|
|
203
|
+
|
|
204
|
+
constructor(
|
|
205
|
+
file: SourceFile,
|
|
206
|
+
checked: CheckedScript,
|
|
207
|
+
sink: DiagnosticSink,
|
|
208
|
+
options: EmitOptions,
|
|
209
|
+
parent?: Emitter,
|
|
210
|
+
request?: RequestScope,
|
|
211
|
+
) {
|
|
212
|
+
this.file = file;
|
|
213
|
+
this.checked = checked;
|
|
214
|
+
this.sink = sink;
|
|
215
|
+
this.options = options;
|
|
216
|
+
// A read's body shares the constant pool and the library manifest, because
|
|
217
|
+
// neither holds anything that depends on a bar, and one of each is one
|
|
218
|
+
// table for an engine to verify rather than one per read (2.16).
|
|
219
|
+
this.pool = parent?.pool ?? new ConstantPool();
|
|
220
|
+
this.gaps = parent?.gaps ?? new GapLog();
|
|
221
|
+
this.libraryFunctions = parent?.libraryFunctions ?? [];
|
|
222
|
+
this.calledEntries = parent?.calledEntries ?? [];
|
|
223
|
+
this.libraryIndex = parent?.libraryIndex ?? new Map<string, number>();
|
|
224
|
+
this.request = request;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** An emitter for one read's expression, sharing what does not depend on a bar. */
|
|
228
|
+
forRequest(request: RequestScope): Emitter {
|
|
229
|
+
return new Emitter(this.file, this.checked, this.sink, this.options, this, request);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** The checker's answer for one call, which the emitter never re-derives. */
|
|
233
|
+
callAt(call: Call): CheckedCall | undefined {
|
|
234
|
+
return this.checked.callSites.get(call);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** The declaration a name means, from the checker's own resolution. */
|
|
238
|
+
bindingAt(reference: NameReference): Binding | undefined {
|
|
239
|
+
return this.checked.references.get(reference);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** The input one `input()` call declares, from the checker's own table. */
|
|
243
|
+
inputAt(call: Call): CheckedInput | undefined {
|
|
244
|
+
return this.checked.inputs.find((one) => one.call === call);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Whether a call is a declaration rather than something an engine calls. */
|
|
248
|
+
isDeclaration(name: string): boolean {
|
|
249
|
+
return DECLARATION_CALLS.has(name);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The index of a library function in `lib.functions`, adding it on first use.
|
|
254
|
+
*
|
|
255
|
+
* `state` and `effect` are recorded beside the name because 2.5 requires them
|
|
256
|
+
* and because they are facts an engine already knows: they are there to be
|
|
257
|
+
* disagreed with at load, which is how a program compiled against a newer
|
|
258
|
+
* library is caught before it computes a wrong number.
|
|
259
|
+
*/
|
|
260
|
+
libraryFunction(entry: LibraryEntry): number {
|
|
261
|
+
// Keyed by name and arity, because a name may carry two signatures: `clear`
|
|
262
|
+
// empties an array or a grid and the two are separate entries (stdlib 2.2).
|
|
263
|
+
const key = `${entry.name}/${entry.parameters.length}`;
|
|
264
|
+
const found = this.libraryIndex.get(key);
|
|
265
|
+
if (found !== undefined) return found;
|
|
266
|
+
const index = this.libraryFunctions.length;
|
|
267
|
+
this.libraryFunctions.push({
|
|
268
|
+
name: entry.name,
|
|
269
|
+
arity: arityOf(entry),
|
|
270
|
+
state: entry.stateful,
|
|
271
|
+
effect: effectOf(entry),
|
|
272
|
+
});
|
|
273
|
+
this.calledEntries.push(entry);
|
|
274
|
+
this.libraryIndex.set(key, index);
|
|
275
|
+
return index;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
newSite(fn: number, argc: number): Site {
|
|
279
|
+
const site: Site = {
|
|
280
|
+
index: this.sites.length,
|
|
281
|
+
fn,
|
|
282
|
+
argc,
|
|
283
|
+
cellBase: 0,
|
|
284
|
+
stateBase: 0,
|
|
285
|
+
series: [],
|
|
286
|
+
frame: undefined,
|
|
287
|
+
children: [],
|
|
288
|
+
};
|
|
289
|
+
this.sites.push(site);
|
|
290
|
+
return site;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
newLoop(kind: Loop['kind'], span: Span): number {
|
|
294
|
+
const id = this.loops.length;
|
|
295
|
+
this.loops.push({ id, kind, line: span.line, col: span.column });
|
|
296
|
+
return id;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** A body that calls no user function is one entry however many sites reach it. */
|
|
300
|
+
shareableBody(checkedFunction: number): number | undefined {
|
|
301
|
+
return this.sharedBodies.get(checkedFunction);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
rememberShareableBody(checkedFunction: number, emitted: number): void {
|
|
305
|
+
this.sharedBodies.set(checkedFunction, emitted);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
gap(what: string, specification: string, span: Span | undefined, blocking: boolean): void {
|
|
309
|
+
this.gaps.add({ what, specification, span, blocking });
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* The value an expression has before bar 0, or nothing when it has none.
|
|
314
|
+
*
|
|
315
|
+
* The environment is built here because folding needs two answers only the
|
|
316
|
+
* checker has: which declaration a name means, and which signature a call
|
|
317
|
+
* resolved to with its arguments already in parameter order.
|
|
318
|
+
*/
|
|
319
|
+
fold(expression: Expression): Value | undefined {
|
|
320
|
+
return fold(expression, this.foldEnvironment());
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
private foldEnvironment(): FoldEnvironment {
|
|
324
|
+
return {
|
|
325
|
+
name: (reference: NameReference): Value | undefined => {
|
|
326
|
+
const binding = this.bindingAt(reference);
|
|
327
|
+
if (binding === undefined) return undefined;
|
|
328
|
+
const held = inputHeldBy(binding);
|
|
329
|
+
if (held === undefined) return undefined;
|
|
330
|
+
const input = this.checked.inputs[held];
|
|
331
|
+
return input === undefined ? undefined : { kind: 'input', key: inputKey(input) };
|
|
332
|
+
},
|
|
333
|
+
call: (call: Call) => {
|
|
334
|
+
const checked = this.callAt(call);
|
|
335
|
+
if (checked === undefined || checked.target !== 'library') return undefined;
|
|
336
|
+
return { name: checked.name, args: checked.arguments };
|
|
337
|
+
},
|
|
338
|
+
input: (call: Call): Value | undefined => {
|
|
339
|
+
const input = this.inputAt(call);
|
|
340
|
+
return input === undefined ? undefined : { kind: 'input', key: inputKey(input) };
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* The key one input is known by: `inputs[].key`, and what a `{ "input": key }`
|
|
348
|
+
* field names (2.3 and 2.6).
|
|
349
|
+
*
|
|
350
|
+
* Here rather than beside the table it keys, because three places name an
|
|
351
|
+
* input by key and a second spelling of this would be a field that points at
|
|
352
|
+
* no row.
|
|
353
|
+
*
|
|
354
|
+
* **Never the input's position.** `host-interface.md` 8.1 promises a key
|
|
355
|
+
* "survives every edit that does not rename it", and a positional key keeps
|
|
356
|
+
* that promise for no edit at all: inserting one tunable above another moves
|
|
357
|
+
* every key below it, and a value a user stored against the third row lands on
|
|
358
|
+
* the fourth, silently, because both are numbers and 8.3 has nothing to refuse.
|
|
359
|
+
* An input written where a value belongs is assigned to no name, so its key is
|
|
360
|
+
* its title, which is what the user sees and what changing is the rename 8.1
|
|
361
|
+
* allows to lose a value. The two cannot collide: two inputs sharing a title
|
|
362
|
+
* are OS3017, a title spelling another input's name is OS3022, and a title
|
|
363
|
+
* that is not there at all is OS3021, so a key of `""` here is a program the
|
|
364
|
+
* checker has already refused.
|
|
365
|
+
*/
|
|
366
|
+
export function inputKey(input: CheckedInput): string {
|
|
367
|
+
return input.name === '' ? input.title : input.name;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Which of the five effects a library call carries, `compiled-program.md` 2.5
|
|
372
|
+
* and 5.4.
|
|
373
|
+
*
|
|
374
|
+
* The rule an entry is read by rather than a list of names, because a list in a
|
|
375
|
+
* second place is a list that drifts. A call with an effect does not perform it
|
|
376
|
+
* when it executes: it appends a record and **pushes absent as its result**. So
|
|
377
|
+
* a call whose result a script uses cannot carry one, and that single sentence
|
|
378
|
+
* settles every case in version 1.
|
|
379
|
+
*
|
|
380
|
+
* `order` is every call that spends money: `strategyOnly`, written with
|
|
381
|
+
* brackets, and returning nothing. A `pos.*` reading is not one, because it is
|
|
382
|
+
* read bare; `order.qtyForRisk` is not one, because it returns a number the
|
|
383
|
+
* script goes on to size an order with.
|
|
384
|
+
*
|
|
385
|
+
* `log` is `print`, which reaches a log outside the machine.
|
|
386
|
+
*
|
|
387
|
+
* `draw` and `signal` are not reachable in version 1 and the emitter says so
|
|
388
|
+
* rather than guessing. A drawing object lives in the object heap, which rolls
|
|
389
|
+
* back with everything else (6.1), so a drawing needs no deferral to be
|
|
390
|
+
* idempotent on a moving bar; a table cell is written to a per-bar output
|
|
391
|
+
* buffer that is committed with the columns (2.8); and a marker and an alert
|
|
392
|
+
* reach the host through a channel declared `defer`, not through a call.
|
|
393
|
+
*/
|
|
394
|
+
export function effectOf(entry: LibraryEntry): LibraryFunction['effect'] {
|
|
395
|
+
if (entry.name === 'print') return 'log';
|
|
396
|
+
if (entry.strategyOnly && entry.callable && entry.returns.kind === 'nothing') return 'order';
|
|
397
|
+
return 'none';
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* The arguments a `CALL_LIB` pushes for one entry, which is its `arity` (2.5).
|
|
402
|
+
*
|
|
403
|
+
* The same for every entry but the order functions, which carry one argument
|
|
404
|
+
* more than the language surface shows: the names of the arguments the script
|
|
405
|
+
* wrote. `calls.ts` says why an order call needs it and no other call does.
|
|
406
|
+
*
|
|
407
|
+
* Stated here rather than at the two places that need it, because the count the
|
|
408
|
+
* program records and the count the instruction pushes disagreeing is a program
|
|
409
|
+
* no engine will load.
|
|
410
|
+
*/
|
|
411
|
+
export function arityOf(entry: LibraryEntry): number {
|
|
412
|
+
return entry.parameters.length + (effectOf(entry) === 'order' ? 1 : 0);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/** The argument written for one parameter of a resolved call, or nothing. */
|
|
416
|
+
export function argumentAt(
|
|
417
|
+
checked: CheckedCall,
|
|
418
|
+
entry: LibraryEntry,
|
|
419
|
+
name: string,
|
|
420
|
+
): Argument | undefined {
|
|
421
|
+
const index = entry.parameters.findIndex((one) => one.name === name);
|
|
422
|
+
return index < 0 ? undefined : checked.arguments[index];
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Every top-level name and the expression it is given, in source order.
|
|
427
|
+
*
|
|
428
|
+
* Two passes need it before any instruction is emitted: one to find the names
|
|
429
|
+
* that hold a declaration handle, and one to find the names that hold a read.
|
|
430
|
+
* Both have to answer about a name written below the line that asks, so both
|
|
431
|
+
* run over the file rather than over what has been emitted so far.
|
|
432
|
+
*/
|
|
433
|
+
export function declaredNames(e: Emitter): readonly DeclaredName[] {
|
|
434
|
+
const found: DeclaredName[] = [];
|
|
435
|
+
for (const item of e.checked.script.items) {
|
|
436
|
+
if (item.kind === 'assignment') {
|
|
437
|
+
found.push({ name: item.target, value: item.value, persistent: false });
|
|
438
|
+
} else if (item.kind === 'varDeclaration') {
|
|
439
|
+
found.push({ name: item.name, value: item.initialiser, persistent: true });
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return found;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** One of those names, and whether `var` was written in front of it. */
|
|
446
|
+
export interface DeclaredName {
|
|
447
|
+
readonly name: Name;
|
|
448
|
+
readonly value: Expression;
|
|
449
|
+
readonly persistent: boolean;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** The dotted name a callee spells, for a call the checker did not resolve. */
|
|
453
|
+
export function calleeText(expression: Expression): string {
|
|
454
|
+
const inner = withoutGrouping(expression);
|
|
455
|
+
if (inner.kind === 'nameReference') return inner.name;
|
|
456
|
+
if (inner.kind === 'member') {
|
|
457
|
+
const object = withoutGrouping(inner.object);
|
|
458
|
+
if (object.kind === 'nameReference') return `${object.name}.${inner.member.text}`;
|
|
459
|
+
}
|
|
460
|
+
return '';
|
|
461
|
+
}
|