An architectural trail to threaded-code systems

PM Kogge - Computer, 1982 - computer.org
Computer, 1982computer.org
Interest in software systems based on threaded-code concepts has grown remarkably in
recent years. Advocates of such systems regularly make claims for them that many classical
programmers regard as bordering on the impossible. Typically, proponents claim that it is
possible to construct, in 5K to 10K bytes of code, a software package that* is conversational
like APL, Lisp, or Basic;* includes a compile facility with many high-order language,
structured-programming constructs;* exhibitsperformance very close to that of …
Interest in software systems based on threaded-code concepts has grown remarkably in recent years. Advocates of such systems regularly make claims for them that many classical programmers regard as bordering on the impossible. Typically, proponents claim that it is possible to construct, in 5K to 10K bytes of code, a software package that
* is conversational like APL, Lisp, or Basic;* includes a compile facility with many high-order language, structured-programming constructs;* exhibitsperformance very close to that of machinecoded program equivalents;* is written largely in itself and consequently is largely portable;* places no barriers among combinations of system, compiler, or application code;* can include an integrated, user-controlled virtual memory system for source text and data files;* permits easy user definition of new data types and structures; and
* can be extended to include new commands written either in terms ofexisting commands or in the underlying machine language (an assembler for the underlying machinecan be implemented inas little as a page of text of existing commands). Such systems do exist-Forth is perhaps the best known-and have attracted widespread attention, as evidenced by countless implementations, publications, products, and standards groups. The purpose of this article is to convince the skeptic that these claims are, in fact, achievable without resorting to obscure software magic or arm-waving. The approach is to build a logical (not historical) trail from some rather simple concepts to the outlines of a software system that meets the above claims. A series of generalizations added to a simple view of software leads to the final result, a package approaching the combination of
* a simple instruction-set architecture, or ISA;* the concepts and syntax of a high-order language, or HOL; and
* a set of commands for a conversational monitor.
The ISA (such as it is) is for an abstract machine that is very efficiently implemented by short code segments in almost any current machine architecture. The HOL concepts include hierarchical construction of programs, block structures, GOTOless programming, and user-definable data structures. The commands for the conver-sational monitor permit direct interaction with objects defined by the programmer in terms he defines, not sim-ply in theterms of the underlying machine (ie, core dumps). Further, the command set is directly executable in a conversational mode and includes virtually all commands available in the system; when so executed, they function just as they would if found in an executed program. Finally, programs defined by the programmer are automatically part of the system's set and can be used in any combination with other commands in either a conversational or program-definition mode. This permits a programmer to develop application-oriented interfaces that are compatible with and run as efficiently as the basic monitor commands.
computer.org