Tuesday, May 26, 2009

Forth resources



"The Forth story has the making of a morality play: Persistant young programmer struggles against indifference to discover Truth and save his suffering comrades. It gets better: ...

I know Forth is the best language so far. I'm pleased at its success, especially in the ultra-conservative arena of Artificial Intelligence. I'm disturbed that people who should, don't appreciate how it embodies their own description of the ideal programming language.

But I'm still exploring without license. Forth has led to an architecture that promises a wonderful integration of software and silicon. And another new programming environment."

-Chuck Moore, developer of Forth.

I like the idea of using stacks to keep track of bits. To give an example, take the gmail inbox. There is now a feature called "archive". We could select mails and archive them - the read mails are popped out of the inbox stack and dropped in the archive stack, away from view. This way, the inbox becomes manageable. I leave only mails that need to be replied to in the inbox, and as soon as possible, send a reply, and archive it.

Obviously, we can't be staring at an empty inbox for long. We can now clear gmail from our stack, and proceed to the next task awaiting.

I stack only a dozen items or less in my head, and give priority to one item at a time, and try to clear the stack as quickly and efficiently as possible, paying utmost attention to the task at hand.

Imagine this as a way of life. A philosophy. A program. That's Forth. Its Turing complete and really close to a Turing machine. The stack is the only window to the infinite tape. Every shift/read operation is defined as a word. This way, it provides elegant integration between software and silicon - it could hardly get better than this. It looks like a high level language to humans and a low level one to machines (or vice versa, depending on how you think).

Whatever the future may hold for Forth, its a wonderful way to learn about representing information, programming and compiling for finding solutions to problems using software and hardware. It could run in just 8k of memory. Forth developed from 1950's as a complete operating system and programming language. Its basics could be learnt in a day or two. Going Forth is not exactly easy, but worth the effort!

Resources to get started with Forth:

http://www.colorforth.com/HOPL.html
http://www.forth.com/starting-forth/sf0/sf0.html
http://thinking-forth.sourceforge.net/
http://www.jwdt.com/~paysan/gforth.html
http://www.forth.org/fd/contents.html
http://www.pin1.org/forthlib/
http://www.taygeta.com/fsl/sciforth.html

Thanks to Joseph Koshy for writing about Forth language in a mail.