anchor.diff: +;; -*- fill-column: 80; -*-
  +
   ;;
   ;; Copyright (c) 2017, Peter Seibel. All rights reserved.
   ;;
  
positive.code: ;;; Public API ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
  (defmacro defparser (name (&rest args) &body body)
    "Define a parser named NAME. The argument list can be used to
  specify parameters the parser function will accept in addition to text
  and position arguments. Any arguments after &state will be bound at
  the beginning of the function and can be used by productions within
  the grammar to maintain state which will backtrack when the parser
  does."
    `(progn
       (eval-when (:compile-toplevel :load-toplevel :execute)
         (setf (get ',name 'parser-function) t))
  
negative.code:   (mapcar #'(lambda (x) `(,(gensym (symbol-name x)) ,x)) names))
  
  (defun restore-state (bindings)
    "Given bindings produced by SAVE-STATE-BINDINGS, generate a list of SETF forms
  that will restore the saved values."
    (mapcar #'(lambda (x) `(setf ,@(reverse x))) bindings))
  
  (defun grammar-p (name names)
    "If a symbol either names a production within the grammar or an external
  parser function."
    (or (member name names) (get name 'parser-function)))
  
  (defun compile-and (body txt pos names result state)
    "Compile the forms in an AND so that the AND matches if each of the elements
  matches in sequence."
    (unless (null body)
      (let ((body (rewrite-returns body)))
        (with-gensyms (p)
  