Forth Application Techniques
New, Revised Edition Released March 2008
Order Now!
What readers said
about the previous edition:
"It's a different publication; a … set of
excellent notes for a course on Forth… My copy arrived a couple of weeks ago.
I ordered it from FORTH, Inc. to help me teach Forth to a friend. It has already
proven that I'm not too old to learn."
—Jerry Avins
"Thank you much for the speedy service. I really
appreciate that. Though I've been programming in various Forths for over twenty
years (all self taught), I am learning new things that are very useful. Thanks
for a very worthwhile course."
—Carl A. Helber
"I'd like to thank you for publishing
Forth Application Techniques. I think it is an excellent beginner's guide.
I like the fact that it explains the logical reasons for certain words,
giving the student admiration for the common-sense, elegant thinking behind Forth.
The lack of [other] beginners' resources for Forth makes your book that much more important."
—Barak Shilo
This succinct,
detailed tutorial presents a structured, step-by-step way to build your Forth expertise.
From first-day Forth exercises to advanced techniques many programmers never
learn on their own, this course notebook is filled with pithy, succinct discussion
and exercises developed over decades to quickly teach, test and
reinforce Forth language skills.
This is the way to learn Forth: when you complete this textbook and its
exercises, you will be well along the learning curve. It presents
the essentials of the Forth classes of the
same name; its authors share their three decades of experience teaching and writing
about Forth.
|
CONTENTS: Forth Application Techniques
|
- INTRODUCTION
- A Brief History of Forth
- The Philosophy of Forth
- Course Hardware & Software
- Typographic Conventions
- Some Definitions of Terms
- FORTH FUNDAMENTALS
- Interaction with Forth
- Communicating with Forth
- The Command Line
- Data Stack Operations
- Stack Architecture
- Stack Notation
- Single-Cell Stack Manipulation Operators
- Double-Cell Stack Manipulation Operators
- Problems
- Some Reflections
- Forth Definitions
- Our First Forth Word
- Rules for Word Naming
- Compiling Forth Souce
- Programming Tools
- Single and Double-Precision Numbers
- Range of 16- and 32-bit Numbers
- Valid Single- and Double-Precision Numbers
- Arithmetic Operations
- Simple Math Operations
- Scaling
- More About */
- Rational Approximation
- Division
- Example: Horner's Method of Polynomial Evaluation
- Return Stack Operations
- Problems
- STRUCTURED PROGRAMMING IN FORTH
- Introduction
- Conditionals
- Using Conditional Structures
- Nesting IF Structures
- Comparison and Logical Operators
- CASE Statements
- Problems
- Indefinite Loops
- Post-testing Loops
- Pre-testing Loops
- Infinite Loops
- Problem: ?WAY
- Finite Loops
- Index Access
- Counting by 2 or Other Values
- Premature LOOP Termination
- Problems
- Nested LOOP Structures
- Use of the Return Stack by DO and LOOP
- Picking the Best Loop Structure
- Problems
- A Summary of Control Structures
- DATA STORAGE
- Single Data Objects
- Variables
- Access to Data Storage
- Constants
- Some Words About Defining Words
- Problems
- Simple Arrays
- Address Arithmetic
- Example: Array Manipulation
- Problems
- Tables
- STRINGS AND CHARACTERS
- String and Character Management
- Single Characters
- Strings
- String Scratchpad
- Counted Strings
- Character and String Input
- Character and String Output
- String Problems
- Scanning Characters to a Delimiter
- Problems
- Compiling Strings
- Compiling Strings Inside Definitions
- Strings Outside Definitions
- Special String Handling
- Terminal Control
- Problem: ?WAY Revisited
- Comparing Strings
- Summary of String Commands
|
- NUMBER CONVERSION
- Numeric Input
- Problem: IP address
- Numeric Output
- Basic Principles
- High-level Numeric Output Words
- Pictured Numeric Output Words
- Using Pictured Fill Characters
- Processing Special Characters
- Problems
- Summary of Number Conversion Words
- VECTORED EXECUTION
- Basic Principles
- Execution Vectors
- Problem: ?WAY Revisited Again
- Button Tables
- ADVANCED CONCEPTS
- Dictionary
- Structure of a Word
- How Words are Created
- Managing the Dictionary
- Search Orders and Word Lists
- Managing Word Lists
- Word List Access
- Sealed Word Lists
- Text Interpreter
- Interpreting Text From the Keyboard
- Interpreting Text From Other Sources
- Compiler
- Compiler Control
- Nameless Definitions
- Exceptions and Error Handling
- High-level Abort Routines
- Low-level Error Handling
- Defining Words
- Problem: 2ARRAY
- Summary of Defining Words
- FILE OPERATIONS
- The File-Access Word Set
- File Status and Parameters
- Managing Files
- Reading and Writing Files
- Interpreting Files
- Text File Problems
- MULTITASKING
- Basic Principles
- The SwiftOS Multitasker
- SwiftOS Principles
- Task Definition and Control
- Application Examples
- Multitasking Under Windows
- Task Definition and Control
- SwiftForth Multitasking Examples
- Resource Sharing
- Acquiring a Facility
- Releasing a Facility
- Application Design Issues
- Case Study
- STYLE RECOMMENDATIONS
- FORTH Editing Standards
- Stack Effects
- General Comments
- Spacing Within Files
- Open Firmware Coding Style
- Typographic Conventions
- Use of Spaces
- Conditional Structures
- do…loop Structures
- begin…while…repeat Structures
- begin…until…again Structures
- Block Comments
- Stack Comments
- Return Stack Comments
- Numbers
- Naming Conventions
|