anchor.diff:      ((:= :*= :/= :%= :+= :-=
   	 :<<= :>>= :&= :^= :\|=) 11)))
   
  -(defun operator-tighter (l r)
  -  (< (operator-priority l)
  -     (operator-priority r)))
  -
  -(defun unwind-op-stack (op-stack left-stack right &optional until)
  -  (loop 
  -     for (operator . newop-stack) =  op-stack then newop-stack
  -     for (left . newleft-stack) = left-stack then newleft-stack
  -     when (and until
  -	       (not
  -		(operator-tighter operator until)))
  -     return (values
  -	     right
  -	     (cons operator newop-stack)
  -	     (cons left newleft-stack))
  -     do  (setf right (list operator left right))
  -     while newop-stack
  -     finally (return (values right nil nil))))
  -
  -(defun continue-binop (op-stack left-stack)
  -  (tracer "C-B"
  -	  (=let*
  -	      ((right (unary-and-primary-expr))
  -	       (op (maybe
  -		    (arithmetic-binop))))
  -	    (multiple-value-bind
  -		  (newleft newop-stack newleft-stack)
  -		(unwind-op-stack op-stack left-stack right op)
  -	      (if op
  -		  (continue-binop
  -		   (cons op newop-stack)
  -		   (cons newleft newleft-stack))
  -		  (result newleft))))))
  -
  -(defun arithmetic-expr ()
  -  (=let*
  -      ((left (unary-and-primary-expr))
  -       (op
  -	(tracer "op"
  -		(maybe
  -		 (arithmetic-binop)))))
  -    (if (not op)
  -	(result left)
  -	(continue-binop (list op) (list left)))))
  -
  -(defun literal-number ()
  -  (=let*
  -      ((base-marker
  -	(maybe
  -	 (string-of
  -	  (=or
  -	   (=string "0x")
  -	   (=prog1
  -	    (=string "0")
  -	    (=not (=not
  -		   (=satisfies
  -		    (lambda (x) (digit-char-p x))))))))))
  -       (base
  -	(cond
  -	  ((null base-marker) (result 10))
  -	  ((string= base-marker "0") (result 8))
  -	  (t (result 16))))
  -       (number
  -	(string-of
  -	 (one-or-more
  -	  (=satisfies
  -	   (lambda (x) (digit-char-p x  base)))))))
  -    (result
  -     (list :number
  -	   (parse-integer number :radix base)))))
  -
  -(defun primary-expr ()
  -  (=or
  -   (=let*
  -       ((_ (=char #\())
  -	(expr (arithmetic-expr))
  -	(_ (=char #\))))
  -     (result expr))
  -   (=let*
  -       ((name (string-of (posix-name))))
  -     (result (list :var name)))
  -   (literal-number)))
  +(defun treeify-expr (list)
  +  (if
  +   (null (cdr list))
  +   (car list)
  +   (loop for priority from 11 downto 1
  +      for op = (position priority list :key (lambda (x) (and (keywordp x) (operator-priority x))))
  +      when op
  +      return (list (nth op list)
  +		   (treeify-expr (subseq list 0 op))
  +		   (treeify-expr (subseq list (1+ op)))))))
  +
  +(defrule arithmetic-expr
  +    (and
  +     unary-and-primary-expr
  +     (*
  +      (and
  +       arithmetic-binop
  +       unary-and-primary-expr)))
  +  (:destructure
  +   (start pairs)
  +   (let
  +       ((list
  +	 (cons start (reduce #'append pairs))))
  +     (treeify-expr list))))
  +  
  +(defun hex-digit-p (x)
  +  (digit-char-p x 16))
  +
  +(defun oct-digit-p (x)
  +  (digit-char-p x 8))
  +
  +(defrule literal-number
  +    (or
  +     (and
  +      "0x"
  +      (+ (hex-digit-p character)))
  +     (and
  +      "0"
  +      (+ (oct-digit-p character)))
  +     (and
  +      (+ (digit-char-p character))))
  +  (:lambda (x)
  +    (list :number
  +	  (cond
  +	    ((= (length x) 1)
  +	     (parse-integer (text (car x))))
  +	    ((string= (car x) "0x")
  +	     (parse-integer (text (cadr x)) :radix 16))
  +	    ((string= (car x) "0")
  +	     (parse-integer (text (cadr x)) :radix 8))))))
  +
  +(defrule primary-expr
  +    (or
  +     (and
  +      #\(
  +      arithmetic-expr
  +      #\))
  +     literal-number
  +     posix-name)
  +  (:lambda (x)
  +    (cond
  +      ((stringp x)
  +       (list :var x))
  +      ((eql (car x) #\()
  +       (second x))
  +      ((eql (car x) :number)
  +       x))))
   
   (defun run-arithmetic (pt)
     (let ((op (car pt))
  
positive.code:    "))")
    (:destructure (start stuff end)
  		(declare (ignore start end))
      (let* ((expanded
  	    (esrap:text
  	     (do-some-expansions
  		 stuff
  
negative.code:     `(:sequence :start-anchor ,@stuff :end-anchor)))
  
  
  (defrule unary-op
      (or
       #\+
       #\-
       #\~
       #\!)
    (:lambda (x)
      (make-keyword x)))
       
  (defrule unary-and-primary-expr
      (or
       (and
        unary-op
        unary-and-primary-expr)
       (and
        primary-expr))
    (:destructure
     (first &optional second)
     (if second
         (list first second)
         first)))
  
  (defrule arithmetic-binop
      (or
       "<<="
       ">>="
       "&="
       "^="
       "|="
       "<<"
       ">>"
       "<="
       ">="
       "=="
       "!="
       "&&"
       "||"
       "*="
       "/="
       "%="
       "+="
       "-="
       "="
       "&"
       "^"
       "|"
       "*"
       "/"
       "%"
       "+"
       "-"
       "<"
       ">")
    (:lambda (x)
      (make-keyword x)))
  
  (defun operator-priority (op)
    (case op
  