Forth is an imperative stack-based programming language, and a member of the class of extensible interactive languages. It was created by Charles Moore in 1970 to control telescopes in observatories using small computers. Because of its roots, Forth stresses efficiency, compactness, flexible and efficient hardware/software interaction.
Forth has a number of properties that contrast it from many other programming languages. In particular, Forth has no inherent keywords and is extensible. It is both a low level and high level language. It has the interesting property of being able to compile itself into a new compiler, debug itself and to experiment in real time as the system is built. Forth is an extremely flexible language, with high portability, compact source and object code, and a language that is easy to learn, program and debug. It has an incremental compiler, an interpreter and a very fast edit-compile-test cycle. Forth uses a stack to pass data between words, and it uses the raw memory for more permanent storage. It also lets coders write their own control structures.
Forth has often being deployed in embedded systems due to the compactness of object code. Forth is also used in boot loaders such as Open Firmware (developed by Sun Microsystems) as well as scientific fields such as astronomy, mathematics, oceanography and electrical engineering.
1. Thinking Forth by Leo Brodie
Thinking Forth captures the philosophy of problem solving and programming style, applied to the unique programming language Forth. The book was first published in 1984. It is widely recognized as an essential read for all budding Forth programmers.
Many software engineering principles discussed here have been rediscovered in eXtreme Programming, including (re)factoring, modularity, bottom-up and incremental design. Learn all about the philosophy of Forth, analysis, decomposition, problem solving, style and conventions, factoring, handling data, and minimizing control structures.
The book includes interviews with the investor of Forth, Charles H. Moore, as well as interviews with other Forth luminaries.
- The Philosophy of Forth – examines some of the major philosophies advanced by computer scientists over the years.
- Analysis – examines the analysis and engineering stages of the programming cycle.
- Preliminary Design/Decomposition – discusses two ways to decompose your Forth application: decomposition by component and decomposition by sequential complexity.
- Detailed Design/Problem Solving – applies problem-solving techniques to the detailed design of a Forth application.
- Implementation: Elements of Forth Style – delves into Forth coding convention including listing organization, screen layout, spacing and indentation, commenting, and choosing names.
- Factoring – organizing code into useful fragments. The chapter discusses various “factoring-out” techniques, and the criteria for useful factoring.
- Handling Data: Stacks and States – examines how Forth handles data.
- Minimizing Control Structures – examines techniques for simplifying and eliminating control structures such as using structured exits, vectoring, and redesigning.
- Forth’s Effect on Thinking.
- Appendix A: Overview of Forth (For Newcomers) – the dictionary, data structures, the stack, and control structures.
- Appendix B: Defining DOER/MAKE – helps the reader install DOER and MAKE and understand how they work.
- Appendix C: Other Utilities Described in This Book – define some of the words referred to in this book that may not exist in your system.
- Appendix D: Answers to “Further Thinking” Problems.
- Summary of Style Conventions.
Thinking Forth is published under a Creative Commons license (attribute, non-commercial, share-alike).
2. Starting Forth by Leo Brodie
Starting Forth is an introduction to the FORTH language and operating system for beginners and professionals.
This book explains how to write simple applications in FORTH. It includes all standard FORTH words that you need to write a high-level, single-task application. This word set is an extremely powerful one, including everything from simple math operators to compiler-controlling words.
Each chapter also has a review of terms and a set of exercise problems. Several “Handy Hints” have been included to reveal procedural tips or optional routines that are useful for learners but that don’t merit an explanation as to how or why they work.
3. Programming Forth by Stephen Pelc
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, avoid specifying implementation details, implementers took full advantage.
This book concentrates on introducing people who already know some programming to ANS Forth systems.
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.
4. And So Forth… by J.L. Bezemer
And So Forth… is a primer written in the hope that it’ll be useful and that starting Forth developers aren’t discouraged by the cost of Forth textbooks.
Forth fundamentals – looks at how to manipulate the stack, declaring variables, using booleans, constructs and more.
Arrays and Strings – shows the reader how to use arrays and strings
Stacks and colon definitions – topics included using values, saving temporary values, stack manipulations, and altering the flow with the Return Stack.
Advanced topics – booleans and numbers, including your own definitions, conditional compilation, exceptions, lookup tables, What DOES> CREATE do?, fixed point calculation, recursion, and forward declarations.
Permission is granted to copy, distribute and/or modify this book under the terms of the GNU Free Documentation License, Version 1.1 or any later version.
Pages in this article:
Page 1 – Thinking Forth and more books
Page 2 – A Beginner’s Guide to Forth and more books
All books in this series:
|Free Programming Books|
|Java||General-purpose, concurrent, class-based, object-oriented, high-level language|
|C||General-purpose, procedural, portable, high-level language|
|Python||General-purpose, structured, powerful language|
|C++||General-purpose, portable, free-form, multi-paradigm language|
|C#||Combines the power and flexibility of C++ with the simplicity of Visual Basic|
|PHP||PHP has been at the helm of the web for many years|
|HTML||HyperText Markup Language|
|SQL||Access and manipulate data held in a relational database management system|
|Ruby||General purpose, scripting, structured, flexible, fully object-oriented language|
|Assembly||As close to writing machine code without writing in pure hexadecimal|
|Swift||Powerful and intuitive general-purpose programming language|
|Groovy||Powerful, optionally typed and dynamic language|
|Go||Compiled, statically typed programming language|
|Pascal||Imperative and procedural language designed in the late 1960s|
|Perl||High-level, general-purpose, interpreted, scripting, dynamic language|
|R||De facto standard among statisticians and data analysts|
|COBOL||Common Business-Oriented Language|
|Scala||Modern, object-functional, multi-paradigm, Java-based language|
|Fortran||The first high-level language, using the first compiler|
|Scratch||Visual programming language designed for 8-16 year-old children|
|Lua||Designed as an embeddable scripting language|
|Logo||Dialect of Lisp that features interactivity, modularity, extensibility|
|Rust||Ideal for systems, embedded, and other performance critical code|
|Lisp||Unique features - excellent to study programming constructs|
|Ada||ALGOL-like programming language, extended from Pascal and other languages|
|Haskell||Standardized, general-purpose, polymorphically, statically typed language|
|Scheme||A general-purpose, functional language descended from Lisp and Algol|
|Prolog||A general purpose, declarative, logic programming language|
|Forth||Imperative stack-based programming language|
|Clojure||Dialect of the Lisp programming language|
|Julia||High-level, high-performance language for technical computing|
|Awk||Versatile language designed for pattern scanning and processing language|
|BASIC||Beginner’s All-purpose Symbolic Instruction Code|
|Erlang||General-purpose, concurrent, declarative, functional language|
|VimL||Powerful scripting language of the Vim editor|
|OCaml||The main implementation of the Caml language|
|ECMAScript||Best known as the language embedded in web browsers|
|Bash||Shell and command language; popular both as a shell and a scripting language|
|LaTeX||Professional document preparation system and document markup language|
|TeX||Markup and programming language - create professional quality typeset text|
|Arduino||Inexpensive, flexible, open source microcontroller platform|
|Elixir||Relatively new functional language running on the Erlang virtual machine|
|F#||Uses functional, imperative, and object-oriented programming methods|
|Tcl||Dynamic language based on concepts of Lisp, C, and Unix shells|
|Factor||Dynamic stack-based programming language|
|Eiffel||Object-oriented language designed by Bertrand Meyer|
|Agda||Dependently typed functional language based on intuitionistic Type Theory|
|Icon||Wide variety of features for processing and presenting symbolic data|
|XML||Rules for defining semantic tags describing structure ad meaning|
|Vala||Object-oriented language, syntactically similar to C#|
|Standard ML||General-purpose functional language characterized as "Lisp with types"|
|D||General-purpose systems programming language with a C-like syntax|
|Dart||Client-optimized language for fast apps on multiple platforms|
|Markdown||Plain text formatting syntax designed to be easy-to-read and easy-to-write|
|Kotlin||More modern version of Java|
|Objective-C||Object-oriented language that adds Smalltalk-style messaging to C|
|VHDL||Hardware description language used in electronic design automation|
|J||Array programming language based primarily on APL|
|LabVIEW||Designed to enable domain experts to build power systems quickly|
|PostScript||Interpreted, stack-based and Turing complete language|
|Raku||Member of the Perl family of programming languages|