CONTENTS Title Page Copyright Page Preface Part I VAX OPS5 Components 1 Introduction to VAX OPS5 1.1 VAX OPS5 Structure 1.1.1 Working Memory 1.1.2 Productions 1.1.3 Recognize-Act Cycle 1.2 Atoms 1.2.1 Symbolic Atoms 1.2.2 Integer Atoms 1.2.3 Floating-Point Atoms 1.2.4 Quoted Atoms 1.3 Program Elements 1.3.1 Declarations 1.3.2 Executable Statements 1.3.3 Comments 2 Working Memory 2.1 Working-Memory Elements 2.1.1 Class Name 2.1.2 Attributes 2.1.2.1 Scalar Attributes 2.1.2.2 Vector Attributes 2.2 Internal Representation of Working-Memory Elements 2.2.1 Time Tags 2.2.2 Storing the Class Name and Attribute Values 2.3 Declarations 2.3.1 LITERALIZE Declarations 2.3.2 LITERAL Declarations 2.3.3 VECTOR-ATTRIBUTE Declarations 2.3.4 EXTERNAL Declarations 3 Productions 3.1 Production Name 3.2 Left-Hand Side-Condition Elements 3.2.1 Specifying Condition-Element Components 3.2.1.1 Constants 3.2.1.2 Variables 3.2.1.3 Predicates 3.2.1.4 Conjunctions 3.2.1.5 Disjunctions 3.2.1.6 Function Calls 3.2.1.7 Quote Operator 3.2.2 Specifying Element Variables 3.3 Right-Hand Side-Actions 3.3.1 Variables 3.3.2 Function Calls 3.3.3 Element Designators 4 Recognize-Act Cycle 4.1 Match 4.2 Conflict Resolution 4.2.1 Conflict-Resolution Rules 4.2.1.1 Refraction 4.2.1.2 Recency 4.2.1.3 Specificity 4.2.2 Conflict-Resolution Strategies 4.2.2.1 Lexicographic-Sort Strategy 4.2.2.2 Means-Ends-Analysis Strategy 4.3 Act Part II Writing VAX OPS5 Programs 5 Using VAX OPS5 Statements, Actions, and Functions 5.1 Initializing a Program 5.2 Modifying Working Memory 5.2.1 Creating Working-Memory Elements 5.2.2 Deleting Elements from Working Memory 5.2.3 Changing the Atoms in Working-Memory Elements 5.3 Copying Atoms from a Working-Memory Element 5.4 Saving and Restoring the State of Working Memory and the Conflict Set 5.5 Stopping Program Execution 5.6 Binding Variables 5.6.1 Binding a Variable to an Atom 5.6.2 Binding a Variable to an Attribute's Field 5.6.3 Binding an Element Variable to a Working-Memory Element 5.7 Performing Arithmetic Computations 5.8 Performing Input and Output Operations 5.8.1 Opening Files 5.8.2 Setting the Default Input Source and Output Destination 5.8.3 Closing Files 5.8.4 Reading Input 5.8.5 Writing Output 5.8.5.1 Producing Output on a New Line 5.8.5.2 Specifying the Column in Which to Start Writing Output 5.8.5.3 Producing Right-Justified Output 5.9 Controlling Loops 5.10 Using System-Generated Atoms 5.11 Adding Productions to an Executing Program 5.12 Sample VAX OPS5 Program 6 Using Routines Written in Other VAX Languages 6.1 Calling a VAX OPS5 Program as a Subroutine 6.2 Result Element 6.3 Overview of External Routines 6.3.1 External Functions 6.3.2 External Subroutines 6.4 Declaring External Routines 6.5 Calling External Routines 6.5.1 Calling Functions 6.5.2 Calling Subroutines 6.6 Creating the External Routine 6.6.1 Declaring Arguments for Functions 6.6.2 Declaring VAX OPS5 Support Routines 6.6.3 Using VAX OPS5 Support Routines 6.6.4 Creating Working-Memory Elements 6.6.5 Retrieving Arguments from the Result Element 6.6.6 Converting Data Types 6.6.6.1 Symbolic Atoms 6.6.6.2 Integer Atoms 6.6.6.3 Floating-Point Atoms 6.6.7 Comparing Atoms for Equality 6.6.8 Placing Atoms in the Result Element 6.6.9 Stopping Program Execution 6.6.10 Displaying Warning Messages 6.6.11 Using Files Opened by the VAX OPS5 Program 6.6.12 Reading Input 6.6.13 Writing Output 6.6.14 Generating Atoms 6.7 Examples of Calling External Routines 6.7.1 A VAX OPS5 Program That Calls an External Function 6.7.1.1 VAX OPS5 Program-STATISTICS.OPS 6.7.1.2 VAX BASIC External Function-FNSQRT.BAS 6.7.1.3 VAX FORTRAN External Function-FNSQRT.FOR 6.7.1.4 VAX PASCAL External Function-FNSQRT.PAS 6.7.2 A VAX OPS5 Program That Calls an External Subroutine 6.7.2.1 OPS5 Program-STOCK.OPS 6.7.2.2 VAX BASIC External Subroutine-STOCKSUB.BAS 6.7.3 A VAX OPS5 Program That Uses a VAX DBMS Data Base 6.7.3.1 VAX OPS5 Program-DBMS.OPS 6.7.3.2 VAX BASIC External Function-DBMS.BAS 6.7.3.3 VAX OPS5 Include File-OPS.INC 6.7.3.4 BLISS-32 File-OPSATOM.B32 6.7.3.5 VAX Common Data Dictionary Data Description Language File-DBMS.DDL 6.7.3.6 Include File-DBMS.INC 6.8 Handling an Asynchronous System Trap (AST) 6.8.1 Synchronizing Completion Routines Part III VAX OPS5 Operator, Declaration, Statement, Action, Function, Command, and Support-Routine Descriptions 7 Operators ^ = <> > >= < <= <=> { } << >> // \\ 8 Declarations EXTERNAL LITERAL LITERALIZE VECTOR-ATTRIBUTE 9 Statements CATCH PRODUCTION STARTUP 10 Actions ADDSTATE AFTER BIND BUILD CALL CBIND CLOSEFILE DEFAULT HALT MAKE MODIFY OPENFILE REMOVE RESTORESTATE SAVESTATE WRITE 11 Functions ACCEPT ACCEPTLINE COMPUTE CRLF GENATOM LITVAL RJUST SUBSTR TABTO 12 Command Interpreter Commands @ ADDSTATE AFTER BACK BUILD CALL CLOSEFILE CS DEFAULT DISABLE ENABLE EXCISE EXIT MAKE MATCHES MODIFY NEXT OPENFILE PBREAK PPWM REMOVE REPORT RESTART RESTORESTATE RUN SAVESTATE SHOW SPACE STRATEGY WATCH WBREAK WM 13 Support Routines OPS$ACCEPT OPS$ACCEPTLINE OPS$ASSERT OPS$ATOM OPS$CANCEL_RUN OPS$CLEAR OPS$COMPLETION OPS$CRLF OPS$CVAF OPS$CVAN OPS$CVFA OPS$CVNA OPS$EQL OPS$FLOATING OPS$GENATOM OPS$HALT OPS$IFILE OPS$INITIALIZE OPS$INTEGER OPS$INTERN OPS$LITBIND OPS$LITVAL OPS$OFILE OPS$PARAMETER OPS$PARAMETERCOUNT OPS$PNAME OPS$RESET OPS$RUN OPS$STARTUP OPS$SYMBOL OPS$TAB OPS$VALUE OPS$WARNING OPS$WRITE A %INCLUDE Compiler Directive A.1 Format A.2 Argument A.3 Example FIGURES 2-1 Internal Representation of a Working-Memory Element 2-2 Time Tag Representation 2-3 Storing the Class Name 2-4 Storing the Values of Scalar Attributes 2-5 Shared Attributes 2-6 Storing the Value of a Vector Attribute 3-1 Production Format 3-2 Matching Atoms in a Working-Memory Element with Component Values 4-1 Recognize-Act Cycle 6-1 Arguments Stored in the Result Element TABLES 5-1 VAX OPS5 Statements, Actions, and Functions 6-1 Include Files 7-1 Summary of Operators 8-1 Summary of Declarations 9-1 Summary of Statements 10-1 Summary of Actions 10-2 DEFAULT Action Keywords 11-1 Summary of Functions 12-1 Summary of Commands 12-2 DEFAULT Command Keywords 12-3 DISABLE Command Keywords 12-4 ENABLE Command Keywords 12-5 Trace Levels 13-1 Summary of Support Routines