blob: 8235b6cd4ee4f87d4b9462ba3f5612ab832e1a01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<head>
<link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../style.css" rel="stylesheet"/>
<title>BQN implementation notes</title>
</head>
<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div>
<h1 id="bqn-implementation-notes">BQN implementation notes</h1>
<p>Notes about how BQN is implemented. There's not too much here yet.</p>
<ul>
<li><a href="codfns.html">Comparison to Co-dfns</a> discusses the general compilation strategy and how it compares to the only other array-based compiler.</li>
<li><a href="vm.html">The BQN virtual machine and runtime</a> describes the non-self-hosted parts of the BQN implementation, that is, everything you need to port it to a new platform.</li>
</ul>
<p>This repository's BQN implementation is written mainly in BQN: the bytecode <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../src/c.bqn">compiler</a> is completely self-hosted, and the <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../src/r.bqn">majority of the runtime</a> is written in BQN except that it is allowed to define primitives; some preprocessing turns the primitives into identifiers. The remaining part, a VM, can be implemented in any language to obtain a version of BQN running in that language.</p>
<p>The VM used for the online REPL is the <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../docs/bqn.js">Javascript implementation</a>. The bytecode matches dzaima/BQN's format, and <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../dc.bqn">an extension</a> to the compiler adjusts the slightly different block declarations to target dzaima+reference BQN. <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../wc.bqn">An earlier experiment</a> targetting <a href="https://en.wikipedia.org/wiki/WebAssembly">WebAssembly</a> works only on a very small subset of BQN. All versions have automated tests in the <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../test/">test</a> directory.</p>
<p>I have also held some forum discussions on the actual workings of the compiler, but aborted these because the interactive format wasn't doing too much. I haven't yet started on non-interactive replacements.</p>
<ul>
<li><a href="https://chat.stackexchange.com/rooms/52405/conversation/lesson-s1-parenthesis-nesting-level">Parenthesis nesting level</a></li>
<li><a href="https://chat.stackexchange.com/rooms/52405/conversation/lesson-s2-infix-to-rpn">Infix to RPN</a></li>
<li><a href="https://chat.stackexchange.com/rooms/52405/conversation/lesson-s3-parsing-expressions-with-parentheses">Parsing expressions with parentheses</a></li>
</ul>
|