FORTH Language for RPi ?

11 posts
by » Tue May 01, 2012 3:03 am
Is anyone aware of a FORTH Language distro in the works for RPi ?
Posts: 1
Joined: Tue Dec 27, 2011 4:21 am
by jbeale » Tue May 01, 2012 3:38 am
Not aware of anything specifically for RasPi yet, but I don't see any problem with porting one of the many freely-available versions. Also, there are some Java and JavaScript based Forths which (AFAIK) would not require porting at all. See:
User avatar
Posts: 3078
Joined: Tue Nov 22, 2011 11:51 pm
by tufty » Tue May 01, 2012 7:41 am might be fun to port.
Posts: 1421
Joined: Sun Sep 11, 2011 2:32 pm
by » Tue May 01, 2012 9:31 am
Well there's GForth for a start - a standard package in Debian - many others, I'm sure.

And not a Pi, but cheaper ;-) is the Fignition board - amazing. I saw it being demoed by its creator at the weekend - outputs to composite video done entirely in software on an 8-bit Amel microcontroller.

ok - after sudo apt-get install gforth:
gordon @ dot: gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
1 2 3 * + . 7 ok
: hi ." Hello, world" ; ok
hi Hello, world ok

So there you are - just remember, its running bog-standard (Debian) Linux, so if there's a package for it, then it's almost certian it'll run on the Raspberry Pi. (Although it's not a dedicated Forth "distro" as such)

Gordons projects:
User avatar
Posts: 1693
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by rurwin » Tue May 01, 2012 9:38 am
If you wanted an actual distribution -- ie a standalone Forth environment, then the hard part would be writing the USB and SD card drivers. Those will not exist for any existing Forth distribution and you will probably have to use the Linux drivers as the sole documentation. Porting Forth is trivially easy in comparision.

If all you want is the Forth language running under Linux, then see above.
User avatar
Forum Moderator
Forum Moderator
Posts: 3994
Joined: Mon Jan 09, 2012 3:16 pm
by cheery » Tue May 01, 2012 2:58 pm
You could roll your own easily, by porting JONESFORTH. Forth is unique of all others due to its simplicity.

Standalone Forth environment isn't far away if you can get one written at all. Find yourself a copy of ARM Architecture Reference Manual, ARM1176ZF-S Technical Reference Manual, and BCM2835 ARM Peripherals.

Have seen the kernel.img in the SD card image? On bootup it'll be loaded into the address 0x00000000. The image starts with an exception vector table (0x00-0x20). Fill the vector table with branches into correct handlers.
0x00  Reset
0x04 Undefined Instruction
0x08 Hypervisor Call (Software Interrupt)
0x0C Prefetch Abort
0x10 Data Abort
0x14 Hyp Trap? (not sure what this is)
0x18 IRQ interrupt
0x1C FIQ interrupt

...the hard part would be writing the USB and SD card drivers...

You won't necessarily need those for a toy implementation. And I guess it's same problem for writing any standalone running thing for raspberry.
User avatar
Posts: 219
Joined: Wed Jan 25, 2012 9:39 pm
by pablooliveira » Thu Feb 21, 2013 1:12 pm
Sorry to resurrect such an old topic. But my Embedded System's students ported this semester Jones Forth to Raspberry PI. Their port is available at and seems pretty stable.

The port uses the linux new EABI for input/output, but it could be a fun project to make a bare-metal standalone version in Raspberry-PI :)

Posts: 1
Joined: Thu Feb 21, 2013 1:03 pm
by skiddaw » Fri Mar 01, 2013 1:59 am
I've just had printed the 4tH Forth 'compiler' by J.L Bezemer, better known as The Beez:
Google group: ... h-compiler
I do have 4tH running on a 'Pi but as yet I'm still struggling with the installation. 4tH is a COMPILER but it will work interactively.
I'm also interested in the GPIO c-libraries such as but I'm a ways from getting anything talking, if at all. I was quite elated when the 'Pi went online and also found My Book network drive.
Posts: 9
Joined: Sat Oct 29, 2011 6:19 pm
by arieverbeek » Sun Mar 03, 2013 6:49 pm

I'am using Gforth with GPIO libraries which you can find here :
It has also a assembler/disassembler for arm.
The only trouble I have with the assembler and the Forth is you can only access the virtual memory, so you need the c-libraries for GPIO-access.
A question I have is is there a way to access the GPIO register direct from Forth?

Posts: 12
Joined: Mon Jan 28, 2013 2:40 pm
by mmi » Thu Mar 14, 2013 4:14 am
I think the easiest way to access the GPIO ports from *any* program language is to use the kernels "export", "unexport" interface in the "/sys/class/gpio" directory. It should be accessable by normal file operations also in Forth.

I currently don't have a link, but there is at least one example written in c somewhere - so you can see how it works in detail. And there should be a way to get access to GPIO not only by root. But for very fast GPIO operations (like pwm)
another solution has to be found.

good luck!
Posts: 85
Joined: Sun Feb 24, 2013 3:53 am
Location: Bavaria-Germany
by 8thdev » Mon Nov 09, 2015 6:03 am
Just to answer the OP: "8th" supports the RPi as well as desktop and mobile systems.
Posts: 22
Joined: Fri Jul 31, 2015 2:23 pm