aboutsummaryrefslogtreecommitdiff
path: root/README
blob: b627bfd6262e9ab4d42d5559714342a02e86b0d7 (plain)
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
./brainfuck: Brainfuck programming language interpreter
See <http://en.wikipedia.org/wiki/Brainfuck> for more details

Usage: ./brainfuck [options] [file]

Size of each data cell is 4 byte(s)
All data cells are zeros initially

Options (defaults are in brackets):
   -s num         stack size (128)
   -d num         data size (30000)
   -t             trace execution for debug

Formats for operators '.' and ',' (output and input):
   -c, -i, -u, -o, -x  char, signed int, unsigned int, octal, hexadecimal
                       octal number must be prepended by '0' (zero),
                       and hexadecimal - by '0x'
Default i/o format -u

   -h             this help message

  file            file to execute,
                  if omitted read stdin

Standard operators: <>+-[].,
Extensions:
            ciuox - change i/o format (same as -c & others above)
            ;     - end of code (useful when reading stdin)
            #     - comment to the end of line (useful when reading files)

Example:
 echo '+++[.-]' | ./brainfuck # count down from 3 to 1
 echo ',+++.;5' | ./brainfuck # shows 8
 echo ',>,<[->+<]>.;4 5' | ./brainfuck # shows 4+5=9
 echo 'c,u.;h' | ./brainfuck # shows 104 (ASCII code for 'h')