I tried to write (in C) a PostScript byte compiler for a grad school project. It is a very appealing language to work with, with the simplicity of stack machine. And like with this post, I didn't get into the graphical elements that make PostScript useful.
Mainly I learned that Ghostscript is doing a lot to make its PostScript interpreter fast: with the non-graphical test programs I could think up, GhostScript was many times faster interpreting the program (even computationally intensive ones) than my runtime (called "egon") could execute the byte-compiled PostScript. So it was a computation fail but still a pedagogy win.
I've always been meaning to learn more about how Ghostscript is engineered.
I still mess with PostScript once in a while. For example I generate little puzzles for my daughter/nephews (words to find in an hexagonal grid, where each hexagon contains one letter): wrote that in Clojure but it generates PostScript (nowadays I could ask a LLM to write the whole thing for me though as the potential for disaster is limited).
Then there's that one utility company who screws up my montly invoice and so, invariably, when I need to do KYC for whatever bullshit-state-surveillance reason (which, invariably, happens all the time), KYC fails for my official address doesn't match the technical address the utility company is using on my invoices.
So the PDF gets converted to PostScript, I edit the PostScript, and convert back to PDF. Nowadays I take it I could also have a LLM do it all for me but the thing is: I don't want my PDF to look like a PDF which has been tempered with (which it definitely has been, but fuck KYC and screw that utility company for not using my proper official address). So I like the PDF to PostScript to edit back to PDF cycle.
This is a yawner, Postscript (the language) is very simple, given run of the mill interpreter machinery. An actual working Postscript implementation is about graphics and font rendering, not the language interpreter. That stuff is still not trivial.
Mainly I learned that Ghostscript is doing a lot to make its PostScript interpreter fast: with the non-graphical test programs I could think up, GhostScript was many times faster interpreting the program (even computationally intensive ones) than my runtime (called "egon") could execute the byte-compiled PostScript. So it was a computation fail but still a pedagogy win.
I've always been meaning to learn more about how Ghostscript is engineered.
Then there's that one utility company who screws up my montly invoice and so, invariably, when I need to do KYC for whatever bullshit-state-surveillance reason (which, invariably, happens all the time), KYC fails for my official address doesn't match the technical address the utility company is using on my invoices.
So the PDF gets converted to PostScript, I edit the PostScript, and convert back to PDF. Nowadays I take it I could also have a LLM do it all for me but the thing is: I don't want my PDF to look like a PDF which has been tempered with (which it definitely has been, but fuck KYC and screw that utility company for not using my proper official address). So I like the PDF to PostScript to edit back to PDF cycle.