anchor.diff:                :accept (alexandria:ensure-list accept))))
   
   
  +(defun make-fa-renumber (edges start accept)
  +  (let ((state-hash (make-hash-table :test #'equal))
  +        (token-hash (make-hash-table :test #'equal))
  +        (state-counter -1)
  +        (token-counter 0)
  +        nedges)
  +    (setf (gethash :epsilon token-hash) 0)
  +    ;; start/accept states
  +    (map nil (lambda (x)
  +               (setf (gethash x state-hash)
  +                     (incf state-counter)))
  +         (alexandria:ensure-list start))
  +    (map nil (lambda (x)
  +               (setf (gethash x state-hash)
  +                     (incf state-counter)))
  +         (alexandria:ensure-list accept))
  +    ;; build hashes
  +    (dolist (e edges)
  +      (destructuring-bind (q0 z q1) e
  +        (unless (gethash q0 state-hash)
  +          (setf (gethash q0 state-hash) (incf state-counter)))
  +        (unless (gethash q1 state-hash)
  +          (setf (gethash q1 state-hash) (incf state-counter)))
  +        (unless (gethash z token-hash)
  +          (setf (gethash z token-hash) (incf token-counter)))
  +        (push (list (gethash q0 state-hash)
  +                    (gethash z token-hash)
  +                    (gethash q1 state-hash))
  +              nedges)))
  +    ;; map hashes to build new edges and mapping arrays
  +    (let ((state-array (make-array (1+ state-counter)))   ; i -> q
  +          (token-array (make-array (1+ token-counter))))  ; i -> z
  +      (maphash (lambda (n d) (setf (aref state-array d) n))
  +               state-hash)
  +      (maphash (lambda (n d) (setf (aref token-array d) n))
  +               token-hash)
  +      (%make-fa :states state-array
  +                :tokens token-array
  +                :edges nedges
  +                :start (mapcar (lambda (x) (gethash x state-hash))
  +                               (alexandria:ensure-list start))
  +                :accept (mapcar (lambda (x) (gethash x state-hash))
  +                               (alexandria:ensure-list accept))))))
  +
  +
  +(defun make-fa (edges start accept &key (renumber-symbols t))
  +  (if renumber-symbols
  +      (make-fa-renumber edges start accept)
  +      (make-fa-simple edges start accept)))
  +
  +(defun fa-mover (fa)
  +  (let ((move (make-array (list (length (fa-states fa)) (length (fa-tokens fa)))
  +                          :initial-element nil)))
  +    (loop for (q0 z q1) in (fa-edges fa)
  +       do (push q1 (aref move q0 z)))
  +    (lambda (i-state i-token) (aref move i-state i-token))))
  +
  +
   (defun fa-dot (fa &optional output )
     "Graphviz output of dfa.
   d: list of transitions '((state-0 token state-1)...)
   final: list of accept states
   start: start state
   output: output file, type determined by suffix (png,pdf,eps)"
  -  (labels ((token-label (name)
  -             (if (eq :epsilon name)
  -                 "&epsilon;" ; print epsilons in greek
  -                 name))
  +  (labels ((token-label (i)
  +             (let ((name (fa-token-name fa i)))
  +               (if (eq :epsilon name)
  +                   "&epsilon;" ; print epsilons in greek
  +                   name)))
  +           (state-label (i)
  +             (let ((name (fa-state-name fa i)))
  +               name))
              (helper (s)
                (format s "~&digraph {~%")
                (when (fa-start fa)
                  (format s "~&  start[shape=none];")
  -               (format s "~{~&  start -> ~A;~}" (alexandria:ensure-list (fa-start fa))))
  -             (format s "~{~&  ~A [ shape=doublecircle ];~}" (fa-accept fa))
  +               (format s "~{~&  start -> ~A;~}"
  +                       (map 'list #'state-label (alexandria:ensure-list (fa-start fa)))))
  +             (format s "~{~&  ~A [ shape=doublecircle ];~}"
  +                     (map 'list #'state-label (alexandria:ensure-list (fa-accept fa))))
                (map 'nil (lambda (x)
                            (format s "~&  ~A -> ~A [label=\"~A\"];~%"
  -                                 (first x) (third x) (token-label (second x))))
  +                                 (state-label (first x))
  +                                 (state-label (third x) )
  +                                 (token-label (second x))))
                     (fa-edges fa))
                (format s "~&}~%"))
              (dot (ext)
  
positive.code:   accept
    reject)
  
  (defun make-fa (edges start accept)
    (let (states tokens)
      (map nil (lambda (x)
                 (destructuring-bind (q0 z q1) x
  
negative.code:     h))
  
  
  
  ;;; See Aho, 2nd p. 153-154. These closure computations are a
  ;;; functional variation thereof.
  