RPN Loved Honk If (or, Write Your Own PostScript Interpreter)

Posted

Maybe you like old laser printers. Maybe you were a fan of [Don Lancaster]. Maybe you like Forth, HP calculators, and everything RPN. Whichever it is, why not write your own PostScript interpreter? That’s what [beyondloom] did (and we shamelessly stole their joke for the post title, too).

PostScript started out as a language to describe pages for laser printers but went on to have a life of its own, including a stripped-down version being at the core of PDF files. If you are a fan of RPN, you’ll love PostScript, which operates on several stacks.

The example interpreter is in JavaScript and handles a subset of PostScript with little error handling. Still, it manages an operand stack, a dictionary stack, and arrays. Of course, if you just want to try PostScript, there’s always Ghostscript. But there’s something charming about a practical interpreter that is tiny and understandable, even if it does gloss over a few deep features.

If you want to see the original PostScript, the source code is out there. If you don’t think PostScript is really a language, check out this chess program (the first link is dead, but the GitHub link remains). Or, perhaps you prefer Doom.

Software Development, postscript, RPN