Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!toto.cis.ohio-state.edu!pollack From: pollack@toto.cis.ohio-state.edu (Jordan B Pollack) Newsgroups: comp.lang.postscript Subject: Re: Compiled PostScript Message-ID: Date: 29 Dec 89 18:50:27 GMT References: <28@macuni.mqcc.mq.oz> <17490@rpp386.cactus.org> <1989Dec28.000745.6265@ico.isc.com> Sender: news@tut.cis.ohio-state.edu Reply-To: pollack@cis.ohio-state.edu Distribution: comp Organization: Ohio State Computer Science Lines: 36 In-reply-to: rcd@ico.isc.com's message of 28 Dec 89 00:07:45 GMT I just want to note that it is completely inconsequential whether or not the syntax of a programming language is context-free. The important thing for compiling is that run-time dependencies can be effectively circumscribed. Since postscript is most likely already implemented as threaded code, like forth, it is already compiled in some trivial sense. At the other end of the trivial spectrum, postscript is "compiled" when a showpage is executed, where the bitmap image of a page has lost all symbolic information about its own construction. However, there are many other notions of "Compiling" which are not captured by these simplistic notions. In particular, most modern compilers worry more about optimization than translation. Threaded code can be speeded up by being expanded into machine language control, in-line expansions and subroutine calls, which can lead to a time gain of 10% (in avoiding procedure calls and returns). Variables could be detected and replaced with stack operations. Invariant operations can be moved outside of loops. Short loops can be unrolled. Efficient registers could be allocated instead of stack space, and so on. However, postscript is a "throwaway" language, and any effort at such optimization probably wouldnt be very cost effective. To justify such a tremendous project (other than as a long-term way to silence an arrogant undergraduate hacker!) one would at least need a very large and slow postscript program which had to be run lots of times with complex and varying input. The only such program I could think of would be a postscript compiler written in postscript... -- Jordan Pollack Laboratory for AI Research CIS Dept/OSU 2036 Neil Ave email: pollack@cis.ohio-state.edu Columbus, OH 43210 Fax/Phone: (614) 292-4890