View this file with results and syntax highlighting here.
Notes about how BQN is or could be implemented.
This repository's BQN implementation is written mainly in BQN: the bytecode compiler is completely self-hosted, and the majority of the runtime (r0, r1) is written in BQN except that it is allowed to define primitives; some preprocessing (pr) turns the primitives into identifiers.
The remaining part, a Virtual Machine (VM), can be implemented in any language to obtain a version of BQN running in that language. The VM used for the online REPL is the Javascript implementation, while CBQN is a more advanced VM in C. This page gives an introduction to the CBQN source code. There are platform-specific and generic tests in the test directory.
- The BQN virtual machine and runtime: the non-self-hosted parts of the BQN implementation, or those needed to port it to a new platform.
- Notes on implementing primitives
- Notes on compilation
- Comparison to Co-dfns, the other array-based compiler (plus the newer Pareas).
I held a few early forum discussions on the workings of the self-hosted compiler, but aborted these because the interactive format wasn't doing too much. I haven't yet started on non-interactive replacements.