diff options
author | Jakob Kaivo <jakob@kaivo.net> | 2018-09-13 16:51:34 -0400 |
---|---|---|
committer | Jakob Kaivo <jakob@kaivo.net> | 2018-09-13 16:51:34 -0400 |
commit | 296caf6cce8120bf3537f8ab05ddc4bc7273e859 (patch) | |
tree | a2c256114f3e07c381a193e4e33e4b54fc62ced7 /bf.c | |
parent | 3dc6799453b87f5dea4d6941d5ccec359b719ecb (diff) |
initial commit
Diffstat (limited to 'bf.c')
-rw-r--r-- | bf.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -0,0 +1,19 @@ +#include <stdio.h> +#define S (1<<16) +#define I a[1] +#define D a[0] +#define C case +#define B break +static char d[S], p[S]; +int main(int i, char *a[]) { + fread(p, 1, S, fopen(I, "r")); + for (D = d, I = p; I < p + S; I++) { + switch (i = *I) { + C '[': C ']': for (i = '\\' - *I; i < 0 ? *D : !*D; i += *(I += i > 0 ? 1 : -1) == '[' ? 1 : *I == ']' ? -1 : 0); B; + C '+': C '-': *D -= i - ','; B; + C '<': C '>': D += i - '='; B; + C ',': *D = getchar(); B; + C '.': putchar(*D); B; + } + } +} |