brainfuck for humans
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)
- right x ; equiv to m += x
- left x ; equiv to m -= x
- add x ; equiv to [m] += x
- subtract x ; equiv to [m] -= x
- input ; equiv to bf(“,”)
- output ; equiv to bf(“.”)
- loop (s) ; while ([m]) { s }
- clear ; loop (subtract 1;);
- set x ; clear; add x;
- set ‘x’ ; set ord(x)
- string “x”; for(I=0; I<strlen(“x”); I++) { set “x”[I]; left 1; }
- read ; file=fopen(m, “r”); fread(m, 1, file_len, file);
- write ; file=fopen(m, “w”); fwrite(m+strlen(m)+1,1,strlen(m+strlen(m)+1),file);