Re:A Brainfuck interpreter written in PostScript
by lynx23 on Tuesday December 05, 2023 @09:38AM
(#38531299)
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!
[ Parent
| on HN ]
Re:A Brainfuck interpreter written in PostScript
by lakpan on Tuesday December 05, 2023 @11:49AM
(#38533343)
How do you implement a compiler in 6 lines of code, let alone 6 lines of BF code?
Re:A Brainfuck interpreter written in PostScript
by matslina on Tuesday December 05, 2023 @01:13PM
(#38534743)
Whitespace is ignored in Brainfuck, so just write the compiler in brainfuck and then strip all but 6 newlines.