A Brainfuck interpreter written in PostScript
117 points
1 year ago
| 14 comments
| github.com
| HN
krylon
1 year ago
[-]
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.

reply
beefburger
1 year ago
[-]
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 :)
reply
andsoitis
1 year ago
[-]
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.
reply
gleenn
1 year ago
[-]
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.
reply
qwertox
1 year ago
[-]
These are the people which will be fighting for us in 20 years, from within some hidden cyberbunkers in the city sewerages.
reply
ben_w
1 year ago
[-]
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.

reply
krylon
1 year ago
[-]
I gotta say, the idea is amazing!
reply
tempodox
1 year ago
[-]
Definitely, Brainfuck squared.
reply
paulddraper
1 year ago
[-]
Close.

Peak <something> would be a PostScript interpreter written in Brainf***.

reply
mxsjoberg
1 year ago
[-]
oh no
reply
narag
1 year ago
[-]
To be peak brainfuckery, the GUI must only accept Morse code.
reply
1024core
1 year ago
[-]
Amen!

I read the title and recoiled in horror, and yet I am fascinated by the project.

reply
lynx23
1 year ago
[-]
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!
reply
lakpan
1 year ago
[-]
How do you implement a compiler in 6 lines of code, let alone 6 lines of BF code?
reply
matslina
1 year ago
[-]
Whitespace is ignored in Brainfuck, so just write the compiler in brainfuck and then strip all but 6 newlines.
reply
fouc
1 year ago
[-]
I think lines should be hard wrapped at around 100 or 120. Linus prefers 100 for example.
reply
lakpan
1 year ago
[-]
This is such a Brainfuck answer
reply
toast0
1 year ago
[-]
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.
reply
flipthefrog
1 year ago
[-]
Wonder what to use for MongoDb. "Mongo" is a nasty slur for a person with Downs syndrome in Norwegian
reply
hanniabu
1 year ago
[-]
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

reply
Twisol
1 year ago
[-]
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.

reply
IshKebab
1 year ago
[-]
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".
reply
geoelectric
1 year ago
[-]
I’m hoping the official term of art is either a clusterfuck or a fuckfest?
reply
toast0
1 year ago
[-]
I'm not going to write the term I saw on a resume, but it starts with a b and may be a Japanese word.
reply
geoelectric
1 year ago
[-]
https://bitbucket.org/wjmelements/bukkake/ I take it?

I’m surprised it didn’t make more of a splash.

reply
jraph
1 year ago
[-]
This is what I've seen others qualify as "quite cursed".
reply
arethuza
1 year ago
[-]
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.

reply
tambourine_man
1 year ago
[-]
I think that's what they call Stockholm syndrome
reply
arethuza
1 year ago
[-]
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!).

reply
tambourine_man
1 year ago
[-]
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.

reply
arethuza
1 year ago
[-]
Out of interest, which programming language do you prefer?
reply
tambourine_man
1 year ago
[-]
Oh, the most boring ones. Anything with a C-like syntax is off to a good start.

I like pragmatic languages, with minimum boilerplate.

If I had to list: C, JavaScript, Python and PHP, in no particular order. And I like Bash too, even if it’s less a language and more just a thin veneer of control flows, loops and variables for controlling other executables, it’s still quite useful.

reply
WCSTombs
1 year ago
[-]
PostScript is a pretty good programming language for what it's meant to do, which is put vector graphics in a box. It was the first language I wrote a lot of code in just for fun and not for school or work, specifically to draw a bunch of fractals. It's particularly well suited for that type of graphics whose structure is mathematically determined by a simple algorithm.
reply
mananaysiempre
1 year ago
[-]
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.
reply
planede
1 year ago
[-]
Postscript is actually surprisingly approachable. It's quite easy to implement logo-like "turtle graphics" and draw fractals in it.
reply
downrightmike
1 year ago
[-]
37 years ago: "Why wouldn't you want some random file to be able to execute random code on any and every machine that its on?"
reply
nevir
1 year ago
[-]
The description is glorious:

---

A Brainfuck interpreter written in PostScript

This program aims at being accurate, readable and minimal.

reply
kevindamm
1 year ago
[-]
----[---->+<]>++.+[--->++<]>-.+.------------.--[->++++<]>-.[->+++<]>.+++++++..[++>---<]>--.+[->+++<]>+.+++++++++++.-.---------.--[--->+<]>.-..---[->+++<]>.+++[->++++<]>+.+++++++++++.------------.--[--->+<]>--.[->+++<]>+.-[->+++<]>.+[->+++<]>+.+.---.[--->+<]>-.++[->+++<]>++.-[--->+<]>--.+[->+++<]>++.+++++++++.++++++++.[------>+<]>.+++++++++.---.-.-.--------.+++++++++.++++++.[---->+<]>+++.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.---[->++++<]>+.-------.-----.+++++++++++.[---->+<]>+++.---[->++++<]>.+++[->+++<]>.[--->+<]>----.+.[---->+<]>+++.-[--->++<]>--.-------.--[--->+<]>---.----.---------.[--->+<]>----..+[++>---<]>.++[--->++<]>..>-[--->+<]>--.[--->+<]>-.----.-------.+++++++++.----------.+++++.-----.[->+++<]>.------------.-[--->++<]>-.+++++.----------.+..-.-[--->+<]>..
reply
mmphosis
1 year ago
[-]
reply
Log_out_
1 year ago
[-]
The inventor of brain fuck also gave us the Sauerbraten engine with its octree geometry storage as maps.
reply
qwertox
1 year ago
[-]
Out of curiosity I landed at http://sauerbraten.org and was not disappointed by the trailer.
reply
LanternLight83
1 year ago
[-]
I had no idea, that's awesome; used to love Red Eclipse 2, and my father once roped my siblings and I into playing Urban Terror, both of which we owe to Cube
reply
segmondy
1 year ago
[-]
Now, do the inverse and implement postscript in BF
reply
cjaybo
1 year ago
[-]
Some people just love pain it seems
reply
webXL
1 year ago
[-]
Sadomasochism is alive an well.
reply
unwind
1 year ago
[-]
Surely it's hurting?
reply
fouc
1 year ago
[-]
Code looks good! Postscript is a pretty sweet alternative to forth.
reply
dhosek
1 year ago
[-]
Back in the olden days, it was not uncommon to print bitmap graphics files from compressed graphics source (e.g., gif, jpg, tif¹) 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.

reply
leonheld
1 year ago
[-]
I hate it in the best way possible.
reply
dxtrous
1 year ago
[-]
Would it work on a printer?
reply
colanderman
1 year ago
[-]
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

reply
local_crmdgeon
1 year ago
[-]
… are you telling me there’s 2 BF PS compilers?
reply
colanderman
1 year ago
[-]
Only one to my knowledge; the OP is an interpreter.
reply
bryancoxwell
1 year ago
[-]
What is wrong with you people
reply
coldacid
1 year ago
[-]
"Some men just want to watch the world burn."
reply