Programming Forth

Categories:

Recommended

Programming Forth introduces you to modern Forth systems. In 1994 the ANS Forth standard was released and unleashed a wave of creativity among Forth compiler writers. Because the ANS standard, unlike the previous informal Forth-83 standard, avoids specifying implementation details, implementers took full advantage. The result has been what I choose to call modern Forths, which are available from a range of sources both commercial and open-source.

This book concentrates on introducing people who already know some programming to ANS Forth systems. It is not a treatise on ANS Forth itself – if you need the gory details, the last public (freely distributable) draft of the ANS standard is included on the CD supplied with purchased copies of the book. Copies in PDF format are available by download from http://www.mpeforth.com/arena at no cost. If you are a novice programmer (or indeed at all interested in the craft of programming) read this book alongside “Starting Forth” and “Thinking Forth” by Leo Brodie. How to get them is in the chapter on other books and resources.

Apart from the introduction of ANS Forth itself, Programming Forth includes examples of varying sizes, exercises, some advanced topics, how to take best advantage of Forth and project management.

The material is derived from course material from MicroProcessor Engineering and teaching work at Teesside University by Bill Stoddart and Peter Knaggs, plus new material. Both the printed and the PDF versions are updated from time to time to incorporate changes requested by readers. If you want to comment on the book please send feedback to programforth@mpeforth.com – I appreciate all your comments and contributions.

What Forth is

Forth is a member of the class of extensible interactive languages, which includes classical implementations of Smalltalk. Extensible means that there is no distinction between the keywords (core words) and the routines that you write. Once a new definition has been compiled, even from the keyboard, it is immediately available to you. Interactive means that you can talk to it from your keyboard.

Forth is a different sort of computer language. Forth code is easy to debug because Forth is interactive, fast because Forth is compiled and powerful because it is extensible. Forth is a language with a definite style.

Forth was developed by Charles (Chuck) Moore in the early 1960s. Moore’s work with computers at MIT and the Stanford Linear Accelerator Centre left him dissatisfied. The turn-round time for editing, compiling and running a program using the then current generation of ALGOL and FORTRAN compilers was too slow. His solution to this was to write a simple text interpreter in ALGOL which read in words (any printable characters except space) and performed actions associated with them. Words were either primaries (i.e. “understood” by the interpreter) or secondaries (i.e. defined in terms of other words).

After his initial success with an ALGOL based interpreter at MIT and Stanford, Moore moved on to work with Burroughs equipment. This hardware was strongly oriented around a stack. This influenced the further development of Forth. Implementations were written in BALGOL, COBOL and SBOL (the Burroughs Systems Programming Language). These provided manipulation words for the stack: DROP, DUP, SWAP, etc. which are still found in modern Forth systems. The first true Forth system which resembled what we now perceive as Forth was then created by Moore on an IBM 1130. The word size of this machine limited the users to having names of not more than five characters. Had it not been for this IBM limitation the name `Forth’ would have been `Fourth’ – standing for Fourth Generation Language.

The first Forth application was a Radio Telescope Data Acquisition Program written for a Honeywell H316 at the National Radio Astronomy Observatory. This implementation of Forth used a dictionary to store words defined by the user.

Category:

Attribution

Stephen Pelc. Programming Forth. https://www.mpeforth.com/arena/ProgramForth.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!