Saturday 5 July 2014

Installing Forth on Raspberry Pi

I had a very tiring day yesterday and wanted to read something a little relaxing in the evening, definitely nothing directly related to my work. So I scanned through my growing list of eBooks, many of them still unread, and came across my copy of Starting Forth by Leo Brodie. (You can read the book online on Forth Inc's website.)

I have been helping out with the development of Red Programming Language since its early days. Red is heavily influenced by Rebol which in turn has elements of Forth in it. Even after reading the first few pages of Starting Forth, I was able to better understand part of Red's roots.

For a long time now, my approach to programming has been to build things step at a time. The Forth philosophy exemplifies this approach with the exception of automated testing. (I need to investigate unit testing in Forth).

I believe that children tend to learn in small steps, they discover something new (perhaps with the help of a teacher) and then practice and practice. When they are comfortable with what they've just learnt, they move on to learn something else. It occurred to me that Forth could be a good language for children to learn and what better computer to learn Forth on than a Raspberry Pi?

There are lots of different Forths about. I chose the open-source GForth which is readily available for Raspbian. A single terminal command:

    sudo apt-get install gforth

A few minutes later, Forth was ready to go:

GForth on Raspberry Pi
Click to Enlarge

2 comments:

Anonymous said...

Actually, for the pi it's "sudo apt-get install gforth", in case anyone runs into the same issue I did.

Thanks for the article, and long live Forth!

Peter W A Wood, Programmer said...

Thanks for letter me know about the typing error. I've updated the blog entry.