advertisement

Article:
  Introduction to Cocoa Graphics, Part 2
Subject:   pretty print (Q)
Date:   2001-11-08 12:39:54
From:   psheldon
As I read, I simply paste in from the column the code rather than type it. I then "pretty print it", that is put in white space and indents, to break it into digestable thought chunks. Pretty printing can be a very mechanical thing and, I believe, that mechanical thing doesn't really help me to understand. I might like a rudimentary ap to pretty print c's "{}" 's for me by indenting the nested ones more . I've seen such automatic parentheses emerging in the beta versions of what is now called livemath. In contrast, maple does not have a pretty printer. ETH Modula had a syntax directed editor which "apriori" pretty printed as you constructed stuff, but Apple or the column affords the stubs which, on pasting from Mike's column, I must pretty print aposteriori.
I recall a pretty printer long ago, but can't get a better lead on finding it. Since Applescript has a scriptable text editor, I suspect that someone with parser experience, could have made a "pretty printer" in Applescript (Jon Pugh?). Applescript itself automatically pretty prints, so I suspect a died in the wool applescripter wouldn't worry about it. Parsers are written with recursive calls. Anybody who has done the humungous task of making a compiler might have rolled their own pretty printer to make their own work surveyable.