The Journal of Forth Application and Research
ISSN: 0738-2022

Forth Institute Editorial Board Author's Guidelines
Authors Index
Volume 7
Volume 6
Volume 5
Volume 4
Volume 3
Volume 2
Volume 1

Valid XHTML 1.0 Strict
Valid CSS!

Volume Four


Introduction:
Number 1: Expert Systems in Forth
Jack Park
Number 2: 1986 Rochester Forth Conference Proceedings
Lawrence Forsley
Letters:
John K. Gotwals
Ferren MacIntyre
Articles:
The Internals of FORPS: A FORth Production System
Christopher J. Matheus
Abstract
Two distinct programming methodologies — production systems and Forth — have been combined to form a unique system called FORPS. Production systems provide a practical and efficient means for structuring knowledge applicable to the intelligent solution of specific problems. These systems have been widely exploited by the Artificial Intelligence community in the creation of expert systems to assist in such tasks as the diagnosis of disease, the design of computer systems, and the search for natural resources. Forth has found its domain largely in its application to real-time control problems. Many of these applications are becoming increasingly difficult and complex, and require at least a moderate degree of intelligence. FORPS (FORth-based Production System) was developed to combine the intelligent, rule-based control of production systems with the real-time control capabilities of Forth. It is a complete production system offering high speed, extensibility, and simplicity in a small package (object code <3K). This paper details the philosophy and design of FORPS, and presents its capabilities by way of two examples: a fast solution to the Towers of Hanoi and a simple robot obstacle avoidance program.
Tokenized Rule Based System
Steven M. Lewis
Abstract
A rule processing system written in Forth is described. Clauses may be strings of text words, executable Forth code or implicitly executable code allowing implicit access to variables and supporting checks that data is known before it is used. Data structures for clauses and rules are described which allow efficient forward or backward chaining. Finally principles of design of expert systems are discussed.
A Forth Oriented Real-Time Expert System for Speep Staging: a FORTES Polysomnographer
Dana Redington
Abstract
The established programming perspectives that encode knowledge directly into software are currently being challenged by alternative approaches. Standard software practices work well for simple and small tasks. However, more effective computer methods are required as the size of problems escalate in terms of complexity and real-time demands. A recent approach has been to apply the techniques of Knowledge Engineering and develop Expert Systems in Forth. Most Expert Systems previously implemented in Forth act as consultants; they do not collect data directly. The alternative is to develop real-time capability in Forth so that knowledge-based computer systems can act as Expert Operators. This paper introduces, for the first time, a Forth based Expert Operator aimed at real-time sleep staging.
Implementation of an Experimental Microcomputer-Based Medical Diagnosis System
Robert B. Trelease, Jr.
Abstract
An experimental sleep disorders diagnosis system is demonstrated, illustrating the use of Forth and the EXPERT-2 expert system toolkit in implementing medical diagnostic functions on a microcomputer.
An Approach to Natural Language Parsing
Jack Park
Abstract
A description of the design of an expectation-based parser is given. The parser uses a three-part structure consisting of primitive procedures, expectation procedures and heuristics, and a lexical dictionary. By use of this structure in a Forth environment, a self-parsing vocabulary is built.
A Review of Knowledge Engineering and Expert Systems: Toward Expert Operators in Forth
Dana Redington
Abstract
Knowledge Engineering — a rapidly growing segment of Artificial Intelligence — is transforming the way computers interact with the world. Machines can now mimic highly trained specialists in various fields, hence the designation Expert Systems. The greatest proliferation of Expert Systems will be seen in the development of microprocessor-based knowledge systems or personal expert operators. This paper focuses on personal expert operators; it briefly introduces microprocessor-based expert systems and describes how these systems can be made to "think" and "behave" in real-time; language environments that promote Knowledge Engineering are also discussed with an emphasis on Forth.
Compiling Forth for Performance
Thomas Almy
Abstract
Conventional Forth environments use threaded code interpretation techniques. While this makes compilation fast, and keeps the compiler size extremely small, the execution performance tends to be five to ten times slower than that obtainable with compiled languages. Subroutine threaded code, combined with more intelligent compiling words can increase performance markedly on some systems, and several companies sell code optimizers which turn colon definitions into code words either by copying primitives to make inline code or by more sophisticated techniques.

By compiling the complete application, many code optimizations are possible that are not available to mixed systems. For instance, no memory space is allocated for constants, and colon definitions become machine language subroutines. Compiled programs run faster than equivalent programs compiled in C or Pascal, yet have the same code compactness of conventional Forth. Additionally, the compiler compiles faster than most C or Pascal compilers. Performance on an IBM/PC was measured to be roughly 0.25 MOPS (using the sieve benchmark), or about 19 clock cycles per Forth primitive.

The paper will discuss the user interface and implementation concepts of a Forth compiler, and will give examples of some possible optimizations that can be performed.
A Stand-Alone Forth System
D. B. Brumm and Upendra D. Kulkarni
Abstract
A general purpose, diskless microprocessor system operating in Forth has been implemented. It behaves just like a normal disk-based system. The Forth kernel, contained in EPROMs, was generated with the Laboratory Microsystems metacompiler.

This system has the following features:

  • Forth 83 standard (except for vocabularies)
  • nonvolatile source code storage
  • nonvolatile retention of compiled code
  • interrupt support (written in Forth)
  • stand-alone operation
  • built-in editor
  • Z-80 STD bus
  • low power consumption
  • no mechanical devices
The source code storage area consists of up to 64 K bytes of nonvolatile memory on a separate board which is accessed through I/O ports. New source code can be entered into the screen memory by using the built-in editor, downloading through a serial link, or plugging the board into a disk-based STD bus system. Any block can be designated as a boot screen, permitting any sequence of words to be executed automatically at power-on.

The use of CMOS chips for the main memory permits the nonvolatile retention of compiled code as well, so that any application words are ready to run immediately after turning the system on.

This system is being used to control an automatic tree harvesting machine designed by the U.S. Forest Service; it can easily be adapted for other tasks.
REPTIL: Bridging the Gap Between Application and Education
Israel Urieli
Abstract
REPTIL (a REcursive Postfix Threaded Interpretive Language) is a Forth-like language which has been designed with the specific motive of being a viable alternative language to bridge the gap between education and application. It has been developed over the past few years (1,2,3) mainly because of a dissatisfaction with the current de facto educational environment, in which one is expected to learn at least three languages before reaching an application maturity.
Julian Day Numbers With Forth
Leonard F. Zettel
Abstract
The Julian Day Number system of time reckoning is described. Forth words for converting between Julian Day number and either Julian or Gregorian calendar dates are given.
Embeddings of Languages in Forth
Robert D. Dixon
Abstract
Recent Forth literature contains so many papers on embeddings of other languages in Forth that the reader might ask, "Does anyone do real work in Forth anymore?" The answer is while a large amount of important production work is still going on in Forth, there is also a great deal of innovation, particularly in real-time applications. Many of these innovations lead to the definition of new or existing languages in Forth as the easiest and best way to do the job at hand ([DRE86]; [HAR85]; [PAL87]; [RED861). The importance of real-time applications in manufacturing, science and national defense means Forth machines and other languages written in Forth are more significant than one might expect. This paper explores three important aspects of languages in which Forth and its extensions can play a prominent role: conciseness, conceptual models, and extensibility.",
Use of Forth-Based Prolog for Real-Time Expert Systems: I. Spacelab Life Sciences Experiment Application
William H. Paloski, Louis L. Odette, Alfred J. Krever and Allison K. West
Abstract
A real-time expert system is being developed to serve as the astronaut interface for a series of Spacelab vestibular experiments. This expert system is written in a version of Prolog that is itself written in Forth. The Prolog contains a predicate that can be used to execute Forth definitions; thus, the Forth becomes an embedded real-time operating system within the Prolog programming environment. The expert system consists of a data base containing detailed operational instructions for each experiment, a rule base containing Prolog clauses used to determine the next step in an experiment sequence, and a procedure base containing Prolog goals formed from real-time routines coded in Forth. In this paper, we demonstrate and describe the techniques and considerations used to develop this real-time expert system, and we conclude that Forth-based Prolog provides a viable implementation vehicle for this and similar applications.
Use of Forth-Based Prolog for Real-Time Expert Systems: II. A Full Prolog Interpreter Embedded in Forth
Louis L. Odette and William H. Paloski
Abstract
In this article we outline the design of a Prolog interpreter embedded in Forth. The interpreter is the basis of the expert system component of an astronaut interface for a series of Spacelab experiments. The expert system is described in Part I of this article [PAL87]. Here we describe our approach to the representational issues in designing the programming machinery needed to interpret Prolog programs: (1) the internal representation of Prolog objects and (2) the representation of the state of a Prolog computation. We also describe the Forth-Prolog interface we use to support the mixed language programming that is necessary to handle the real-time data acquisition and control tasks involved in the application.

Our goal is to combine the advantages of Forth for real-time programming and the advantages of Prolog for symbolic reasoning. To take advantage of the large body of Prolog code we have developed for previous applications, we implemented the "core" Prolog system described in [CL081] that is compatible with the widely available implementations.

Compiling Prolog to Forth
Louis L. Odette
Abstract
The fact that the focus of a Prolog computation is the structure of the program leads directly to a view of a Prolog compiler as a procedure that takes a collection of Prolog clauses and produces a description of their structure that just happens to be executable. Forth lends itself naturally to the description of both structures and processes. In fact, some hold that Forth programming involves creating the parts of speech required to describe an application. This article proposes that for this reason, Forth is a very good language for prototyping Prolog compilers. A simple object language for a Prolog to Forth compiler is presented and discussed.
Compiling and Analyzing Forth in Prolog
Robert D. Dixon and David Hammendinger
Abstract
A parser, a code generator, a semantic evaluator and an interpreter for Forth are written in Prolog. This is an investigative tool only and the semantic model includes a stack, input and output streams and segmented memory. The structure follows the usual Forth models but the somewhat more concise description emphasizes the exact manner in which Forth words control their environment. Compilers of this type together with Prolog compilers that generate Forth code make an interesting package that might be used to port both languages to a new machine, particularly a Forth machine. The abstraction of the Forth process in this manner may also make the environment more understandable to people inside and outside the Forth user community and thus allow both the wider acceptance of Forth and the generalization of Forth techniques to new languages.
S/K/ID: Combinators in Forth
Johan G. F. Belinfante
Abstract
This paper describes using Forth as a metalanguage to construct a tiny, but extensible, functional programming language S/K/ID. In this type-free language both programs and data are combinators. A defining word DEF: is introduced to implement combinators as words in Forth. The core of S/K/ID consists of primitive combinators S, K and ID defined directly in Forth. The rest is built up in bootstrap fashion by a sequence of definitions. The construction of S/K/ID requires only a primitive Forth system. No control words are used. The execution of combinator code causes silent words to be written to the dictionary. To avoid using the STATE variable, these silent words are compiled using LIT and ,. The code presented has been tested on a Commodore 64 computer using 64FORTH by Human Engineered Software, Inc.
Technical Notes:
Fuzzy Query Language
Robert E. La Quey
Abstract
The purpose of this technical note is to provide a simple model demonstrating one use of fuzzy sets in Forth.

Fuzzy sets have become an academic industry. My intent is not to try to review the products of this industry, but to point to their existence and demonstrate that they are easily imported into Forth. The seminal work is by Zadeh [1978].

Nested Error Handlers
Bill Stoddart
Abstract
As code executes, an application's error handlers may be added to or removed from a sequence that will be executed before entering a system error handler. These user defined error handlers can ensure that an aborting task has a minimum impact on the rest of the system, and that it is correctly re-initialised for subsequent use.
Conference Abstracts:
1986 FORML Conference
Conference Proceedings:
1986 Rochester Forth Conference on Real-Time Artificial Intelligence
Call for Papers
1986 FORML Conference
1987 Rochester Forth Conference on Comparative Computer Architectures