brainfuck for humans

From Esolang
Jump to navigation Jump to search
Not to be confused with brainfuck 4 humans.

brainfuck 4 humans is a perfectly good esolang, with perfectly good syntax, but I think we can make it easier to read, y’know?

Syntax

Brainfuck for humans has a similar syntax to brainfuck 4 humans, with the important addition of enumerated motions, for example: left 3; is equivalent to left;left;left; in brainfuck for humans, the syntax list is as follows:

(For this example we may assume m is the memory pointer and [m] is a dereference from m, otherwise C like syntax may be assumed)

  1. right x ; equiv to m += x
  2. left x ; equiv to m -= x
  3. add x ; equiv to [m] += x
  4. subtract x ; equiv to [m] -= x
  5. input ; equiv to bf(“,”)
  6. output ; equiv to bf(“.”)
  7. loop (s) ; while ([m]) { s }
  8. clear ; loop (subtract 1;);
  9. set x ; clear; add x;
  10. set ‘x’ ; set ord(x)
  11. string “x”; for(I=0; I<strlen(“x”); I++) { set “x”[I]; left 1; }
  12. read ; file=fopen(m, “r”); fread(m, 1, file_len, file);
  13. write ; file=fopen(m, “w”); fwrite(m+strlen(m)+1,1,strlen(m+strlen(m)+1),file);