Am I writing PostScript wrong?

16 views
Skip to first unread message

luser droog

unread,
Nov 25, 2021, 9:46:33 PM11/25/21
to
(I asked a similar question in comp.lang.c wrt C)

I've been really hooked on the parser combinator stuff for a while
and I've implemented a dozen or so versions in PostScript. But having
questioned whether I'm writing C wrong by turning it into Lisp,
the question naturally follows: Is my PostScript code too Lisp-y?

I'm regularly relying on my "pairs" and "func" extensions described
here:
https://codereview.stackexchange.com/questions/193520/an-enhanced-syntax-for-defining-functions-in-postscript

And along with these come `combine` and `curry`. So there's a whole
lotta currying going on. But I also noticed that I may be needlessly
creating extra Lisp-ish structures where they aren't needed or helpful.

The big problems with my last round of test cases for the parsers was
due to creating results as cons lists. When I just stopped doing that
and did something more sensible from the PS point of view, the whole
problem smoothed out and fizzled.

But even now, I'm adding extra structure to wrap up the "reply" from
each parser as a single object. PostScript doesn't naturally impose
this restriction. You can just return multiple values by leaving
multiple values. Invisible tuples, so to speak.

So, I might try one more re-write to strip away the structure and
return

<result> <remainder> true
<message> <remainder> false

And that's almost the same as the `token` interface. So, it feels
like the right direction.

Is my lisp showing in other places?
Reply all
Reply to author
Forward
0 new messages