News for hackers. Stuff that matters.
Re:Stack-Oriented Programming by pedrow on Wednesday January 15, 2020 @04:55AM (#22053000)
I recently saw an announcement[0] of a Z-machine in Postscript. The Z-machine is a runtime for text adventure games. Also posted on HN[1] but no comments were made.

[0]: https://groups.google.com/d/msg/rec.arts.int-fiction/HNtntxC...

[1]: https://news.ycombinator.com/item?id=21367412

Re:Stack-Oriented Programming by zzo38computer on Wednesday January 15, 2020 @04:47PM (#22059093)
Yes; I wrote that program, and the Usenet message and the message on HN (which mentions the message ID for the Usenet message). If you have comments about it, I suggest writing a follow-up message on Usenet.

PostScript is a real programming language and can be used for many things (especially graphics). I also wrote a JSON parser in PostScript (see message <[email protected]> on comp.lang.postscript), and then someone else post their JSON parser in PostScript too.

I think PostScript isn't such a good protocol or document format, but it is good as a programming language. It is what I might use if I want to make a diagram (but unfortunately Ghostscript cannot produce SVG output; it can output PDF though, as well as many raster formats).

Re:Stack-Oriented Programming by haolez on Thursday January 16, 2020 @07:59PM (#22070805)
Nice! Thanks for answering! Would you choose PostScript over Forth as a general purpose language?
Re:Stack-Oriented Programming by zzo38computer on Thursday January 16, 2020 @10:06PM (#22071493)
I think it would depend on what I am trying to make; there are advantages and disadvantages to each. In the case of the JSON parser, I think it is helpful that PostScript has data structures (such as arrays and dictionaries) and arbitrarily typed values like JavaScript and many other scripting languages have. In the case of Z-machine, Forth would probably do as well as PostScript (or probably Forth would do better, actually).

Someone was unsure how useful would be the JSON parser I wrote in PostScript, but if you want to print some diagram based on data in JSON format, then it can be helpful.

(I could implement Z-machine in Forth too if I wanted to do, but I have not done so yet because I have other things to do; I don't know if I might do so in future or not. I could implement Z-machine in any programming language with byte arrays, including assembly language (I started but haven't finished one in 6502).)