Hacker News new | ask | show | jobs
by jhonsrid 977 days ago
The language with a rude name sometimes known as 'BF' compiles trivially to C (from C), for instance:

  #include <stdio.h>
  int main() {
      int c;
      printf("#include <stdio.h>\nint main() {\nchar a[30000] = {0}; char *p = a;\n");
      while((c = getc(stdin)) != EOF) {
          switch(c) {
              case '>': printf("++p;\n"); break;
              case '<': printf("--p;\n"); break;
              case '+': printf("++*p;\n"); break;
              case '-': printf("--*p;\n"); break;
              case '.': printf("putchar(*p);\n"); break;
              case ',': printf("*p = getchar();\n"); break;
              case '[': printf("while (*p) {\n"); break;
              case ']': printf("}\n"); break;
          }
      }
      printf("return 0;}\n");
      return 0;
  }
(Though sorry to any BF fans if I've missed something in the implementation) ;-)
1 comments

Just say it… Brain Fuck

Let its syllables echo through your body

Let its phonetic oomph roll off your tongue