Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ames!dftsrv!mimsy!brillig.umd.edu!don From: don@brillig.umd.edu (Don Hopkins) Newsgroups: comp.lang.postscript Subject: debugging PostScript Summary: do it on the screen Keywords: PostScript debugging, NeWS, PSIBER Space Deck Message-ID: <21248@mimsy.umd.edu> Date: 13 Dec 89 02:37:10 GMT References: <89@ <49400001@primerd> Sender: news@mimsy.umd.edu Reply-To: don@brillig.umd.edu (Don Hopkins) Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 57 In article <49400001@primerd> choinski@primerd.prime.com writes: > >||It seems like it might be possible, in principle, to get a cheap and >||accurate postscript previewer given you already have postscript in a >||printer. > >The hell with any pre-viewers! Does anyone out there have a postscript >lexer? I've just about had it with sending a large PS file to the >printer and find the entire job flushed because I misspelled "setgray". >And of course, it only reports one error at a time, so any additional >problems are found ONE AT A TIME! > >A PS-lexer would be great, and having a syntax checker as well would >be optimal. I don't need a full pre-viewer, just something to catch >simple errors. I can handle the semantic problems when I see the >output. > >Anyone have something that will do? > >-============================================================================- > Burton Choinski choinski@env.prime.com > Prime Computer, Inc. (508) 879-2960 x3233 > Framingham, Ma. 01701 > Disclaimer: Hey, not me man; musta been my evil twin. >-============================================================================- PostScript syntax is so trivial that most of the bugs you enounter are semantic. How could a mere lexer know that "setgary" was a user defined procedure rather than a typo, without actually interpreting the code? What you probably need is a PostScript interpreter with a stubbed-off graphics library. I'm not saying that such a beast (a graphics-less postscript interpreter) would not be useful (it would be very useful, and relativly easy to write). You could lexically analyze the document structuring comments, without actually interpreting the PostScript code, but no matter how badly formed the document structure is, it'll never cause any of the types of bugs you want to detect, since comments are ignored by the interpreter, of course! The best way to debug PostScript is on the screen. I have heard that Adobe sells some sort of PostScript debugging system for Display PostScript, but I have never seen it. (and I've only seen ads for LaserTalk.) I've written an extensive PostScript debugger for NeWS (The PSIBER Space Deck -- PostScript Interactive Bug Eradication Routines), that is described in a paper I presented at the Usenix Monterey graphics conference. I use it all the time, and it seemed to work last time I tried (it's been most useful for debugging itsself). If you'd like a copy of the paper and/or the source code to the NeWS PostScript debugger and associated paraphernalia, send me a note (don@brillig.umd.edu, ...!uunet!mimsy!don) and I'll try to email it to you. (It's pretty big, but it's free!). (I recently posted it all to comp.windows.news, so check there first if you can.) The NeWS debugger is written entirely in PostScript. It runs on NeWS 1.1 and X11/NeWS. It would be impossible to run it in a laser printer though, because of its extremely interactive nature (direct stack manipulation, graphical data structure editor, etc...). -Don