Commits

Anonymous committed e7f5748

Removed unnecessary globals

  • Participants
  • Parent commits 03bc1e0
  • Branches parsing

Comments (0)

Files changed (1)

File grammar.lisp

 ;; ---------------------------------------------------------------------------------------------------------------------
 ;; Grammar representations
 
-(defvar *grammar* nil "Current grammar under inspection")
 (defvar *new-rules* nil "New rules under construction")
-(defvar *rule-name* "" "Name of current rule--useful for constructing derived rule names")
 
 (defun compoundtermp (term)
   (and (listp term) (member (car term) '(+ ? * ^))))
 	  (append *new-rules* (list rule)))
     rule-name))
 
-(defun for-each-rule (*grammar* rule-func)
-  (loop for rule in *grammar*
+(defun for-each-rule (grammar rule-func)
+  (loop for rule in grammar
      collect (or (funcall rule-func rule) rule)))
 
-(defun for-each-rhs (*grammar* rhs-func)
-  (for-each-rule *grammar*
+(defun for-each-rhs (grammar rhs-func)
+  (for-each-rule grammar
 		 #'(lambda (rule)
 		     (destructuring-bind (rule-name &rest rhss) rule
 		       (cons rule-name (loop for rhs in rhss
     (if (listp new-rhs) new-rhs (list new-rhs)))) ;; make sure it's always a list
 
 (defun transform-extended-grammar-to-fundamental (grammar) 
-  (let ((*grammar* grammar)
-	(*new-rules* nil))
-    (append (for-each-rhs *grammar*
+  (let ((*new-rules* nil))
+    (append (for-each-rhs grammar
 			  #'(lambda (rhs)		      
 			      (transform-rhs (if (listp rhs) rhs (list rhs)))))
 	    *new-rules*)))