Permalink
Browse files

Merge pull request #1 from nakrakiiya/master

ported to more implementations and added support for quicklisp
  • Loading branch information...
2 parents 5092d8a + 886997f commit c284ef0b449eb9ee4953503e71ef32cc00c1fb9d @briangu committed Mar 28, 2013
View
@@ -0,0 +1,28 @@
+# see http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
+# default
+* -text
+
+# binaries
+*.png binary
+*.jpg binary
+*.exe binary
+*.dll binary
+*.exe binary
+*.7z binary
+*.gz binary
+*.zip binary
+
+
+
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
View
@@ -0,0 +1,3 @@
+.svn/
+*.el~
+.project
View
@@ -12,13 +12,14 @@
;;; 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.
+;;; 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 Allegro v4.1, Lucid v4.1, IBCL, and
-;;; CMU CL.
+;;; 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,
@@ -38,22 +39,11 @@
;;; ********************************
;;; Usage **************************
;;; ********************************
-;;;
-;;; Before loading:
-;;; Change the global variable *ops-code-directory* to refer to the
-;;; directory where the OPS5 sources are kept. You may also need to
-;;; change the definition of OPS-PATHNAME depending on your lisp.
-;;;
;;;
;;; To use:
-;;; 1. From Lisp, load the file "ops":
-;;; (load "ops")
-;;; 2. Go into the OPS package:
-;;; (in-package "OPS")
-;;; 3. To compile the OPS sources, use compile-ops:
-;;; (compile-ops)
-;;; 4. To load the OPS sources, use load-ops:
-;;; (load-ops)
+;;; 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).
@@ -79,29 +69,25 @@
;;; ********************************
;;; Sample Run *********************
;;; ********************************
-> (load "ops")
-;;; Loading binary file "ops.hbin"
-#P"/afs/andrew.cmu.edu/scs/cs/15-381/ops5v1/ops.hbin"
-> (in-package "OPS")
-#<Package "OPS" 40242A7E>
-> (load-ops)
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-globals.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-util.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-backup.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-compile.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-main.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-match.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-io.hbin"
-;;; Loading binary file "/afs/andrew.cmu.edu/scs/cs/15-381/ops5/ops-rhs.hbin"
-NIL
-> (load "../ops/auto.ops")
-;;; Loading source file "../ops/auto.ops"
-;;; Warning: File "../ops/auto.ops" does not begin with IN-PACKAGE. Loading into package "OPS"
+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"/afs/andrew.cmu.edu/scs/cs/15-381/ops/auto.ops"
-> (make ready)
+#P"/home/nakrakiiya/quicklisp/local-projects/ops5/demo/auto.ops"
+OPS> (make ready)
NIL
-> (run)
+OPS> (run)
Automobile Diagnosis
@@ -128,5 +114,5 @@ end -- explicit halt
4 mean conflict set size (7 maximum)
10 mean token memory size (17 maximum)
NIL
->
+OPS>
;;; *EOF*
View
@@ -0,0 +1,51 @@
+;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
+
+(in-package :asdf)
+
+;; #-(or openmcl mcl sbcl cmu scl clisp lispworks ecl allegro cormanlisp abcl)
+;; (error "Sorry, this Lisp is not yet supported. Patches welcome!")
+
+(defsystem :ops5
+ :version "19-OCT-92"
+ :description "VPS2 -- Interpreter for OPS5
+
+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.
+
+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
+"
+ :author ""
+ :maintainer ""
+ :licence "public domain"
+ :depends-on ()
+ :components
+ ((:module "src"
+ :serial t
+ :components
+ (
+ (:file "ops") ; so that shadowing takes place...
+ (:file "ops-globals")
+ (:file "ops-util") ; macros
+ (:file "ops-compile")
+ (:file "ops-rhs") ; defines macros used in ops-init
+ (:file "ops-main") ; macros
+ (:file "ops-match")
+ (:file "ops-backup")
+ (:file "ops-io")
+ (:file "ops-init")))))
+
@@ -21,12 +21,12 @@
;;; Internal Global Variables
-(defvar *refracts*)
-(defvar *record*)
-(defvar *record-array*)
-(defvar *recording*)
-(defvar *max-record-index*)
-(defvar *record-index*)
+(defvar *refracts* nil)
+(defvar *record* nil)
+(defvar *record-array* nil)
+(defvar *recording* nil)
+(defvar *max-record-index* nil)
+(defvar *record-index* nil)
@@ -23,27 +23,27 @@
;;; External global variables
-(defvar *real-cnt*)
-(defvar *virtual-cnt*)
-(defvar *last-node*)
-(defvar *first-node*)
-(defvar *pcount*)
+(defvar *real-cnt* nil)
+(defvar *virtual-cnt* nil)
+(defvar *last-node* nil)
+(defvar *first-node* nil)
+(defvar *pcount* nil)
;;; Internal global variables
-(defvar *matrix*)
-(defvar *curcond*)
-(defvar *feature-count*)
-(defvar *ce-count*)
-(defvar *vars*)
-(defvar *ce-vars*)
-(defvar *rhs-bound-vars*)
-(defvar *rhs-bound-ce-vars*)
-(defvar *last-branch*)
-(defvar *subnum*)
-(defvar *cur-vars*)
-(defvar *action-type*)
+(defvar *matrix* nil)
+(defvar *curcond* nil)
+(defvar *feature-count* nil)
+(defvar *ce-count* nil)
+(defvar *vars* nil)
+(defvar *ce-vars* nil)
+(defvar *rhs-bound-vars* nil)
+(defvar *rhs-bound-ce-vars* nil)
+(defvar *last-branch* nil)
+(defvar *subnum* nil)
+(defvar *cur-vars* nil)
+(defvar *action-type* nil)
@@ -18,11 +18,11 @@
;;; Global variables also used by OPS modules.
-(defvar *halt-flag*)
-(defvar *cycle-count*)
-(defvar *p-name*)
-(defvar *ptrace*)
-(defvar *wtrace*)
+(defvar *halt-flag* nil)
+(defvar *cycle-count* nil)
+(defvar *p-name* nil)
+(defvar *ptrace* nil)
+(defvar *wtrace* nil)
;;; Hash Tables.
@@ -44,7 +44,7 @@
"Clears the state of OPS to allow a new rule set to be loaded."
;; Tell the user what we're doing.
- (format t "~&Resetting OPS5 interpreter: ~
+ (format t "~&Resetting OPS5 interpreter:
~& deleting productions, working memory, etc.")
(remove *)
(ops-init)
@@ -22,11 +22,11 @@
;;; Internal global variables.
-(defvar *write-file*)
-(defvar *trace-file*)
-(defvar *accept-file*)
-(defvar *ppline*)
-(defvar *filters*)
+(defvar *write-file* nil)
+(defvar *trace-file* nil)
+(defvar *accept-file* nil)
+(defvar *ppline* nil)
+(defvar *filters* nil)
@@ -24,21 +24,21 @@
;;; Global variables used in this module only.
-(defvar *limit-token*)
-(defvar *total-wm*)
-(defvar *max-token*)
-(defvar *total-token*)
-(defvar *brkpts*)
-(defvar *phase*)
-(defvar *break-flag*)
-(defvar *remaining-cycles*)
-(defvar *conflict-set*)
-(defvar *max-cs*)
-(defvar *total-cs*)
-(defvar *limit-cs*)
-(defvar *strategy*)
-(defvar *class-list*)
-(defvar *buckets*)
+(defvar *limit-token* nil)
+(defvar *total-wm* nil)
+(defvar *max-token* nil)
+(defvar *total-token* nil)
+(defvar *brkpts* nil)
+(defvar *phase* nil)
+(defvar *break-flag* nil)
+(defvar *remaining-cycles* nil)
+(defvar *conflict-set* nil)
+(defvar *max-cs* nil)
+(defvar *total-cs* nil)
+(defvar *limit-cs* nil)
+(defvar *strategy* nil)
+(defvar *class-list* nil)
+(defvar *buckets* nil)
@@ -23,17 +23,17 @@
;;; External global variables
-(defvar *current-token*)
+(defvar *current-token* nil)
;;; Internal global variables
-(defvar *alpha-data-part*)
-(defvar *alpha-flag-part*)
-(defvar *flag-part*)
-(defvar *data-part*)
-(defvar *sendtocall*)
-(defvar *side*)
+(defvar *alpha-data-part* nil)
+(defvar *alpha-flag-part* nil)
+(defvar *flag-part* nil)
+(defvar *data-part* nil)
+(defvar *sendtocall* nil)
+(defvar *side* nil)
(proclaim '(special *c1* *c2* *c3* *c4* *c5* *c6* *c7* *c8* *c9*
*c10* *c11* *c12* *c13* *c14* *c15* *c16* *c17* *c18* *c19*
*c20* *c21* *c22* *c23* *c24* *c25* *c26* *c27* *c28* *c29*
Oops, something went wrong.

0 comments on commit c284ef0

Please sign in to comment.