the b4 programming language : a tiny forthlike, written in free pascal
Pascal JavaScript Python Forth HTML J Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
b4a
blog
game
go
lib
mn
mr
ng
org
pre
ref
rx
shrx
turbo
vm
web
.gitignore
.gitmodules
LICENSE.org
Makefile
README.org
b4.00.tasklist.org
b4.01.wishlist.org
b4.02.changelog.org
b4.10.concepts.org
b4.e0.fundamentals.org
b4.e1.language.org
retroImage
retroterm.vpp
tangle.el

README.org

The b4 programming language.

About

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 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 :
          • ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/source/fpc.zip
      • 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)

Background

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.