[HN Gopher] A Brainfuck interpreter written in PostScript
___________________________________________________________________
A Brainfuck interpreter written in PostScript
Author : romac
Score : 95 points
Date : 2023-12-05 13:43 UTC (9 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| jraph wrote:
| This is what I've seen others qualify as "quite cursed".
| arethuza wrote:
| PostScript is actually a pretty nice programming language, once
| you get used to it.
|
| Edit: I used it for a few years within NeWS & HyperNeWS.
| tambourine_man wrote:
| I think that's what they call Stockholm syndrome
| arethuza wrote:
| I think that's a bit harsh - this was a complex system
| written in Common Lisp that had a front end in NeWS with
| some C plumbing linking the two together.
|
| PostScript and Lisp are actually pretty similar when the
| former is used in an interactive graphical environment
| (i.e. not on a printer!).
| tambourine_man wrote:
| I said it in jest, sorry. I wrote a bit of PostScript
| because I absolutely had to and it was painful, even
| though I was thrilled to eventually push through.
|
| But I'm very particular about syntax, so the reverse
| polish notation was enough to upset me. Needless to say,
| I appreciate Lisp for its power and conceptual simplicity
| but would never choose to use it.
| mananaysiempre wrote:
| I mean, it's a perfectly serviceable postfix Lisp. Postfix
| Lisps are nice! Other things in the page layout language
| are less nice (e.g. the nonexistent i18n), but the
| programming parts are quite pleasant, I think.
| leonheld wrote:
| I hate it in the best way possible.
| cjaybo wrote:
| Some people just love pain it seems
| webXL wrote:
| Sadomasochism is alive an well.
| unwind wrote:
| Surely it's hurting?
| dxtrous wrote:
| Would it work on a printer?
| colanderman wrote:
| Looks like it. I wrote one years ago that does [1] (a BF
| compiler actually) and this looks similar.
|
| (Some other fun PS ditties at that link.)
|
| [1] https://chris.pacejo.net/stuff/postscript/index
| local_crmdgeon wrote:
| ... are you telling me there's 2 BF PS compilers?
| colanderman wrote:
| Only one to my knowledge; the OP is an interpreter.
| nevir wrote:
| The description is glorious:
|
| ---
|
| A Brainfuck interpreter written in PostScript
|
| This program aims at being accurate, readable and minimal.
| lynx23 wrote:
| The most awesome random submission I ever received was a
| BrainFuck compiler written in BrainFuck, by hand. Short story: I
| wrote a bf compiler in Emacs Lisp many many years ago. As a small
| testcase, I included a BrainFuck compiler in BrainFuck, which was
| written by a guy who wrote a C-alike to BrainFuck compiler so
| that he could implement his BF compiler in BF. That was a strange
| piece of code, about 6 pages of plain BF. A few years later,
| suddenly, I have this mail in my INBOX: A norwegian guy sent me a
| BF compiler in BF, written by hand. He was unsatisfied by the
| existing BF compiler, as it was generated. His implementation was
| about 6 lines of BF code. And it was a magnitude faster. Hats off
| to that guy!
| lakpan wrote:
| How do you implement a compiler in 6 lines of code, let alone 6
| lines of BF code?
| matslina wrote:
| Whitespace is ignored in Brainfuck, so just write the
| compiler in brainfuck and then strip all but 6 newlines.
| fouc wrote:
| I think lines should be hard wrapped at around 100 or 120.
| Linus prefers 100 for example.
| bryancoxwell wrote:
| What is wrong with you people
| coldacid wrote:
| "Some men just want to watch the world burn."
| toast0 wrote:
| Just a helpful resume tip. If you work on something in Brainfuck,
| put it on your resume as BF. And don't mention the name of your
| multi-threaded BF environment.
| flipthefrog wrote:
| Wonder what to use for MongoDb. "Mongo" is a nasty slur for a
| person with Downs syndrome in Norwegian
| hanniabu wrote:
| I was told mongoloid was the politically correct term to use
| instead of retarded lol
|
| Personally I always thought it sounded more demeaning, kinda
| sounds like some less developed homosapian ancestor, almost
| like calling someone a neanderthal
| Twisol wrote:
| I don't think that term has been appropriate for a long
| time... Wikipedia seems to indicate similarly.
|
| https://en.m.wikipedia.org/wiki/Mongolian_idiocy
|
| I saw someone on Rocket League use that term as an insult.
| When I said it was a slur, they said it just meant
| "stupid", heh. No, buddy... there's a lot more to it than
| that.
| IshKebab wrote:
| There _was_ a lot more to it than that. Insults tend to
| gradually lose their meaning until they just become
| synonyms for "stupid". E.g. "idiot", "dumb", "gay".
| geoelectric wrote:
| I'm hoping the official term of art is either a clusterfuck or
| a fuckfest?
| planede wrote:
| Postscript is actually surprisingly approachable. It's quite easy
| to implement logo-like "turtle graphics" and draw fractals in it.
| kevindamm wrote:
| ----[---->+<]>++.+[--->++<]>-.+.------------.--[->++++<]>-.[->+++
| <]>.+++++++..[++>---<]>--.+[->+++<]>+.+++++++++++.-.---------.--[
| --->+<]>.-..---[->+++<]>.+++[->++++<]>+.+++++++++++.------------.
| --[--->+<]>--.[->+++<]>+.-[->+++<]>.+[->+++<]>+.+.---.[--->+<]>-.
| ++[->+++<]>++.-[--->+<]>--.+[->+++<]>++.+++++++++.++++++++.[-----
| ->+<]>.+++++++++.---.-.-.--------.+++++++++.++++++.[---->+<]>+++.
| [->+++<]>+.+++++++++++++.----------.-[--->+<]>-.---[->++++<]>+.--
| -----.-----.+++++++++++.[---->+<]>+++.---[->++++<]>.+++[->+++<]>.
| [--->+<]>----.+.[---->+<]>+++.-[--->++<]>--.-------.--[--->+<]>--
| -.----.---------.[--->+<]>----..+[++>---<]>.++[--->++<]>..>-[--->
| +<]>--.[--->+<]>-.----.-------.+++++++++.----------.+++++.-----.[
| ->+++<]>.------------.-[--->++<]>-.+++++.----------.+..-.-[--->+<
| ]>..
| mmphosis wrote:
| https://imgur.com/bQ1JlIQ.png
| krylon wrote:
| This has got to be peak <something>. I don't know what exactly,
| but it's something. Self-inflicted torment and/or eccentric
| fountain of joy. Probably both.
|
| I cannot, for the life of me, see myself investing the time
| needed into something so futile. But I love that there are people
| out there who do this kind of thing out of pure joy.
| beefburger wrote:
| I'm the author of bfps. I don't have too much time either. But
| I do enjoy this kind of brainb^Hteaser while commuting in the
| train :)
| andsoitis wrote:
| I love this idea. Instead of doomscrolling news or giving
| your time to the attention economy in other ways, this is
| like solving interesting puzzles.
| qwertox wrote:
| These are the people which will be fighting for us in 20 years,
| from within some hidden cyberbunkers in the city sewerages.
| 1024core wrote:
| Amen!
|
| I read the title and recoiled in horror, and yet I am
| fascinated by the project.
| ben_w wrote:
| At one point I was considering writing, in Postscript, a
| Brainfuck compiler whose compilation target is a Magic the
| Gathering based Turing machine.
|
| I did not accomplish this.
| tempodox wrote:
| Definitely, Brainfuck squared.
| narag wrote:
| To be peak brainfuckery, the GUI must only accept Morse code.
| gleenn wrote:
| Brainfuck, while difficult to actually use, is very easy to
| implement. There is one array data structure of ints, and iirc
| 8 operators that work on the array. They either manipulate the
| current pointer to the array cell by either moving up or down,
| or increment or decrement the value there. And then there is a
| simple conditional and a print command. That's it. You can
| write that in an afternoon if not in an interview session. Now
| actually doing something productive with the language is a
| whole different situation. It's clearly Turing-complete as the
| infinite paper is just the array and the operations are exact
| copies. A fun little exercise.
| Log_out_ wrote:
| The inventor of brain fuck also gave us the Sauerbraten engine
| with its octree geometry storage as maps.
| qwertox wrote:
| Out of curiosity I landed at http://sauerbraten.org and was not
| disappointed by the trailer.
| fouc wrote:
| Code looks good! Postscript is a pretty sweet alternative to
| forth.
| dhosek wrote:
| Back in the olden days, it was not uncommon to print bitmap
| graphics files from compressed graphics source (e.g., gif, jpg,
| tif1) by sending code to decompress the compressed graphics
| data alongside a base64-encoding of the data.
|
| [?]
|
| 1. These were the only compressed graphics format options
| available back then.
___________________________________________________________________
(page generated 2023-12-05 23:01 UTC)