Is anyone aware of a FORTH Language distro in the works for RPi ?
GFHumiston@Hotmail.com
-
- Posts: 1
- Joined: Tue Dec 27, 2011 4:21 am
Re: FORTH Language for RPi ?
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:
http://www.forth.org/compilers.html
http://www.forth.org/compilers.html
- gordon@drogon.net
- Posts: 2023
- Joined: Tue Feb 07, 2012 2:14 pm
- Location: Devon, UK
- Contact: Website Twitter
Re: FORTH Language for RPi ?
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)
Gordon
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)
Gordon
--
Gordons projects: https://projects.drogon.net/
Gordons projects: https://projects.drogon.net/
Re: FORTH Language for RPi ?
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.
If all you want is the Forth language running under Linux, then see above.
Re: FORTH Language for RPi ?
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.
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.
-
- Posts: 1
- Joined: Thu Feb 21, 2013 1:03 pm
Re: FORTH Language for RPi ?
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 https://github.com/M2IHP13-admin/JonesForth-arm 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
Pablo.
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

Pablo.
Re: FORTH Language for RPi ?
I've just had printed the 4tH Forth 'compiler' by J.L Bezemer, better known as The Beez: http://thebeez.home.xs4all.nl/4tH/
Google group: https://groups.google.com/forum/?fromgr ... 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 http://abyz.co.uk/rpi/pigpio/pigpio-v1.tar 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.
Google group: https://groups.google.com/forum/?fromgr ... 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 http://abyz.co.uk/rpi/pigpio/pigpio-v1.tar 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: 15
- Joined: Mon Jan 28, 2013 2:40 pm
- Location: Houten The Netherlands
Re: FORTH Language for RPi ?
Hello,
I'am using Gforth with GPIO libraries which you can find here : https://github.com/harrypower/Rpi_Gforth_GPIO.
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?
Bye,
Arie
I'am using Gforth with GPIO libraries which you can find here : https://github.com/harrypower/Rpi_Gforth_GPIO.
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?
Bye,
Arie
Re: FORTH Language for RPi ?
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!
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!
Re: FORTH Language for RPi ?
Just to answer the OP: "8th" supports the RPi as well as desktop and mobile systems.
-
- Posts: 1
- Joined: Wed Dec 02, 2020 8:27 am
Re: FORTH Language for RPi ?
VFX Forth for ARM Linux runs on all Pis from Zero to 4B. GPIO access code is provided. VFX Forth is free of charge for non-commercial use. You can get it from
http://www.mpeforth.com
http://www.mpeforth.com
Re: FORTH Language for RPi ?
Five year necro AND a broken link for a first post !
PeterO

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: FORTH Language for RPi ?
Fixed the link, and post is valid even if late!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.
Re: FORTH Language for RPi ?
VFX Forth with graphics libraries...
Writing Forth is fun. Reading code written by someone else - not so.
Imho this is a write-only language. Documentation was not the strong side of Forth.
If I remember correctly they used Forth on some satellites. Uploading code to run is extremely sparse as you compile it on the fly. The technique of "threaded interpretive languages" is also interesting reading for anybody interested in the development of programming languages.
Writing Forth is fun. Reading code written by someone else - not so.
Imho this is a write-only language. Documentation was not the strong side of Forth.
If I remember correctly they used Forth on some satellites. Uploading code to run is extremely sparse as you compile it on the fly. The technique of "threaded interpretive languages" is also interesting reading for anybody interested in the development of programming languages.
- mahjongg
- Forum Moderator
- Posts: 13675
- Joined: Sun Mar 11, 2012 12:19 am
- Location: South Holland, The Netherlands
Re: FORTH Language for RPi ?
Forth was one of the first languages that early computer hobbyists could run on their home-brew systems, as they could write their own implementation of it. FIG-FORTH was an alternative to "tiny basic", and was extensively documented.
Re: FORTH Language for RPi ?
I had been toying with a Forth here:
https://github.com/blippy/circle/tree/m ... /m01-forth
It is a very numpty implementation so far. Still, Forth on "bare metal", not bad. Actually, it is a fork of rst's excellent Circle OS, with a forth project that I added.
is just a link in that repo for my testing purposes, but if anyone is interested, I could re-instate the file properly.
I haven't done a complete retest to ensure that it works, but I am fairly confident that it should compile and run fine.
https://github.com/blippy/circle/tree/m ... /m01-forth
It is a very numpty implementation so far. Still, Forth on "bare metal", not bad. Actually, it is a fork of rst's excellent Circle OS, with a forth project that I added.
Code: Select all
forth.cpp
I haven't done a complete retest to ensure that it works, but I am fairly confident that it should compile and run fine.
Re: FORTH Language for RPi ?
Lol. My masters thesis was to write a multi-processor OS entirely in Forth. It consisted of a 16 bit 8086 as a database master and a few Z80 processors running on slices on the 8086 address space. This may have been around 1978 I believe.
If I would look at the code today there is no chance that I could fix anything in it. Perhaps the language was well documented. But once you start to develop your own operations in it it kind of starts to grow.
Re: FORTH Language for RPi ?
That sounds like quite an ambitious project for a masters (MPhil, I take it?).