The John Wiseman of a year or two ago was on his way to posting something about Peter Norvig's Common Lisp-To-Dylan converter tool when, I assume, something came along and distracted me, since I don't see that post anywhere.
...here I produce Dylan code with nice indentation, to any specified column width, just by converting Lisp to a parse-tree syntax that is equivalent to Dylan, and then writing pretty-print directives for the parse-trees.
The one time I played with Dylan I was so put off by the terrible, terrible performance of the Harlequin Dylan environment that I had to stop after half an hour. But this code of Norvig's is still kind of neat.
Posted by jjwiseman at July 21, 2005 08:28 AM
LTD works by first reading a Lisp s-expression with ltd-read, then converting it to an internal s-expression representation which represents a Dylan parse tree with cvt-exp, and then printing the internal representation with dpp-exp (DPP stands for Dylan Pretty-Print). For example, calling ltd-read on the fragment of source file;; Compute sign of x (cond ((< x 0) -1) ((> x 0) 1) (t 0))
results in the expression#S(com :comment " Compute sign of x" :code (cond ((< x 0) -1) ((> x 0) 1) (t 0)))
which gets translated by cvt-exp to the internal form#S(com :comment " Compute sign of x" :code (IF (< X 0) -1 (:ELSIF (> X 0) 1) (:ELSE 0)))
which then gets printed by dpp-exp as something like// Compute sign of x if (x < 0) -1; elsif (x > 0) 1; else 0; end