Contents    Page-10    Prev    Next    Page+10    Index   

Transformation Patterns Optimization:


(defpatterns 'opt
  '( ((+ ?x 0)            ?x)
     ((* ?x 0)             0)
     ((* ?x 1)            ?x)
     ((:= ?x (+ ?x 1))    (incf ?x)) ))

Language translation:


(defpatterns 'lisptoc
  '( ((aref ?x ?y)       ("" ?x "[" ?y "]"))
     ((incf ?x)          ("++" ?x))
     ((+ ?x ?y)          ("(" ?x " + " ?y ")"))
     ((= ?x ?y)          ("(" ?x " == " ?y ")"))
     ((and ?x ?y)        ("(" ?x " && " ?y ")"))
     ((if ?c ?s1 ?s2)    ("if (" ?c ")" #\Tab
                           #\Return ?s1
                           #\Return ?s2))