And so Forth…

Categories:

Recommended

Introduction

Don’t you hate it? You’ve just got a new programming language and you’re trying to write your first program. You want to use a certain feature (you know it’s got to be there) and you can’t find it in the manual.

I’ve had that experience many times. So in this manual you will find many short features on all kind of topics. How to input a number from the keyboard, what a cell is, etc.

I hope this will enable you to get quickly on your way. If it didn’t, email me at ’hansoft@bigfoot.com’. You will not only get an answer, but you will help future Forth users as well.

You can use this manual two ways. You can either just get what you need or work your way through. Every section builds on the knowledge you obtained in the previous sections. All sections are grouped into levels. We advise you to use what you’ve learned after you’ve worked your way through a level.

If this isn’t enough to teach you Forth you can always get a real good textbook on Forth, like “Starting Forth” by Leo Brodie. Have fun!

About this primer

This primer was originally written for 4tH, my own Forth compiler. 4tH isn’t ANS-Forth compliant, by ANS-Forth standards not even a ANS-Forth system. After a while I got questions why certain examples weren’t working. Since I tested every single one of them I wondered why. Until it dawned on me: people learning Forth were using my primer!

So due to high demand I started to rewrite it for ANS-Forth compliant systems. Most of these systems don’t even have a manual at all so the need for it should be great. The next question was: which format. Since I wanted to learn LYX anyway, I settled for that. You can produce various formats with it which are readable on most systems, including MS-DOS, MS-Windows and Linux.

The next question was: how far do you go. The original version was heavily geared towards 4tH, which reflects my own views on Forth. And those views sometimes contradict to those of ANS-Forth. However, since Leo Brodie took the liberty in ”Thinking Forth” to express his views, I thought I should have the freedom to express mine.

Some examples, especially in the ”Advanced topics” chapter, use special 4tH extensions. Fortunately Wil Baden had helped me to write a 4tH-to-ANS-Forth interface. Since some of these extensions cover functionalities commonly found in other languages I decided to keep those sections in, using the Easy4tH definitions. In the previous chapters you’ll find some 4tH words as well, but very sparingly.

You may find that some examples are not working with your specific Forth compiler. That may have several reasons. First, your compiler may not support all ANS-Forth wordsets. Second, your compiler may not be completely ANS-Forth compliant. I’ve tested most of these examples with GForth or Win32Forth, which are (almost) 100% ANS-Forth compliant. Third, your compiler might be case-sensitive.

The ANS-Forth standard is a very important document. I can only advise you to get it. You should have no trouble finding it on the internet. I can only hope that the compiler you chose at least documented its ANS-Forth compatibility.

This primer was written in the hope that it will be useful and that starting Forthers aren’t put off by the high price of Forth textbooks. It is dedicated to Leo Brodie, who taught me much more than just Forth.

 

 

Category:

Attribution

J.L. Bezemer. And so Forth…. https://ficl.sourceforge.net/pdf/Forth_Primer.pdf

VP Flipbook Maker

Convert your work to digital flipbook with VP Online Flipbook Maker! You can also create a new one with the tool. Try it now!