Skip to content

briangu/OPS5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

;;; ****************************************************************
;;; VPS2 -- Interpreter for OPS5 ***********************************
;;; ****************************************************************
;;;
;;; Ops5 is a programming language for production systems.
;;;
;;; This Common Lisp version of OPS5 is in the public domain.  It is based
;;; in part on based on a Franz Lisp implementation done by Charles L. Forgy
;;; at Carnegie-Mellon University, which was placed in the public domain by
;;; the author in accordance with CMU policies.  Ported to Common Lisp by 
;;; George Wood and Jim Kowalski. CMU Common Lisp modifications by
;;; Dario Guise, Skef Wholey, Michael Parzen, and Dan Kuokka. 
;;; Modified to work in CLtL1, CLtL2 and X3J13 compatible lisps by 
;;; Mark Kantrowitz on 14-OCT-92. The auto.ops and reactor.ops demo files
;;; were provided by Michael Mauldin.  In year 2013, ported to modern Common
;;; Lisp implementations and added support for quicklisp by Xiaofeng Yang.
;;; 
;;; This code is made available is, and without warranty of any kind by the
;;; authors or by Carnegie-Mellon University.
;;;
;;; This code has been tested in Clozure CL v1.9, SBCL v1.0.57, CLISP v2.49,
;;; ECL v12.12.1, ABCL v1.1.1, Lispworks v6.1, MKCL v1.1.3, and Allegro CL v8.2.
;;;
;;; Source code:
;;;    ops.lisp, ops-globals.lisp, ops-backup.lisp, ops-compile.lisp, 
;;;    ops-init.lisp, ops-io.lisp, ops-main.lisp, ops-match.lisp, 
;;;    ops-rhs.lisp, ops-util.lisp
;;;
;;; Demo Files: 
;;;    ops-demo-mab.lisp and ops-demo-ttt.lisp
;;;    auto.ops and reactor.ops
;;;
;;; Documentation for OPS may be found in the OPS5 User's Manual, July 1981,
;;; by Forgy, CMU CSD.
;;;
;;; This version of OPS5 was obtained by anonymous ftp from 
;;;    ftp.cs.cmu.edu:/user/ai/areas/expert/systems/ops5/ops5_cl.tgz

;;; ********************************
;;; Usage **************************
;;; ********************************
;;; 
;;; To use:
;;;    1. Clone this project and put into the local-projects directory of quicklisp (e.g. "~/quicklisp/local-projects").
;;;    2. Use quicklisp to load this project:
;;;          (ql:quickload "ops5")
;;; Now you can load your OPS5 code or start typing in productions.
;;; If you want to load in a new set of productions, call (reset-ops)
;;; between rule sets. For a nice REP Loop, run (ops).
;;;
;;; Demos:
;;;
;;; There are two demos
;;;    interactive tic-tac-toe 
;;;    the monkey and banana problem
;;; To run the former, just load it and call (run). For the latter,
;;; load it, enter (make start 1) and then call (run).

;;; ********************************
;;; Known Bugs *********************
;;; ********************************
;;;
;;; Loading new rule-sets clobbers the state of the interpreter. To use
;;; a new rule-set, exit lisp and restart OPS.
;;;
;;; Although this implementation has been put into its own package, only
;;; a few interfaces have been exported. You must run in the OPS package.

;;; ********************************
;;; Sample Run *********************
;;; ********************************
CL-USER> (ql:quickload "ops5")
To load "ops5":
  Load 1 ASDF system:
    ops5
; Loading "ops5"
.........................
("ops5")
CL-USER> (in-package "OPS")
#<Package "OPS">
OPS> (load (merge-pathnames "../demo/auto.ops" *ops-code-directory*))
Resetting OPS5 interpreter: 
             
   deleting productions, working memory, etc.
Common Lisp OPS5 interpreter, version 19-OCT-92.
******************
#P"/home/nakrakiiya/quicklisp/local-projects/ops5/demo/auto.ops"
OPS> (make ready)
NIL
OPS> (run)


Automobile Diagnosis 


Is this true: key is off [no]  y

Concluding you must turn the key to start the car 
*End of diagnosis* 


Is this true: key is off [no]  

Is this true: engine is turning [no]  yes

Concluding problem is in fuel or ignition system 

Is this true: headlights are dim or dead [no]  q

end -- explicit halt
 18 productions (108 // 200 nodes)
 19 firings (42 rhs actions)
  5 mean working memory size (8 maximum)
  4 mean conflict set size (7 maximum)
 10 mean token memory size (17 maximum)
NIL
OPS> 
;;; *EOF*

About

OPS5 Production System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published