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
- 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 ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/
- 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 :
git clone git://github.com/graemeg/freepascal.git(via fpwiki:git_mirrors ) (git is probably the best option)
svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
- download the nightly source zipfile :
- Now run:
cd compiler; make
- This will generate the
fpcbinary, which you can then use to compile the code here.
- Clone this git repository, using one of the links github supplies at the top of the page.
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:
|app||prototype of a full-screen terminal (truetype, using lazarus)|
|b4a||a single-pass assembler (no lookahead or forward jumps), written in perl|
|go||miscellaneous little free pascal demos (console mode)|
|grin||a grammar interpreter (parsing combinators in pascal+python)|
|mn||some crazy notes about ascii delimiters :)|
|ng||my pascal port of the ngaro vm|
|org||work-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.