Abstract
In the late 1980s, the task of printing a file on a UNIX system was a complex engineering challenge requiring the manual assembly of software pipelines. This paper, originally presented at AAAI-88, introduces the Expert System for Printing (ESP). ESP utilizes frame-based knowledge representation and rule-based reasoning to solve the "program recombination problem," automatically generating the intricate command-line strings necessary to transform source documents into printer-ready formats. By modeling software tools as objects with specific input/output constraints, ESP demonstrates an early and effective approach to automated software configuration and systems administration.
Introduction
While modern users take the Ctrl+P shortcut for granted, the computing environment of the 1980s treated printing as a multi-stage transformation process. On a typical UNIX system, printing a document containing tables, equations, or specific formatting macros required a user to manually string together several independent utilities. A single mistake in the order of tools or the selection of flags would result in a failed print job or, worse, pages of "garbage" output.
This paper addresses a foundational challenge in computer science: how to represent software knowledge so that a system can automatically "recombine" existing programs to solve a specific problem. The authors identify this as a subset of automatic programming, focusing on the intelligent connection of existing modules rather than the generation of new code.
The Problem: The Complexity of UNIX Pipelines
In the 1980s, a user wishing to print a complex document might need to execute a command like this:
cat file | tbl | eqn | troff -mm | dpost | lpr -Ppostscript
To construct this pipeline, the user had to know:
- File Content: Does the file contain tables (
tbl) or equations (eqn) demands? - Tool Ordering: Which pre-processors must run before the formatter (
troff) and which post-processors (likedpost) are needed for the specific printer? - Flag Requirements: Which macro packages (e.g.,
-mmor-ms) are required for this specific document type? - Hardware Compatibility: Which printers are capable of handling the resulting data stream?
Even for technical staff at Bell Laboratories, where this research was conducted, this manual configuration was a significant source of friction and error.
Methods and Knowledge Representation
The authors developed ESP (Expert System for Printing) to automate this reasoning. The system is built on two primary pillars: frame-based knowledge representation and rule-based reasoning.
Frame-Based Modeling
ESP represents the printing ecosystem using "frames"—data structures with "slots" that define the properties of entities:
- File Types: These frames use text patterns and signatures to identify the nature of a file (e.g., recognizing
troffmacros or source code). - Translators: These frames define the software tools. Each translator is defined by its input and output types, its relative "order" in a pipeline, and its specific invocation syntax.
- Printers: These frames track the status, location, and acceptable data formats (such as PostScript or daisy-wheel text) for available hardware.
Reasoning with Demons
To handle user preferences and system defaults, ESP employs "demons." These are small, reactive rules that trigger when specific conditions are met. For example, if a user has a preferred macro package, a demon will automatically insert the corresponding flag into the command string unless it detects a conflict with the file's detected type.
Implementation
The system was implemented using a hybrid approach: 170 rules written in OPS5 (a classic production system language) to handle the high-level logic, and 20 routines in C to handle low-level system interactions and string manipulations.
The ESP Execution Script
When a user requests a print job, ESP follows a structured six-step process:
- Determine Printability: Ensure the file is not a directory or a binary executable.
- Detect File Types: Analyze the file content to identify necessary pre-processors.
- Select a Printer: Match the user's request with an available, compatible printer.
- Find Translators: Identify the chain of tools needed to bridge the gap between the file type and the printer's required format.
- Order Translators: Arrange the tools in the correct logical sequence.
- Construct Command: Generate the final UNIX command-line string and execute it.
Key Insights and Results
ESP represents a shift in how software is perceived. By treating command-line tools as objects with metadata rather than just executable code, the authors enabled a machine to reason about software compatibility. This concept of "software as objects" predates modern developments in microservices and automated DevOps workflows.
Results
- Automation of Complexity: ESP successfully generated long, valid pipelines (e.g.,
cat nhg | soelim | pic | eqn | tbl | troff -ms | dpost -n9 -o1-9 | postreverse | lpr -Plwc) that were far beyond the manual recall of average users. - Error Prevention: The system acted as a gatekeeper, preventing the waste of resources by identifying unprintable files and explaining the failure to the user.
- Real-World Utility: The system was deployed at AT&T Bell Laboratories, where it was used daily by both technical and administrative staff, proving the practical value of expert systems in systems administration.
Limitations and Future Work
Despite its success, the authors noted several limitations:
- Shallow Modeling: ESP understood the inputs and outputs of a program but lacked a model of "side effects" (e.g., auxiliary files created by a compiler).
- Invocation Complexity: Tools with non-standard argument structures or those requiring specific file extensions were difficult to model in a generic pipeline.
- Environmental Awareness: The system lacked real-time knowledge of the network or file system state, such as whether a printer was physically jammed.
The paper concludes by suggesting that future systems should move toward "cognitive models"—understanding the human intent behind software tasks to create even more intuitive automation. While the specific problem of printing has been solved by modern drivers, the challenge of "intelligent recombination" remains a central theme in software engineering today.
Summary updated