Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)


"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Monday May 29, 2006
07:11 PM

O Javanese Navajo

[ #29751 ]
Dear Log.

I managed a minor trick/victory/tricktory with Skreeth: since Skreeth files might/must be Lisp code prefaced by (or just plain interleaved with) the PostScript preamble that will interpret the Lisp, I want such files to be editable in both emacs's Lisp mode and emacs's PostScript mode. To get that to be not too insane, I came up with this bit of code that is valid PostScript as well as valid Lisp:

(;) pop /; {} def (
quote %) ; pop
;% An all-around comment
; 1 2 3 add add ===

Lisp (and thus the Lisp mode) just sees that as: (quote %), which is a useless/harmless expression (but, importantly for the editor's Lisp-mode, it is a valid balanced s-expression and thus doesn't throw off the indent level or anything, as a big block of normal inlined raw PS would). And PostScript (and PostScript-mode) sees this as creating and then discarding the string-literal ";" and then defining a ";" operator to be a no-op, then creating and discarding a string-literal "\nquote %", then a comment line (which happens to start with the no-op operator ";", and then finally a line with another no-op operator and then adding up 1 and 2 and 3 and displaying it.

This hurts my brain, but it will all be useful later, I think.

I wonder if there's a name for this sort of program -- i.e., a bit of source that parses validly one way in one language and parses validly another way in another language. A "Janus program" maybe? I've seen such things for nroff/C, Perl/.bat, etc.

In other news, my grand plan to do a bunch of work on Skreeth this past few weeks (notably the actual Lisp-parsing part of the system) has been a total wash, as the past month has been a continual pie-fight of distractions and minor annoying ailments.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.