├── .gitignore
├── Makefile
├── README.md
├── UNLICENSE
├── bf-x86.c
└── samples
├── fib.bf
├── hanoi.bf
├── hello.bf
├── mandelbrot.bf
└── wc.bf
/.gitignore:
--------------------------------------------------------------------------------
1 | bf-x86
2 | samples/hanoi
3 | samples/mandelbrot
4 | samples/fib
5 | samples/wc
6 | samples/hello
7 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CFLAGS = -std=c99 -Wall -Wextra -Wno-missing-field-initializers -g3 -Os
2 |
3 | programs = bf-x86 \
4 | samples/hanoi samples/mandelbrot samples/fib samples/wc samples/hello
5 |
6 | all : $(programs)
7 |
8 | bf-x86 : bf-x86.c
9 |
10 | samples/hanoi : samples/hanoi.bf bf-x86
11 | samples/mandelbrot : samples/mandelbrot.bf bf-x86
12 | samples/fib : samples/fib.bf bf-x86
13 | samples/wc : samples/wc.bf bf-x86
14 | samples/hello : samples/hello.bf bf-x86
15 |
16 | .PHONY : all clean
17 |
18 | clean :
19 | $(RM) $(programs)
20 |
21 | % : %.bf
22 | ./$(word 2,$^) -o $@ $<
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # x86_64 Brainfuck Compiler
2 |
3 | `bf-x86` compiles [brainfuck][bf] programs directly into tiny,
4 | position-independent x86_64 Linux ELF programs. The resulting ELF
5 | doesn't link to any standard libraries, instead making raw syscalls.
6 | It can optionally execute the compiled program directly in memory like
7 | a [JIT-compiler][jit].
8 |
9 | The compiler employs a [peephole optimizer][peep] to produce compiled
10 | programs that run quickly and efficiently.
11 |
12 | ## Usage
13 |
14 | $ bf-x86 -o hello hello.bf
15 | $ ./hello
16 | Hello, world!
17 |
18 | ## Additional Resources
19 |
20 | * [some brainfuck fluff](http://www.hevanet.com/cristofd/brainfuck/)
21 | * [Fast Brainfuck interpreter bff4.c](http://mazonka.com/brainf/)
22 | * [Esoland Brainfuck](https://esolangs.org/wiki/Brainfuck)
23 | * [Přemysl Eric Janouch's compiler with IR and DWARF debugging][janouch]
24 |
25 | [bf]: https://esolangs.org/wiki/Brainfuck
26 | [janouch]: https://git.janouch.name/p/bfc
27 | [jit]: http://nullprogram.com/blog/2015/03/19/
28 | [peep]: http://en.wikipedia.org/wiki/Peephole_optimization
29 |
--------------------------------------------------------------------------------
/UNLICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
25 |
--------------------------------------------------------------------------------
/bf-x86.c:
--------------------------------------------------------------------------------
1 | #define _BSD_SOURCE // MAP_ANONYMOUS
2 | #define _POSIX_SOURCE // fileno
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #define MEMORY_SIZE 30000
17 |
18 | const char *program_name = "bf-x86";
19 | #define FATAL(message) \
20 | do { \
21 | fprintf(stderr, "%s: %s\n", program_name, message); \
22 | exit(EXIT_FAILURE); \
23 | } while (0)
24 |
25 | enum ins {
26 | INS_MOVE,
27 | INS_MUTATE,
28 | INS_IN,
29 | INS_OUT,
30 | INS_BRANCH,
31 | INS_JUMP,
32 | INS_HALT,
33 | INS_CLEAR,
34 | INS_ADD,
35 | INS_NOP
36 | };
37 |
38 | const char *
39 | instruction_name(enum ins ins)
40 | {
41 | static const char *const names[] = {
42 | "MOVE", "MUTATE", "IN", "OUT", "BRANCH",
43 | "JUMP", "HALT", "CLEAR", "ADD", "NOP"
44 | };
45 | return names[ins];
46 | }
47 |
48 | int
49 | instruction_arity(enum ins ins)
50 | {
51 | static const int arity[] = {1, 1, 0 ,0, 1, 1, 0, 0, 0};
52 | return arity[ins];
53 | }
54 |
55 | struct program {
56 | size_t max, count;
57 | struct {
58 | enum ins ins;
59 | long operand;
60 | } *ins;
61 | size_t markers_max, markers_count;
62 | long *markers;
63 | };
64 |
65 | #define PROGRAM_INIT {0, 0, NULL, 0, 0, NULL}
66 | #define PROGRAM (struct program){0}
67 |
68 | void program_mark(struct program *);
69 | long program_unmark(struct program *);
70 | void program_add(struct program *, enum ins, long);
71 | void program_free(struct program *);
72 | void program_parse(struct program *, FILE *);
73 | void program_optimize(struct program *, int level);
74 | void program_strip_nops(struct program *);
75 | void program_print(const struct program *, FILE *);
76 |
77 | void
78 | program_free(struct program *p)
79 | {
80 | free(p->ins);
81 | free(p->markers);
82 | }
83 |
84 | void
85 | program_add(struct program *p, enum ins ins, long operand)
86 | {
87 | if (p->count == p->max) {
88 | if (p->max == 0)
89 | p->max = 256;
90 | else
91 | p->max *= 2;
92 | size_t size = sizeof(p->ins[0]) * p->max;
93 | p->ins = realloc(p->ins, size);
94 | }
95 | switch (ins) {
96 | case INS_BRANCH:
97 | program_mark(p);
98 | break;
99 | case INS_JUMP: {
100 | long sibling = program_unmark(p);
101 | if (sibling < 0)
102 | FATAL("unmatched ']'");
103 | p->ins[sibling].operand = p->count + 1;
104 | operand = sibling;
105 | } break;
106 | case INS_MOVE:
107 | case INS_MUTATE:
108 | case INS_IN:
109 | case INS_OUT:
110 | case INS_HALT:
111 | case INS_CLEAR:
112 | case INS_ADD:
113 | case INS_NOP:
114 | /* Nothing */
115 | break;
116 | }
117 | p->ins[p->count].ins = ins;
118 | p->ins[p->count].operand = operand;
119 | p->count++;
120 | }
121 |
122 | void
123 | program_mark(struct program *p)
124 | {
125 | if (p->markers_count == p->markers_max) {
126 | if (p->markers_max == 0)
127 | p->markers_max = 16;
128 | else
129 | p->markers_max *= 2;
130 | size_t size = sizeof(p->markers[0]) * p->markers_max;
131 | p->markers = realloc(p->markers, size);
132 | }
133 | p->markers[p->markers_count++] = p->count;
134 | }
135 |
136 | long
137 | program_unmark(struct program *p)
138 | {
139 | if (p->markers_count > 0)
140 | return p->markers[--p->markers_count];
141 | else
142 | return -1;
143 | }
144 |
145 | void
146 | program_parse(struct program *p, FILE *in)
147 | {
148 | int c;
149 | while ((c = fgetc(in)) != EOF) {
150 | switch (c) {
151 | case '+':
152 | program_add(p, INS_MUTATE, 1);
153 | break;
154 | case '-':
155 | program_add(p, INS_MUTATE, -1);
156 | break;
157 | case '>':
158 | program_add(p, INS_MOVE, 1);
159 | break;
160 | case '<':
161 | program_add(p, INS_MOVE, -1);
162 | break;
163 | case '.':
164 | program_add(p, INS_OUT, 0);
165 | break;
166 | case ',':
167 | program_add(p, INS_IN, 0);
168 | break;
169 | case '[':
170 | program_add(p, INS_BRANCH, 0);
171 | break;
172 | case ']':
173 | program_add(p, INS_JUMP, 0);
174 | break;
175 | default:
176 | /* Nothing */
177 | break;
178 | }
179 | }
180 | if (p->markers_count > 0)
181 | FATAL("unmatched '['");
182 | program_add(p, INS_HALT, 0);
183 | }
184 |
185 | void
186 | program_strip_nops(struct program *p)
187 | {
188 | struct program copy = PROGRAM_INIT;
189 | for (size_t i = 0; i < p->count; i++)
190 | if (p->ins[i].ins != INS_NOP)
191 | program_add(©, p->ins[i].ins, p->ins[i].operand);
192 | program_free(p);
193 | *p = copy;
194 | }
195 |
196 | enum optype {OP_ANY, OP_CONSTANT, OP_STORE, OP_LOAD, OP_LOAD_NEG};
197 |
198 | struct pattern {
199 | enum ins ins;
200 | enum optype optype;
201 | long operand;
202 | };
203 |
204 | struct optimization {
205 | const char *name;
206 | struct pattern *sequence;
207 | struct pattern *replacement;
208 | };
209 |
210 | void
211 | optimize_replace(struct program *p, long i, struct optimization *o, long *vars)
212 | {
213 | for (long n = 0; o->sequence[n].ins != INS_NOP; n++) {
214 | p->ins[i + n].ins = o->replacement[n].ins;
215 | switch (o->replacement[n].optype) {
216 | case OP_CONSTANT:
217 | p->ins[i + n].operand = o->replacement[n].operand;
218 | break;
219 | case OP_LOAD:
220 | p->ins[i + n].operand = vars[o->replacement[n].operand];
221 | break;
222 | case OP_LOAD_NEG:
223 | p->ins[i + n].operand = -vars[o->replacement[n].operand];
224 | break;
225 | case OP_ANY:
226 | break;
227 | case OP_STORE:
228 | assert(!"invalid replacement");
229 | break;
230 | }
231 | }
232 | }
233 |
234 | long
235 | optimize_apply(struct program *p, struct optimization *o)
236 | {
237 | long count = 0;
238 | long variables[16] = {0};
239 | for (size_t i = 0; i < p->count; i++) {
240 | long length = 0;
241 | for (size_t n = 0;
242 | o->sequence[n].ins != INS_NOP && i + n < p->count;
243 | n++) {
244 | enum ins ins = p->ins[i + n].ins;
245 | long operand = p->ins[i + n].operand;
246 | if (ins != o->sequence[n].ins) {
247 | length = 0;
248 | break;
249 | }
250 | length++;
251 | enum optype o_type = o->sequence[n].optype;
252 | long o_operand = o->sequence[n].operand;
253 | switch (o_type) {
254 | case OP_CONSTANT:
255 | if (operand != o_operand)
256 | length = 0;
257 | break;
258 | case OP_STORE:
259 | variables[o_operand] = operand;
260 | break;
261 | case OP_LOAD:
262 | if (operand != variables[o_operand])
263 | length = 0;
264 | break;
265 | case OP_LOAD_NEG:
266 | if (operand != -variables[o_operand])
267 | length = 0;
268 | break;
269 | case OP_ANY:
270 | break;
271 | }
272 | if (length == 0)
273 | break;
274 | }
275 | if (length > 0) {
276 | optimize_replace(p, i, o, variables);
277 | i += length;
278 | count++;
279 | }
280 | }
281 | if (count > 0)
282 | program_strip_nops(p);
283 | return count;
284 | }
285 |
286 | /* [-] */
287 | struct optimization optimization_clear = {
288 | .name = "Cell clear",
289 | .sequence = (struct pattern []){
290 | {INS_BRANCH},
291 | {INS_MUTATE, OP_CONSTANT, -1},
292 | {INS_JUMP},
293 | {INS_NOP}
294 | },
295 | .replacement = (struct pattern []){
296 | {INS_CLEAR},
297 | {INS_NOP},
298 | {INS_NOP}
299 | }
300 | };
301 |
302 | /* [->+<] */
303 | struct optimization optimization_add = {
304 | .name = "Cell add",
305 | .sequence = (struct pattern []){
306 | {INS_BRANCH},
307 | {INS_MUTATE, OP_CONSTANT, -1},
308 | {INS_MOVE, OP_STORE, 0},
309 | {INS_MUTATE, OP_CONSTANT, 1},
310 | {INS_MOVE, OP_LOAD_NEG, 0},
311 | {INS_JUMP},
312 | {INS_NOP}
313 | },
314 | .replacement = (struct pattern []){
315 | {INS_ADD, OP_LOAD, 0},
316 | {INS_CLEAR},
317 | {INS_NOP},
318 | {INS_NOP},
319 | {INS_NOP},
320 | {INS_NOP}
321 | }
322 | };
323 |
324 | void
325 | program_compress(struct program *p)
326 | {
327 | for (size_t i = 0; i < p->count; i++) {
328 | if (p->ins[i].ins == INS_MOVE || p->ins[i].ins == INS_MUTATE) {
329 | size_t f = i + 1;
330 | while (p->ins[i].ins == p->ins[f].ins) {
331 | p->ins[f].ins = INS_NOP;
332 | p->ins[i].operand += p->ins[f].operand;
333 | f++;
334 | }
335 | if (p->ins[i].operand == 0)
336 | p->ins[i].ins = INS_NOP;
337 | }
338 | }
339 | program_strip_nops(p);
340 | }
341 |
342 | void
343 | program_optimize(struct program *p, int level)
344 | {
345 | if (level == 0)
346 | return;
347 | program_compress(p);
348 | long count = 0;
349 | do {
350 | count = 0;
351 | if (level >= 2)
352 | count += optimize_apply(p, &optimization_clear);
353 | if (level >= 3)
354 | count += optimize_apply(p, &optimization_add);
355 | } while (count > 0);
356 | }
357 |
358 | void
359 | program_print(const struct program *p, FILE *out)
360 | {
361 | for (size_t i = 0; i < p->count; i++) {
362 | long operand = p->ins[i].operand;
363 | enum ins ins = p->ins[i].ins;
364 | if (ins != INS_NOP) {
365 | fprintf(out, "%08ld ", i);
366 | if (instruction_arity(ins) == 1)
367 | fprintf(out, "%-12s%ld\n", instruction_name(ins), operand);
368 | else
369 | fprintf(out, "%s\n", instruction_name(ins));
370 | }
371 | }
372 | }
373 |
374 | void interpret(const struct program *, FILE *);
375 |
376 | void
377 | interpret(const struct program *program, FILE *trace)
378 | {
379 | long ip = 0;
380 | long dp = 0;
381 | uint8_t memory[MEMORY_SIZE] = {0};
382 | for (;;) {
383 | enum ins ins = program->ins[ip].ins;
384 | long operand = program->ins[ip].operand;
385 | if (trace != NULL && ins != INS_NOP) {
386 | const char *name = instruction_name(ins);
387 | fprintf(trace, "(%ld) %s %ld\n", ip, name, operand);
388 | }
389 | ip++;
390 | switch (ins) {
391 | case INS_MOVE:
392 | dp += operand;
393 | break;
394 | case INS_MUTATE:
395 | memory[dp] += operand;
396 | break;
397 | case INS_IN:
398 | memory[dp] = getchar();
399 | break;
400 | case INS_OUT:
401 | putchar(memory[dp]);
402 | break;
403 | case INS_JUMP:
404 | ip = operand;
405 | break;
406 | case INS_BRANCH:
407 | if (memory[dp] == 0)
408 | ip = operand;
409 | break;
410 | case INS_CLEAR:
411 | memory[dp] = 0;
412 | break;
413 | case INS_ADD:
414 | memory[dp + operand] += memory[dp];
415 | break;
416 | case INS_NOP:
417 | break;
418 | case INS_HALT:
419 | return;
420 | }
421 | }
422 | }
423 |
424 | struct asmbuf {
425 | size_t size, fill;
426 | uint8_t code[];
427 | };
428 |
429 | struct asmbuf *asmbuf_create(void);
430 | void asmbuf_free(struct asmbuf *);
431 | void asmbuf_finalize(struct asmbuf *);
432 | void asmbuf_ins(struct asmbuf *, int, uint64_t);
433 | void asmbuf_immediate(struct asmbuf *, int, const void *);
434 | void asmbuf_syscall(struct asmbuf *, int);
435 |
436 | struct asmbuf *
437 | asmbuf_create(void)
438 | {
439 | int prot = PROT_READ | PROT_WRITE;
440 | int flags = MAP_ANONYMOUS | MAP_PRIVATE;
441 | size_t size = 1<<28; // TODO: grow as needed?
442 | struct asmbuf *buf = mmap(NULL, size, prot, flags, -1, 0);
443 | buf->size = size;
444 | return buf;
445 | }
446 |
447 | void
448 | asmbuf_free(struct asmbuf *buf)
449 | {
450 | munmap(buf, buf->size);
451 | }
452 |
453 | void
454 | asmbuf_finalize(struct asmbuf *buf)
455 | {
456 | mprotect(buf, buf->size, PROT_READ | PROT_EXEC);
457 | }
458 |
459 | void
460 | asmbuf_ins(struct asmbuf *buf, int size, uint64_t ins)
461 | {
462 | for (int i = size - 1; i >= 0; i--)
463 | buf->code[buf->fill++] = (ins >> (i * 8)) & 0xff;
464 | }
465 |
466 | void
467 | asmbuf_immediate(struct asmbuf *buf, int size, const void *value)
468 | {
469 | memcpy(buf->code + buf->fill, value, size);
470 | buf->fill += size;
471 | }
472 |
473 | void
474 | asmbuf_syscall(struct asmbuf *buf, int syscall)
475 | {
476 | if (syscall == 0) {
477 | asmbuf_ins(buf, 2, 0x31C0); // xor eax, eax
478 | } else if (syscall == 1) {
479 | asmbuf_ins(buf, 3, 0x4C89E0); // mov rax, r12
480 | } else {
481 | asmbuf_ins(buf, 1, 0xB8); // mov rax, syscall
482 | uint32_t n = syscall;
483 | asmbuf_immediate(buf, 4, &n);
484 | }
485 | asmbuf_ins(buf, 2, 0x0F05); // syscall
486 | }
487 |
488 | enum mode {
489 | MODE_OPEN, MODE_FUNCTION, MODE_STANDALONE
490 | };
491 |
492 | struct asmbuf *compile(const struct program *, enum mode);
493 |
494 | struct asmbuf *
495 | compile(const struct program *program, enum mode mode)
496 | {
497 | uint32_t memory_size = MEMORY_SIZE;
498 | struct asmbuf *buf = asmbuf_create();
499 |
500 | /* Clear zero register */
501 | if (mode == MODE_FUNCTION) {
502 | asmbuf_ins(buf, 1, 0x53); // push rbx
503 | asmbuf_ins(buf, 2, 0x4154); // push r12
504 | }
505 | asmbuf_ins(buf, 2, 0x31dB); // xor ebx, ebx
506 | asmbuf_ins(buf, 6, 0x41BC01000000); // mov r12, 1
507 |
508 | /* Allocate BF array on stack */
509 | asmbuf_ins(buf, 3, 0x4881EC); // sub rsp, X
510 | asmbuf_immediate(buf, 4, &memory_size);
511 | asmbuf_ins(buf, 3, 0x4889E6); // mov rsi, rsp
512 | asmbuf_ins(buf, 5, 0xBA01000000); // mov edx, 0x1
513 |
514 | /* Clear BF array */
515 | asmbuf_ins(buf, 2, 0x30C0); // xor al, al
516 | asmbuf_ins(buf, 3, 0x4889E7); // mov rdi, rsp
517 | asmbuf_ins(buf, 1, 0xB9); // mov rcx, X
518 | asmbuf_immediate(buf, 4, &memory_size);
519 | asmbuf_ins(buf, 2, 0xF3AA); // rep stosb
520 |
521 | /* rsi - data pointer
522 | * rdi - syscall argument
523 | * rax - temp
524 | * rbx - zero register
525 | * r12 - one register
526 | */
527 | uint32_t *table = malloc(sizeof(table[0]) * program->count);
528 | for (size_t i = 0; i < program->count; i++) {
529 | enum ins ins = program->ins[i].ins;
530 | long operand = program->ins[i].operand;
531 | table[i] = buf->fill;
532 | switch (ins) {
533 | case INS_MOVE:
534 | if (operand >= -128 && operand <= 127) {
535 | asmbuf_ins(buf, 3, 0x4883C6); // add rsi, byte X
536 | asmbuf_immediate(buf, 1, &operand);
537 | } else {
538 | asmbuf_ins(buf, 3, 0x4881C6); // add rsi, X
539 | asmbuf_immediate(buf, 4, &operand);
540 | }
541 | break;
542 | case INS_MUTATE:
543 | asmbuf_ins(buf, 2, 0x8006); // add byte [rsi], X
544 | asmbuf_immediate(buf, 1, &operand);
545 | break;
546 | case INS_CLEAR:
547 | asmbuf_ins(buf, 2, 0x881e); // mov [rsi], bl
548 | break;
549 | case INS_IN:
550 | asmbuf_ins(buf, 3, 0x4831FF); // xor rdi, rdi
551 | asmbuf_syscall(buf, SYS_read);
552 | break;
553 | case INS_OUT:
554 | asmbuf_ins(buf, 3, 0x4C89E7); // mov rdi, r12
555 | asmbuf_syscall(buf, SYS_write);
556 | break;
557 | case INS_BRANCH: {
558 | uint32_t delta = 0;
559 | asmbuf_ins(buf, 2, 0x381E); // cmp [rsi], bl
560 | asmbuf_ins(buf, 2, 0x0F84); // jz
561 | asmbuf_immediate(buf, 4, &delta); // patched by JUMP ']'
562 | } break;
563 | case INS_JUMP: {
564 | uint32_t delta = table[operand];
565 | delta -= buf->fill + 5;
566 | asmbuf_ins(buf, 1, 0xE9); // jmp delta
567 | asmbuf_immediate(buf, 4, &delta);
568 | void *jz = &buf->code[table[operand] + 4];
569 | uint32_t patch = buf->fill - table[operand] - 8;
570 | memcpy(jz, &patch, 4); // patch previous branch '['
571 | } break;
572 | case INS_ADD: {
573 | asmbuf_ins(buf, 2, 0x8A06); // mov al, [rsi]
574 | uint32_t delta = operand;
575 | if (operand >= -128 && operand < 127) {
576 | asmbuf_ins(buf, 2, 0x0046); // add [rsi+delta], al
577 | asmbuf_immediate(buf, 1, &delta);
578 | } else {
579 | asmbuf_ins(buf, 2, 0x0086); // add [rsi+delta], al
580 | asmbuf_immediate(buf, 4, &delta);
581 | }
582 | } break;
583 | case INS_HALT:
584 | if (mode == MODE_FUNCTION) {
585 | asmbuf_ins(buf, 3, 0x4881C4); // add rsp, X
586 | asmbuf_immediate(buf, 4, &memory_size);
587 | asmbuf_ins(buf, 2, 0x415C); // pop r12
588 | asmbuf_ins(buf, 1, 0x5B); // pop rbx
589 | asmbuf_ins(buf, 1, 0xC3); // ret
590 | } else if (mode == MODE_STANDALONE) {
591 | asmbuf_ins(buf, 3, 0x4831FF); // xor rdi, rdi
592 | asmbuf_syscall(buf, SYS_exit);
593 | }
594 | break;
595 | case INS_NOP:
596 | break;
597 | }
598 | }
599 | free(table);
600 |
601 | asmbuf_finalize(buf);
602 | return buf;
603 | }
604 |
605 | void
606 | elf_write(struct asmbuf *buf, FILE *elf)
607 | {
608 | uint64_t entry = 0x400000 + sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr);
609 | Elf64_Ehdr ehdr = {
610 | .e_ident = {
611 | ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3,
612 | ELFCLASS64,
613 | ELFDATA2LSB,
614 | EV_CURRENT,
615 | ELFOSABI_SYSV,
616 | },
617 | .e_type = ET_EXEC,
618 | .e_machine = EM_X86_64,
619 | .e_version = EV_CURRENT,
620 | .e_entry = entry,
621 | .e_phoff = sizeof(Elf64_Ehdr),
622 | .e_ehsize = sizeof(Elf64_Ehdr),
623 | .e_phentsize = sizeof(Elf64_Phdr),
624 | .e_phnum = 1,
625 | };
626 | Elf64_Phdr phdr = {
627 | .p_type = PT_LOAD,
628 | .p_flags = PF_X | PF_R,
629 | .p_offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr),
630 | .p_vaddr = entry,
631 | .p_filesz = buf->fill,
632 | .p_memsz = buf->fill,
633 | .p_align = 0,
634 | };
635 |
636 | fwrite(&ehdr, sizeof(ehdr), 1, elf);
637 | fwrite(&phdr, sizeof(phdr), 1, elf);
638 | fwrite(buf->code, buf->fill, 1, elf);
639 | }
640 |
641 | void
642 | print_help(const char *argv0, FILE *o)
643 | {
644 | fprintf(o, "Usage: %s [-o ] [-i] [-e] [-h] [-O ]\n", argv0);
645 | fprintf(o, " -o executable output file name\n");
646 | fprintf(o, " -O optimization level\n");
647 | fprintf(o, " -e no output file, execute program\n");
648 | fprintf(o, " -i no output file, interpret program (slow)\n");
649 | fprintf(o, " -h print this usage information\n");
650 | fprintf(o, " -D debugging listing\n");
651 | }
652 |
653 | int
654 | main(int argc, char **argv)
655 | {
656 | /* Options */
657 | program_name = argv[0];
658 | char *output = NULL;
659 | char *input = NULL;
660 | bool do_exec = false;
661 | bool do_interpret = false;
662 | bool do_debug = false;
663 | int optimize = 3;
664 |
665 | /* Parse arguments */
666 | int option;
667 | while ((option = getopt(argc, argv, "o:eiDhO:")) != -1) {
668 | switch (option) {
669 | case 'o':
670 | output = optarg;
671 | break;
672 | case 'O':
673 | optimize = atoi(optarg);
674 | break;
675 | case 'e':
676 | do_exec = true;
677 | break;
678 | case 'i':
679 | do_interpret = true;
680 | break;
681 | case 'D':
682 | do_debug = true;
683 | break;
684 | case 'h':
685 | print_help(argv[0], stdout);
686 | break;
687 | default:
688 | print_help(argv[0], stderr);
689 | FATAL("invalid option");
690 | }
691 | }
692 | if (optind >= argc)
693 | FATAL("no input files");
694 | else if (optind != argc - 1)
695 | FATAL("too many input files");
696 | input = argv[optind];
697 |
698 | char output_buf[1024];
699 | if (!do_interpret && !do_exec && output == NULL) {
700 | snprintf(output_buf, sizeof(output_buf), "%s", input);
701 | output = output_buf;
702 | char *p = output + strlen(output);
703 | while (*p != '.' && p >= output)
704 | p--;
705 | if (p < output)
706 | FATAL("no output file specified");
707 | else
708 | *p = '\0';
709 | }
710 |
711 | struct program program = PROGRAM_INIT;
712 | FILE *source = fopen(argv[optind], "r");
713 | if (source == NULL)
714 | FATAL("could not open input file");
715 | program_parse(&program, source);
716 | program_optimize(&program, optimize);
717 | fclose(source);
718 |
719 | if (do_debug)
720 | program_print(&program, stderr);
721 |
722 | if (do_interpret) {
723 | interpret(&program, do_debug ? stderr : NULL);
724 | } else if (do_exec) {
725 | struct asmbuf *buf = compile(&program, MODE_FUNCTION);
726 | void (*run)(void) = (void *)buf->code;
727 | run();
728 | asmbuf_free(buf);
729 | } else {
730 | struct asmbuf *buf = compile(&program, MODE_STANDALONE);
731 | FILE *elf = fopen(output, "wb");
732 | if (elf == NULL)
733 | FATAL("could not open output file");
734 | elf_write(buf, elf);
735 | fchmod(fileno(elf), 0755);
736 | fclose(elf);
737 | asmbuf_free(buf);
738 | }
739 |
740 | program_free(&program);
741 | return 0;
742 | }
743 |
--------------------------------------------------------------------------------
/samples/fib.bf:
--------------------------------------------------------------------------------
1 | >++++++++++>+>+[
2 | [+++++[>++++++++<-]>.<++++++[>--------<-]+<<<]>.>>[
3 | [-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-
4 | [>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>>
5 | ]<<<
6 | ]
7 | This program doesn't terminate; you will have to kill it.
8 | Daniel B Cristofani (cristofdathevanetdotcom)
9 | http://www.hevanet.com/cristofd/brainfuck/
10 |
--------------------------------------------------------------------------------
/samples/hanoi.bf:
--------------------------------------------------------------------------------
1 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3 | >>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>>>>>>>>>
4 | >>>>>>>>>>>>>>>>>>>>>>>>>[-]>[-]+++++++++++++++++++++++++++.++++++++++++++++
5 | ++++++++++++++++++++++++++++++++++++++++++++++++.-------------------.-------
6 | --------------------------------------.+++++++++++++++++++++++++++++++++++++
7 | +++++++++++++++++++++++++++.-----------------------------------------.++++++
8 | ++++++++++++++++++.[-]+++++++++++++++++++++++++++.++++++++++++++++++++++++++
9 | ++++++++++++++++++++++++++++++++++++++.-------------------------------------
10 | ----.+++++++++.---------.+++++.+++++++++++++++++.++++++++++++.++++++++++++++
11 | +++++++++++++.++++++++.------------------.+++++++++++++.+.------------------
12 | -----------------------------------------------------------------.++++++++++
13 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------
14 | ---.----------------------------------------------------------------------.+
15 | +++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++.++++++++++
16 | +++.+.------.---------------------------------------------------------------
17 | ----------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 | ++++++++.+++++.-------------------------------------------------------------
19 | -----------------.++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++
20 | +++++++++++++++++++++++++.-----------------.++++++++.+++++.--------.--------
21 | ----------------------------------------------------.+++++++++++++++++++++++
22 | ++++++++++++++++++++++++++++++++++.++++++++.[-]+++++++++++++++++++++++++++.+
23 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------------
24 | ----------------------------.++++++++.----------.++++.+++++++++++++++++++.++
25 | +++++++++++++.+++++++++++++++++++++++++++.---------.+++++++++++..-----------
26 | ----.+++++++++.-------------------------------------------------------------
27 | -----------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28 | ++++++++.+++++++++++++++++++++++.-------------------------------------------
29 | ----------------------------------------------.+++++++++++++++++++++++++++++
30 | ++++++.+++++++++++++++++++++++++++++++++++++++++.---.---..+++++++++.+++.----
31 | ----------.-----------------------------------------------------------------
32 | ---.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++
33 | ++++++++.---.------.--------------------------------------------------------
34 | --------------.++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++++
35 | ++++++++++++.++++++++++++..----.--------------------------------------------
36 | ----------.-----------..++++++++++++++++++++++++++++++++++++++++++++++++++++
37 | ++++++++++++++++++++...-----------------------------------------------------
38 | --------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++.+
39 | ++++++++.---.---..+++++++++.+++.--------------.-----------------------------
40 | -------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++
41 | +.+++++++++++++++++++.------------------------------------------------------
42 | ---------------.+++++++++++++++++++++++++++++++++++++++++++++++++++.++++.---
43 | .+++++++++++++.+++++.-------------------------------------------------------
44 | ---------------.+++++++++++++++.[-]>[-]+++++++++>[-]+++>>[-]>[-]<<<<<[->>>>>
45 | +<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<
46 | <+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]
47 | >>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-
48 | <<+>>]<<<[-]+>>>][-]<[->+<]>[[-<+>]<<<[-]+>>>]<<<[>[-]++++++++++++++++++++++
49 | +++++++++++++++++++++++>[-]<<<<<[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<+++++++++
50 | ++++++++++++++++++++++++++++++++++>]<<<[>>>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<<
51 | ->>>][-]++++++++++++++++>[-]++++++++++++++>>>>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<
52 | <<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[
53 | [-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+
54 | <<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>
55 | >[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<<+++++>>>>]>[-]>[-
56 | ]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]+<<[-]+>>
57 | >[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<
58 | ]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<
59 | [-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<
60 | [[-]<<<++++++++++>>>][-]>[-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>>>[-<+<<<<<<<+
61 | >>>>>>>>][-]+++++++++++++++++++++++++<<<[-]>>[>>[-]<[->+<]>[-<+<<<+>>>>]<<-]
62 | [-]<<[->>+<<]>>[-<<+<<+>>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>>>[-<<<<<<<
63 | <+>>>>->>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>>>[-<<<<<<<<+>>>>->>>>]>[-]
64 | >[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]++<<[-
65 | ]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+
66 | >>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>
67 | >]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>
68 | ]<<<[[-]<<<<----->>>>][-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<<<<<<<<<
69 | +>>>>>>->>>][-]+++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++
70 | +++++++++++++++++++++++++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>
71 | >>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[
72 | -]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->
73 | >>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<
74 | +>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]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<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>
89 | [[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<
90 | <<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>
91 | >+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->
92 | [-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]
93 | +>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[
94 | -<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<
95 | <<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>
96 | >>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<
97 | <<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[-
98 | >>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<+++
99 | +++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++
100 | +++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<
101 | ]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++
102 | +++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.
103 | >>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]
104 | <<]<<<<<<--------------------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>
105 | >>[-<+<<<<<+>>>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++
106 | +++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<
107 | +>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+
108 | <<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]
109 | >>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>
110 | >>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>
111 | >>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[
112 | -]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>
113 | >[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]
114 | >>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<
115 | +<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->
116 | >>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>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>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>
131 | [-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]
132 | <]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>
133 | [-]+<[[-<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++
134 | +++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++++++++
135 | +++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++
136 | +++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++++++
137 | +++++++++++++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++
138 | ++++++++.>>>>>>]<<]<<<<<<+++++++++++++.>[-]>[-]<<<<<<<[->>>>>>>+<<<<<<<]>>>>
139 | >>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++++++++++++++++++++++
140 | +++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+
141 | >>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>
142 | >[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<
143 | +>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]++++++++++++++++++
144 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
145 | ++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<[-]<<<<<<<<[->>>>>>>>+<<<
146 | <<<<<]>>>>>>[-]>>[-<<<<<<<<+>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..
147 | >>>-]<<<.>>>>>[-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>>>>[-]>>[-<<<<<<<<+>>>>>>+>>
148 | ][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]>>>[-]>[-]<<<<<<<[->>>>>>>+<<<<<
149 | <<]>>>>>>>[-<+<<<<<<+>>>>>>>][-]++++++++++++++++++++++++++++++++++++++++++++
150 | ++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>
151 | [[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>
152 | +<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]
153 | >>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]+++++++++++
154 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
155 | +++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<<<<<<<<]>>>[-]<<<<
156 | <[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<<<<<<<[-]<[-]<[-]>>>>>>>>>>[-]<<<<<[->>>
157 | >>+<<<<<]>>>>>[-<<<<<+<<<+>>>>>>>>][-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
158 | <<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<
159 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
160 | >>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>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<<<<<<<<<+>>>>>
446 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
447 | >>>>>>>>>>>>>+>>>]<]<[->>>>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]>>[-]<<
448 | <<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>[-]>>>>
449 | >[-<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>+>>>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>
450 | >[-]>>>>[-<<<<<<<<+>>>>+>>>>]<<<[-]++++++++++++++++++++++++++++++++>>-<]>[[-
451 | ]>[-]<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<]>>>>>>>>>>>[-]>>>>>
452 | [-<<<<<<<<<<<<<<<<+>>>>>>>>>>>+>>>>>][-]<<<<<<<[->>>>>>>+<<<<<<<]>>>[-]>>>>[
453 | -<<<<<<<+>>>+>>>>]<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++
454 | ++++++++++++++++++++++++++++++++++++>>]<[-]++++++++++++++++>[-]+++++++++++++
455 | +>>>>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][
456 | -]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]
457 | <<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-
458 | <<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<
459 | [-]>>>]<<<[[-]<<<<+++++>>>>]>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>
460 | [-<+<<<<<<<<+>>>>>>>>>][-]+<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<
461 | <[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>
462 | >]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]
463 | >>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[[-]<<<++++++++++>>>][-]>[-]<<<<<<<<[->>>
464 | >>>>>+<<<<<<<<]>>>>>>>>[-<+<<<<<<<+>>>>>>>>][-]+++++++++++++++++++++++++<<<[
465 | -]>>[>>[-]<[->+<]>[-<+<<<+>>>>]<<-][-]<<[->>+<<]>>[-<<+<<+>>>>][-]<<<<<<<<<<
466 | <[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>[-<<<<<<<<<<<+>>>>>>>->>>>][-]<<<<<<<<
467 | <<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>>>[-<<<<<<<<<<<+>>>>>>>->>>>]>[-]>[-]<
468 | <<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][-]++<<[-]+>>>
469 | [-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]
470 | <[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[
471 | -]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<<[
472 | [-]<<<<----->>>>][-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<<<<<<+>>>->>>][-]++++++++
473 | +++++++++++++++++++.++++++++++++++++++++++++++++++++++++++++++++++++++++++++
474 | ++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>]>>>[-]>[-]<<<<<[->>>
475 | >>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>
476 | +>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<
477 | [-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]
478 | >>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<
479 | <]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>
480 | [-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[
481 | -]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<
482 | ]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<
483 | <+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<
484 | <<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<
485 | <[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+
486 | <<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>
487 | >>]>[-]<<<[->>>+<<<]>>>[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[[-<<<<+>>>>]>[-
501 | ]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]
502 | <[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<++++++++++++++++++++++++++
503 | ++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.<++
504 | ++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<
505 | <<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++++++++++++++++++++++++++++++
506 | ++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++
507 | +++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<--------------
508 | ------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<+<<<<<+>>>>>>]>>>[
509 | -]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->
510 | >+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]
511 | >>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>
512 | [-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+>
513 | ]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[->
514 | >>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-
515 | ]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<
516 | <+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[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]
530 | <<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<
531 | ]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[-<<<->>
532 | >]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>
533 | >>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-
534 | ]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>
535 | [[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>
536 | >[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<++++++++++
537 | ++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++
538 | ++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>
539 | [-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++++++++++++++
540 | ++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-
541 | <]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<
542 | <<+++++++++++++.>[-]>[-]<<<<<<<[->>>>>>>+<<<<<<<]>>>>>>>[-<+<<<<<<+>>>>>>>][
543 | -]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
544 | ++++++++++++++<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>
545 | >[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>
546 | >+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<
547 | ]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[-]+++++++++++++++++++++++++++++++++++++++++
548 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
549 | +++.<-<]>[[-]<<<<<<.>>>>>>]<[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>
550 | >[-]>>[-<<<<<<<<<<<+>>>>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]
551 | <<<.>>>>>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<<<<]>>>>>>>>>[-]>>[-<<<<<<<<<<<
552 | +>>>>>>>>>+>>][-]<<[->>+<<]>>[[-<<+>>]<<->>]<<[<<<..>>>-]>>>[-]>[-]<<<<<<<[-
553 | >>>>>>>+<<<<<<<]>>>>>>>[-<+<<<<<<+>>>>>>>][-]+++++++++++++++++++++++++++++++
554 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<[-]+>>>[-]>[-]<<<
555 | [->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-
556 | ]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]
557 | [-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<[->+<]>[[-<+>]<<<[-]>>>]<<[-]+<[[-]>>[
558 | -]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
559 | ++++++++++++++++++++++++++++++++++++++++++++++.<-<]>[[-]<<<<<<.>>>>>>]<<<<<<
560 | <<<]>[-]++++++++++.[-]+>[-]+>[-]+++++++++++++++++++++++++++.++++++++++++++++
561 | ++++++++++++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<<[->>>+<<<]>>>[-<
562 | +<<+>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<
563 | [>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<
564 | <<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[
565 | -<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[
566 | ->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]
567 | >[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<
568 | <[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+
569 | <<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>
570 | >>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]
571 | <[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>
572 | ][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>
573 | >>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<
574 | <<[->>>>+<<<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-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>
588 | >>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-
589 | ]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>
590 | ]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++
591 | ++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>
592 | >>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++
593 | ++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++
594 | ++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>
595 | >>>>]<<]<<<<<<--------------------------------.>[-]>[-]<<<<[->>>>+<<<<]>>>>[
596 | -<+<<<+>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[
597 | -]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>
598 | [-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>
599 | >>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[
600 | -]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<
601 | <[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>
602 | [-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-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<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<
617 | [<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+
618 | >>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+
619 | >>>>>]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++
620 | ++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>
621 | [[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<
622 | [->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]
623 | +>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[
624 | -<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++
625 | ++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++
626 | ++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++
627 | ++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++
628 | ++++++++.>>>>>>-<]>[[-]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++
629 | +.>>>>>>]<<]<<<<<<+++++++++++++.<<[-]+++++++++++++++++++++++++++++++++++++++
630 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
631 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
632 | +++++++++[>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
633 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
634 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[>[-]+++++++++
635 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
636 | +++++++++++++++[-]<-]<-]<<<<<]<<<<+>>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<
637 | <<+>>>>>][-]++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>
638 | >>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->
639 | >>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]+>>>][-]<[->
640 | +<]>[[-<+>]<<<[-]+>>>]<<<]<<->>[-]<<[->>+<<]>>[[-<<+>>]<<<<<<<<-<<<<<<<<<<<<
641 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
642 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
643 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]<[-]<[-]>>>>>>>>>>>>>>>>>>>>>>>>>
644 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
645 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
646 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>>>>>>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>
647 | >>>>>>>>[-<<<<<<<<<+<<<<<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
699 | >+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-
700 | ]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<
701 | [->+<]>[[-<+>]<<<[-]+>>>]<<<]>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<<
702 | <<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[
703 | -<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<
704 | <<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[->+<]>[[-<
705 | +>]<<<[-]+>>>]<<<[<<<<<<<<--->+>>>>>>>>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>
706 | +<<<<<<<<<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+
707 | <<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<
708 | <<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[-
709 | >+<]>[[-<+>]<<<[-]+>>>]<<<]<<<<+>>>]<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
710 |
--------------------------------------------------------------------------------
/samples/hello.bf:
--------------------------------------------------------------------------------
1 | [ This program prints "Hello World!" and a newline to the screen, its
2 | length is 106 active command characters [it is not the shortest.]
3 |
4 | This loop is a "comment loop", it's a simple way of adding a comment
5 | to a BF program such that you don't have to worry about any command
6 | characters. Any ".", ",", "+", "-", "<" and ">" characters are simply
7 | ignored, the "[" and "]" characters just have to be balanced.
8 | ]
9 | +++++ +++ Set Cell #0 to 8
10 | [
11 | >++++ Add 4 to Cell #1; this will always set Cell #1 to 4
12 | [ as the cell will be cleared by the loop
13 | >++ Add 2 to Cell #2
14 | >+++ Add 3 to Cell #3
15 | >+++ Add 3 to Cell #4
16 | >+ Add 1 to Cell #5
17 | <<<<- Decrement the loop counter in Cell #1
18 | ] Loop till Cell #1 is zero; number of iterations is 4
19 | >+ Add 1 to Cell #2
20 | >+ Add 1 to Cell #3
21 | >- Subtract 1 from Cell #4
22 | >>+ Add 1 to Cell #6
23 | [<] Move back to the first zero cell you find; this will
24 | be Cell #1 which was cleared by the previous loop
25 | <- Decrement the loop Counter in Cell #0
26 | ] Loop till Cell #0 is zero; number of iterations is 8
27 |
28 | The result of this is:
29 | Cell No : 0 1 2 3 4 5 6
30 | Contents: 0 0 72 104 88 32 8
31 | Pointer : ^
32 |
33 | >>. Cell #2 has value 72 which is 'H'
34 | >---. Subtract 3 from Cell #3 to get 101 which is 'e'
35 | +++++++..+++. Likewise for 'llo' from Cell #3
36 | >>. Cell #5 is 32 for the space
37 | <-. Subtract 1 from Cell #4 for 87 to give a 'W'
38 | <. Cell #3 was set to 'o' from the end of 'Hello'
39 | +++.------.--------. Cell #3 for 'rl' and 'd'
40 | >>+. Add 1 to Cell #5 gives us an exclamation point
41 | >++. And finally a newline from Cell #6
42 |
--------------------------------------------------------------------------------
/samples/mandelbrot.bf:
--------------------------------------------------------------------------------
1 | A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
2 | +++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
3 | >>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
4 | <<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>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>>>>>
143 | >>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
144 | +[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
145 | <<<<<]]>>>]
146 |
--------------------------------------------------------------------------------
/samples/wc.bf:
--------------------------------------------------------------------------------
1 | >>>+>>>>>+>>+>>+[<<],[
2 | -[-[-[-[-[-[-[-[<+>-[>+<-[>-<-[-[-[<++[<++++++>-]<
3 | [>>[-<]<[>]<-]>>[<+>-[<->[-]]]]]]]]]]]]]]]]
4 | <[-<<[-]+>]<<[>>>>>>+<<<<<<-]>[>]>>>>>>>+>[
5 | <+[
6 | >+++++++++<-[>-<-]++>[<+++++++>-[<->-]+[+>>>>>>]]
7 | <[>+<-]>[>>>>>++>[-]]+<
8 | ]>[-<<<<<<]>>>>
9 | ],
10 | ]+<++>>>[[+++++>>>>>>]<+>+[[<++++++++>-]<.<<<<<]>>>>>>>>]
11 | [Counts lines, words, bytes. Assumes no-change-on-EOF or EOF->0.
12 | Daniel B Cristofani (cristofdathevanetdotcom)
13 | http://www.hevanet.com/cristofd/brainfuck/]
14 |
--------------------------------------------------------------------------------