[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GO in T?



Riesbeck wrote a TLISP-to-T translator, to which I added a routine for
translating PROGs. It translates

(prog (n a)
    y (setq n 5)
      (setq a 1)
    z (cond ((= n 0) (go e)))
      (setq a (* a n))
      (setq n (- n 1))
      (go z)
    e (return a))

into

(let ((n nil) (a nil))
  (labels (((y:)    (set n 5) (set a 1) (z:))
           ((z:)    (cond ((= n 0) (e:)) (else (tag0:))))
           ((tag0:) (set a (* a n)) (set n (- n 1)) (z:))
           ((e:)    a))
    (y:)))

It's pretty simple,  and  generates  label-functions  (like  TAG0:),  to
handle splits in the flow of control,  as  found  in  COND  and  SELECTQ
as well  as  "top  level" ANDs and ORs.  The code for the PROG-converter
is in [RES]<F.T.TLISP>PROGCV.LSP.
-------