anchor.diff:          nil)))
   
   ;; Construction macros
  +
  +;; In general, these should handle both normal functions ("rules") and other macros.
  +;; In practice, only a couple do this properly.
  +
   (defmacro grammar-string (str)
     `(when (starts-with string ,str :start start)
       (values (+ start ,(length str)) ,str)))
   
  +(defmacro grammar-optional (x)
  +  `(multiple-value-bind (end value) (,x string :start start)
  +    (if end
  +        (values end value)
  +        start)))
  +
  +(defmacro grammar-call (x)
  +  (cond ((null x) (error "Cannot call nil function."))
  +        ((symbolp x) `(,x string :start start))
  +        ((listp x) x)
  +        (t (error "Cannot call ~S" x))))
  +
  +
   (defmacro grammar-and (first &rest rest)
     (if (null rest)
  -      first
  -      `(multiple-value-bind (end value) ,first
  +      `(grammar-call ,first)
  +      `(multiple-value-bind (end value) (grammar-call ,first)
           (when end
             (let ((start end))
             (multiple-value-bind (e v) (grammar-and ,@rest)
  
positive.code: 
  ;; return a list of the children
  ;; return the end of the last child
  (defun kleene* (f string &key (start 0))
    (multiple-value-bind (end value) (funcall f string :start start)
      (if end
          (multiple-value-bind (e v) (kleene* f string :start end)
            (values e (cons value v)))
          (values start nil))))
  
  (defun kleene+ (f string &key (start 0))
    "<rule>+ == <rule> <rule>*"
  
negative.code:             (values end value)
              (grammar-or ,@rest)))))
  
  
  (defmacro grammar-n* (n x)
    (cond
      ((null x) nil)
      ((symbolp x) `(match-n ,n ',x string :start start))
      ((listp x)
       (let ((f (gensym)))
         `(let ((,f (lambda (string &key (start 0))
                     ,x)))
           (match-n ,n ,f string :start start))))
      (t (error (format nil "grammar-n* cannot process ~S" x)))))
  
  (defmacro grammar-* (x)
    (cond
  