Skip to content

Add DATA arrays and metered native callbacks - #3

Merged
treeform merged 1 commit into
masterfrom
polyworld-nn
Sep 24, 2026
Merged

treeform merged 1 commit into
masterfrom
polyworld-nn

Conversation

@treeform

@treeform treeform commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

BASIC programs can now declare immutable numeric arrays with DATA weights = ... and pass arrays to native kernels. Optional AS int32 and AS fixed32 declarations preserve the VM's existing arithmetic, while multiline declarations use _ continuations.

Numeric execution has only signed int32 and Q16.16 fixed-point values. fixed32 names the fixed-point representation; decimal literals are parsed directly into it. The language has no floating-point type or conversion API.

Adds runtime-aware host callbacks, checked numeric array views, and an upfront reservation API that charges native operations against both instruction and work budgets. DATA initializers and live array storage count toward the memory limit; BASIC assignments and native writes to DATA are rejected.

Validation: nim check tests/tests.nim and the full suite in default, -d:danger, and -d:fixedChecks builds. New tests cover DATA parsing and coercion, immutability, reset/restart, array boundaries, callback compatibility, owned string arguments, and atomic budget reservation.

Polyworld integration: Metta-AI/polyworld#72. Merge this Bassy PR first; Polyworld pins this commit in both dependency lockfiles.

@treeform
treeform merged commit 2c54d82 into master Sep 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant