Settings

Theme

Show HN: A partial HTTP server written in brainfuck extended with syscalls

github.com

103 points by ajyoon 9 years ago · 61 comments

Reader

ww520 9 years ago

I think the best approach for the Brainfuck madness is to write a compiler/transpirer from a high level language (e.g. LOLCODE) to generate Brainfuck code. Then you can write your app in the high level language and show off the generated Brainfuck code.

greglindahl 9 years ago

It's really cute how the author added $ to insert a debugging break into the source. Instead of "debugging by printf", which is a bit tedious in brainfuck, this is driving your debugger by editing the source code. Bravo!

autotune 9 years ago

It's fantastic how the author was able to get this up and running, but not the hello world example.

tlrobinson 9 years ago

This is perhaps the most Hacker News headline ever.

andreaorru 9 years ago

This is madness. Also, has anyone noticed the Brainfuck interpreter is written in assembly?!

gregmac 9 years ago

Isn't leaving comments or whitespace in brainfuck code considered bad form?

jksmith 9 years ago

Is this idiomatic Brainfuck?

cwmma 9 years ago

can we talk about how github has code highlighting supports brainfuck?

I didn't really expect that

  • kevincox 9 years ago

    I was impressed, but then again it's like a 1h project so anyone with an interest can do it.

grabcocque 9 years ago

Please, I have a family. Don't do this.

partycoder 9 years ago

Because the brainfuck syntax is very simple, it's not really hard to generate a valid program from random characters.

The language is also Turing complete.

It is possible to use genetic programming (and other approaches) to generate brainfuck programs without an insane amount of effort.

Eventually the resulting program can be processed to be made more efficient.

le-mark 9 years ago

So we've come to this. At least it's not another javascript framework (ducks).

  • yoz-y 9 years ago

    Baby steps, but we will eventually get to reactive-brainfuck.

    • Cyph0n 9 years ago

      I've already filed a patent for BaaS (Brainfuck as a service), so don't even think about it guys. I'm in it for the long run ;)

      • nickpsecurity 9 years ago

        That's funny because I already had this patent describing:

        "Combination of Brainfuck with paper mediums for transmission to location for processing, storage, distribution, and archiving of said combinations."

        If you made a Brainfuck patent, you need to write me a check.

        • qwertyuiop924 9 years ago

          I can verify: he mentioned it in the thread on the sigtbd parallel brainfuck CPU paper (and yes, that was real: you can look it up).

    • ifdefdebug 9 years ago

      Ok but first we should rewrite the kernel in brainfuck. No, really.

    • nickthemagicman 9 years ago

      All someone has to do is write a JS->brainfuck transpiler and we could have this.

      • hobofan 9 years ago

        I'd really like to see that. I'm eager to build a small program that takes style offenses like nested ternary operators and replaces them with a still functional brainfuck equivalent, to highlight how anoying that style of programming is to read.

      • this-dang-guy 9 years ago

        How about one where style pages via bf->js->sass->css

        • DrJones1098 9 years ago

          I mean yeah but this is javascript. Only 3 phases of transpilation is for noobs.

          brainfuck->typescript->es6->via babel->es5->postCss plugins->sass->css->transpiled to react components->transpiled to an Angular 2 project->to webcomponents->transpiled to ArnoldC language->transpiled to a Turing complete Shopify liquid template-> commonjs and browserified->rails sprocket pipeline->then piped to /dev/null

          It's not easy being a Javascript Ninja/Rockstar.

    • foota 9 years ago

      Waiting for serverless brainfuck

    • Artemix 9 years ago

      And maybe a brainfuck framework to develop cross-platform apps

mi100hael 9 years ago

I don't know whether to be impressed or scornful that it's interpreted rather than compiled.

  • ajyoonOP 9 years ago

    I was surprised to learn that this has got to be one of the only languages which is easier to compile than interpret. When compiled the language reduces to basically a single-register assembly with a one-to-one character-to-line ratio. Bracket branching can be extremely easily implemented with jump labels and `test` + `jnz` statements without having to worry about things like parsing and jump table construction at all.

    • QuercusMax 9 years ago

      It's pretty freaking easy to interpret, as well... I implemented an interpreter in Go (which I had never used before) in an hour or so; most of the time spent was learning the two languages (Go and BF).

      I should start asking interview candidates to write a BF interpreter...

this-dang-guy 9 years ago

So delighted to see this :D I once fail/won with a paper in whitespace. I love the non-traditional programming languages. They're fun, whimsical, and sometimes a nice break.

LOLCode is still my favorite though. I wrote a prime number generator in it for fun :)

raw23 9 years ago

I think the author is a masochist

  • Pica_soO 9 years ago

    The author wrote parts of sauerbraten, he is a cool guy and not afraid of anything.

    • lmurray 9 years ago

      Do you play? I spent ages on that game. Any word on why that would mean he isn't afraid of anything?

      • Pica_soO 9 years ago

        I played the banabread fork- and tried to mod the engine once to make Turmalin, a sort of team-deathmatch meets 3d-tetris game. https://springrts.com/phpbb/download/file.php?id=6378

        The not being afraid of going unconventional ways refers to the levels of sauerbraten being stored in octrees. This is quite tough too edit if you are used to 3dsmax and blender. Actually that was too much effort- thus the project never came to be- but the way its stored and accessed, is blazingly fast and effective. One has to admire this skills.

      • mappu 9 years ago

        > Any word on why that would mean he isn't afraid of anything?

        http://knowyourmeme.com/memes/pretty-cool-guy

bweitzman 9 years ago

Why call it systemf? That name is already taken: https://en.wikipedia.org/wiki/System_F

rui314 9 years ago

Would it be easier to write a HTTP server in C and compile to Brainfuck using ELVM (https://github.com/shinh/elvm)?

  • ajyoonOP 9 years ago

    Much easier, the equivalent C would be in the area of 15-20 statements

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection