From 101155d42e52d056d20b89684ade3bf279e0abb2 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 20 May 2021 17:23:31 -0400 Subject: Updated CBQN information --- docs/running.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'docs/running.html') diff --git a/docs/running.html b/docs/running.html index 592be37e..785c2769 100644 --- a/docs/running.html +++ b/docs/running.html @@ -5,24 +5,26 @@

How to run BQN

-

There are currently two active BQN implementations: the self-hosted one in this repository, and the independent dzaima/BQN. Neither is entirely complete but they are quite capable for pure programming tasks (say, implementing a compiler). dzaima/BQN has good performance while self-hosted is a few hundred times slower. I tend to develop parts of applications in the online REPL and move to dzaima/BQN scripts in order to run them.

-

Scripts in this repository use bqn in the #! line if self-hosted or dzaima/BQN can run them, and dbqn if only dzaima/BQN works.

+

We are currently working quickly to make CBQN into the definitive offline implementation. Compilation speed (self-hosted) is good, the only significant core language feature missing is block headers and multiple bodies, and the essential system functions are there. Unless you need to start heavy number crunching right away, I recommend that you use CBQN and make system function or performance requests on Github or the BQN forums.

+

A lot of development to date has been done in dzaima/BQN and uses features (mainly headers) that aren't in CBQN yet. Scripts in this repository use bqn in the #! line if self-hosted or dzaima/BQN can run them, and dbqn if only dzaima/BQN works.

Self-hosted BQN

See the subsections below for instructions on specific implementations.

This version of BQN is implemented mainly in BQN itself, but a host language supplies basic functionality and can also replace primitives for better performance. This also allows embedding, where programs in the host language can include BQN code. It fully supports all primitives except a few cases of structural Under (), but is still missing some advanced features: block headers and multiple body syntax, derived 1-modifiers, and block returns.

Support in the following languages has been implemented:

Javascript

The online REPL is here. The file docs/bqn.js is zero-dependency Javascript, and can be loaded from HTML or Node.js. For command line use, call the Node.js script bqn.js, passing a file and •args, or -e to execute all remaining arguments directly and print the results. This notebook shows how to run it in an Observable notebook.

CBQN

-

C sources are kept in the CBQN repository, but they also require the self-hosted bytecode to be built using cc.bqn in that repository. Although cc.bqn is typically run with dzaima/BQN, this can be changed by modifying the #! line at the beginning, or linking dbqn to a different executable. To use only the BQN and CBQN repositories, avoiding dzaima/BQN, first build with bqn.js—this is slow, but should take under a minute even on low-end hardware—then switch to CBQN itself afterwards for faster builds.

+

C sources are kept in the CBQN repository, but they also require the self-hosted bytecode to be built using genRuntime in that repository. The script uses bqn (whatever that is) by default, but can be run with another BQN executable: bqn.js or dzaima/BQN will work. For example, run $ path/BQN/bqn.js genRuntime path/BQN/ to bootstrap using Node.js (slow but should be under a minute even on cheap hardware). Once bootstrapped CBQN itself is the fastest option.

+

Options are configured at the top of src/main.c. I uncomment #define FORMATTER to get array formatting like this site uses.

+

CBQN uses the self-hosted runtime to achieve full primitive coverage, and implements specific primitives or parts of primitives natively to speed them up. This means primitives with native support—including everything used by the compiler—are fairly fast while others are much slower.

dzaima/BQN

-

dzaima/BQN is an implementation in Java created by modifying the existing dzaima/APL. It should be easy to run on desktop Linux and Android. It is still in development and has almost complete syntax support but incomplete primitive support: major missing functionality is dyadic Depth (), Windows (), and many cases of set functions (⊐⊒∊⍷, mostly with rank >1).

+

dzaima/BQN is an implementation in Java created by modifying the existing dzaima/APL, and should be easy to run on desktop Linux and Android. It may be abandoned as dzaima is now working on CBQN. It has almost complete syntax support but incomplete primitive support: major missing functionality is dyadic Depth (), Windows (), and many cases of set functions (⊐⊒∊⍷, mostly with rank >1).

In this repository and elsewhere, dzaima/BQN scripts are called with #! /usr/bin/env dbqn. This requires an executable file dbqn somewhere in your path with the following contents:

#! /bin/bash
 
-- 
cgit v1.2.3