Microcontroller Port of CBQN
| build | ||
| docs | ||
| include | ||
| src | ||
| test | ||
| .gitignore | ||
| .gitmodules | ||
| cc.bqn | ||
| genRuntime | ||
| genRuntimeSrc | ||
| LICENSE | ||
| makefile | ||
| README.md | ||
| SingeliMake.bqn | ||
A BQN implementation in C
CBQN-specific documentation • source code overview
Running
make- Third-party packages and other ways to run BQN are listed here
make CC=gccif clang isn't installedmake PIE=""on ARM CPUs (incl. Android & M1)make FFI=0if your system doesn't have libffi (see macOS for FFI support on macOS)- Use
gmakeon BSD make cleanif anything breaks and you want a clean build slate- Run
sudo make installafterwards to install into/usr/local/bin/bqn(aPREFIX=/some/pathargument will install to/some/path/bin/bqn);sudo make uninstallto uninstall - If you want to use custom build types but your system doesn't have
shasum/sha256sum, addforce_build_dir=some_identifier. That identifier will be used to decide on the directory for incremental build object files.
./BQN somefile.bqnto execute a file, orrlwrap ./BQNfor a REPL
Configuration options
some-other-bqn-implementation ./genRuntime path/to/mlochbaum/BQNcan be used to avoid pulling precompiled bytecode with git fromremotes/origin/bytecode.
This creates the dummy filesrc/gen/customRuntime, which will disable automated bytecode retrieval, leading to the bytecode going out-of-sync whenever it needs updating.
make clean-runtime(which is included inmake clean) can be used to reset this to the default state.- Different build types:
make o3--O3, the default buildmake o3n--O3 -march=nativemake o3g--g -O3make debug- unoptimized debug buildmake debug1- debug build without parallel compilation. Useful if everything errors, and you don't want error messages of multiple threads to be written at the same time.make heapverify- verify that refcounting is done correctlymake o3n-singeli- a Singeli build, currently only for x86-64 CPUs supporting AVX2 & BMI2make shared-o3- produce the shared librarylibcbqn.somake c- a build with no flags, for manual customizingmake shared-c- likemake cbut for a shared librarymake single-(o3|o3g|debug|c)- compile everything as a single translation unit. Will compile slower & won't have incremental compilation.
- For any of the above (especially
make c), you can add extra flags withf=...(and linker flags withlf=...), e.g.
make f='-O3 -DSOME_MACRO=whatever -some_other_cc_flag' c
Macros that you may want to define are listed insrc/h.h. - A specific build type can be cleaned by adding
clean=1to the make argument list. Similarly, addingbuilddir=1will give you the build directory. - Tests can be run with
./BQN path/to/mlochbaum/BQN/test/this.bqn(add-noerrif usingmake heapverify). - Some implementation docs
macOS
To use FFI in macOS, libffi must be installed, and manually added to C_INCLUDE_PATH and LIBRARY_PATH. In addition, the NO_DYNAMIC_LIST=1 make argument is needed, so the full command might, depending on where libffi is installed, look like one of these:
C_INCLUDE_PATH=/opt/homebrew/opt/libffi/include:$C_INCLUDE_PATH LIBRARY_PATH=/opt/homebrew/opt/libffi/lib:$LIBRARY_PATH make PIE="" NO_DYNAMIC_LIST=1
C_INCLUDE_PATH=/usr/local/opt/libffi/include:$C_INCLUDE_PATH LIBRARY_PATH=/usr/local/opt/libffi/lib:$LIBRARY_PATH make PIE="" NO_DYNAMIC_LIST=1
Further configuration (different build type, compiler options, etc) can still be done by adding more make arguments.
License
Any file without an explicit copyright message is copyright (c) 2021 dzaima, GNU GPLv3 - see LICENSE