Login
Task S.8c: ≺code≻emit≺/code≻ for the first nodes, run on a Cortex-M0
Login

Branch: slice/S.8c. Commit only there; never to trunk.

Needs: S.8a (the tree arena) and S.8b (the microbit machine) merged.

Read first:

Claim. emit turns a tree of S.8a's nodes into Cortex-M0+ (ARMv6-M, Thumb) code that computes the same Int32 Crystal computes, raising on overflow as Crystal does, and the code runs on QEMU's Cortex-M0.

Passage. The maintainer: "an emit method that walks the ast to generate m0+ code that can be saved, loaded and run for fast performance."

Make:

Constraints. emit.cr and thumb.cr compile into image code later, so they follow S.8a's constraints. The harness and specs may use the standard library. Nothing in the image requires them yet. crystal tool format --check passes.