Commits

Anonymous committed c6b6236

Named gensyms
Keywords:

Make GENSYM calls with explicit argument to make macroexpansion readable.

  • Participants
  • Parent commits 7ca352f

Comments (0)

Files changed (3)

File generator/fg-dump.lisp

 #|
- Copyright (c) 2006 Ivan Boldyrev
+ Copyright (c) 2006-2008 Ivan Boldyrev
                                              
  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
                            :initial-element nil))
         (*counter* -1)
         (*action-forms* (make-hash-table :test 'equal))
-        (actions-var (gensym))
-        (array-var (gensym))
-        (result-var (gensym))
-        (i-var (gensym))
-        (j-var (gensym))
-        (redux-var (gensym)))
+        (actions-var (gensym "ACTIONS"))
+        (array-var (gensym "ARRAY"))
+        (result-var (gensym "RESULT"))
+        (i-var (gensym "I"))
+        (j-var (gensym "J"))
+        (redux-var (gensym "REDUX")))
     (dotimes (state (array-dimension action-table 0))
       (dotimes (terminal (array-dimension action-table 1))
         (let ((actions (aref action-table state terminal)))

File generator/fg-grammar-ll.lisp

 (defun expand-form-ll (form rule pos)
   (declare (ignore rule pos))
   (let ((generated-rules '())
-        (generated-sym (gensym)))
+        (generated-sym (gensym "SYM")))
     (ecase (first form)
       ((:or or)
        (dolist (subform (rest form))
                 `(,generated-sym nil #'list* ,@(rest form) ,generated-sym))
                nil))
       ((:+ +)
-       (let ((generated-sym2 (gensym)))
+       (let ((generated-sym2 (gensym "SYM2")))
         (values generated-sym2
                 (list
                  `(,generated-sym2 nil
                      `(,generated-sym nil #'identity ,(second form))))
                  nil))
       ((:list list)
-       (let ((generated-sym2 (gensym)))
+       (let ((generated-sym2 (gensym "SYM3")))
         (destructuring-bind (item delim) (rest form)
           (values generated-sym2
                   (list

File generator/fg-grammar-lr.lisp

 #|
- Copyright (c) 2006-2007 Ivan Boldyrev
+ Copyright (c) 2006-2008 Ivan Boldyrev
                                              
  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
 (defun expand-complex-form-lr (form rule pos)
   (declare (ignore rule pos))
   (let ((generated-rules ())
-        (generated-sym1 (gensym)))
+        (generated-sym1 (gensym "SYM1")))
     (ecase (first form)
       ((:* *)
        (push `(,generated-sym1 nil
 ;;; Inline complex form (like :or).  Returned values are same as of
 ;;; expand-complex-form-lr.
 (defun expand-inlinable-form-lr (form rule pos)
-  (let ((generated-sym1 (gensym)))
+  (let ((generated-sym1 (gensym "SYM1")))
     (ecase (first form)
       ((:or or)
        (let ((short-subforms ()) ; One-element forms are just inlined.
         (generated-rules)
         (new-rhs '()))
     (loop :for form :in (cdddr rule)
-       :for var := (gensym) :do ; Var is used as lambda arg and as new
-                                ; nterminal
+       :for var := (gensym "NTERM") :do ; Var is used as lambda arg and as new
+                                        ; nterminal
        (push var new-vars)
        :if (attribute-form-p form) :do
        (push var ignore-vars)
   "Apply TRANSFORMS to ACTION"
   ;; Create new action
   (loop :for tr :in transforms
-     :for arg := (gensym)
+     :for arg := (gensym "ARG")
      :collect arg :into new-arglist
      :collect (if tr
                   `(,tr ,arg)