View this file with results and syntax highlighting here.
primitives • compiling • state of CBQN • VM documentation
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. Its required behavior is documented here. There is a pure-BQN implementation for bqn.bqn, but its only practical purpose is to quickly test modifications to the runtime and compiler. 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.