anchor.diff:        `(,name ,@(mapcar #'comp args) ,txt ,s ,p))))
   
   (defun rewrite-form (form names)
  +  "Rewrite bare symbols naming parser productions or parser functions
  +into cannonical list from."
     (cond
  -    ((parser-function-symbol-invocation-p form names) (list form))
  +    ((and (symbolp form) (grammar-p form names)) (list form))
       (t form)))
  -
  -(defun parser-function-symbol-invocation-p (form names)
  -  (and (symbolp form) (grammar-p form names)))
   
   (defun parser-function-invocation-p (form names)
     (and (consp form) (symbolp (car form)) (grammar-p (car form) names)))
   
   (defun binding-form-p (form)
     (and (consp form) (eql (car form) '->)))
  -
  -
  -
  -(defun uniq-names (form)
  -  (cond
  -    ((consp form)
  -     (sort (delete-duplicates
  -            (let ((s (car form))
  -                  (rest (mapcan #'uniq-names (remove-if (complement #'consp) (cdr form)))))
  -              (if (and (symbolp s) (not (keywordp s)))
  -                  (cons (car s) rest)
  -                  rest)))
  -           #'string<))
  -    (t nil)))
  -
  -
  -(defun call-parser (p text state position)
  -  (funcall p text state position))
   
   
   (defmacro defparserfun (name (&rest args) &body body)
  
positive.code: 
  |#
  
  #+(or)(defmacro defparser (name (&rest args) &body body)
    ;; Should check for duplicate names and error.
    `(defun ,name (,@args)
       (let (,@(extract-bound-names body))
         ;; Mark starting point.
  
         ;; Evaluate each form but the last as a parser. If it matches,
         ;; evaluate next form with new starting point.
  
         ;; For binding forms (-> ...), assign the result of the parser to
         ;; the appropriate name.
  
         ;; Evaluate the last form
         ,last-form)))
  
  #+(or)(defun foo (form)
    (destructuring-bind (defparser name (&rest args) &rest body) form
      (declare (ignore defparser name args))
      (let* ((symbols (uniq-names body))
             (names (defined-names body)))
        (format t "~{~&~(~a~)~}" (sort (remove-if #'fboundp (set-difference symbols names)) #'string<)))))
  
  
  (defun compile-parser (p)
    (destructuring-bind (defparser name (&rest args) &rest body) p
      (declare (ignore defparser))
      (%compile-parser name args body)))
  
  (defun %compile-parser (name args body)
    (let* ((productions (mapcar #'production body))
           (names (mapcar #'(lambda (x) (getf x :name)) productions)))
      `(defun ,name (text position ,@args)
         (flet (,@(loop for p in productions collect
                      (destructuring-bind (&key name args body) p
                        `(,name (,@args text state position)
                                ,(compile-progn body 'text 'state 'position names)))))
           (,(first names)
             text
             (list ,@(mapcar #'(lambda (x) `(cons ',x ,x)) args))
             position)))))
  
  (defun production (p)
    "A parser is made up of productions."
  
negative.code: (defparserfun try (p text state position)
    "Attempt to parse using p, moving forward if it succeeds. However if
  it fails, it does not consume any input."
    (multiple-value-bind (ok r ns np) (funcall p text state position)
      (if ok
          (values t r ns np)
          (values nil nil state position))))
  