Skip to content
the b4 programming language : a tiny forthlike, written in free pascal
Pascal JavaScript Python Forth HTML J Other
Find file
Failed to load latest commit information.
app RECOVERY: moving calavera
b4a b4a.js: clean up console messages
blog blog/heaps: corrected the part about CAR/CDR
game removed b4.rx, since it's now vt.rx / help.rx in the retro distribution
go ukanren: hopefully this was a bugfix :)
lib update xpl
mn cleaned up Makefile and top level directory
mr old, rough start on a database assembler
ng ng: support kvm.backspace
org RECOVERY: moving calavera
pre pre: unfinished picolisp translation that i did some time ago (probab…
ref mockup of how a hehner-style proof language might look
rx rx/bnf: start of a port of that bnf parser paper
shrx shrx: created application stub.
turbo turbo: fpc changes and code formatting
vm the 'red pixel' image from (aug 2)
web notes on mini-rosetta (TODO)
.gitignore gitignored fp and dolphin files
.gitmodules (hopefully) fixed submodules for win32 added basic licensing information
Makefile Makefile: removed reference to ng/*.inc, added retro-e fix the ftp links for github's broken org-parser, and corrected the f… added note about memory manager Extracted, deleting Plus added some str… a changelog. document with some basic terms/concepts [mar 20] start on some b4 lesson plans [mar 20] start on some b4 lesson plans
retroImage RECOVERY: moving calavera
retroterm.vpp retroterm.vpp: changes from the other day (showing TCanvas, I think)
tangle.el add tangle.el for org-babel

The b4 programming language.


b4 is a tiny concatenative programming language, a bit like forth, but with a strong bias toward stepwise refinement and interactive media (like games).

B4 shares a virtual machine with retroforth. (At the time of this writing, B4 is just retroforth, but the final version will be shaved down to a tiny subset suitable for an introductory programming course.)

Compiling and Running the Code

  1. Install free pascal 2.7.1 – the code uses features of the svn trunk version of the compiler, so either:
    • easy way: download the nightly development build for your platform
    • or compile fpc manually (unnecessary, but this is what i do)
      • install freepascal 2.6.0 (you need the stable fpc to compile the trunk version)
      • get the source from one of the following places :
      • Now run: cd compiler; make
      • This will generate the fpc binary, which you can then use to compile the code here.
  2. Clone this git repository, using one of the links github supplies at the top of the page.
  3. run: cd b4; make retro

Other files in this repository:

This repo has become a sort of staging area for code related to the course I’m writing. Most of this stuff is written in pascal, unless otherwise specified:

appprototype of a full-screen terminal (truetype, using lazarus)
b4aa single-pass assembler (no lookahead or forward jumps), written in perl
gomiscellaneous little free pascal demos (console mode)
grina grammar interpreter (parsing combinators in pascal+python)
mnsome crazy notes about ascii delimiters :)
ngmy pascal port of the ngaro vm
orgwork-in-progress parser for org-mode files (like this one)


B4 is a forth-like language. Quick intros to forth (free and online):

B4 runs on an implementation of the ngaro virtual machine, from retroforth.

Many versions of ngaro exist, and B4 should work with any. We’re writing a new one from scratch, using the object pascal languange and the free pascal compiler.

Something went wrong with that request. Please try again.