├── .gitignore ├── LICENSE ├── README.md ├── bf.py ├── examples ├── 99bottles.b ├── bench.b ├── bottles.b ├── hanoi.b ├── hello.b ├── mandel.b └── test.b ├── hello.bf ├── resources ├── README.md ├── bff4.c └── brainfucc.c └── step_by_step ├── 0.py ├── 1.py ├── 2.py ├── 3.py └── 4.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # vim 7 | *.sw[po] 8 | 9 | # Packages 10 | *.egg 11 | *.egg-info 12 | dist 13 | build 14 | eggs 15 | parts 16 | bin 17 | var 18 | sdist 19 | develop-eggs 20 | .installed.cfg 21 | lib 22 | lib64 23 | 24 | # Installer logs 25 | pip-log.txt 26 | 27 | # Unit test / coverage reports 28 | .coverage 29 | .tox 30 | nosetests.xml 31 | 32 | # Translations 33 | *.mo 34 | 35 | # Mr Developer 36 | .mr.developer.cfg 37 | .project 38 | .pydevproject 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A very (!) fast BrainFuck interpreter in Python 2 | =============================================== 3 | 4 | Here is a BrainFuck example: 5 | 6 | ```bf 7 | +++++ +++++ initialize counter (cell #0) to 10 8 | [ use loop to set the next four cells to 70/100/30/10 9 | > +++++ ++ add 7 to cell #1 10 | > +++++ +++++ add 10 to cell #2 11 | > +++ add 3 to cell #3 12 | > + add 1 to cell #4 13 | <<<< - decrement counter (cell #0) 14 | ] 15 | > ++ . print 'H' 16 | > + . print 'e' 17 | +++++ ++ . print 'l' 18 | . print 'l' 19 | +++ . print 'o' 20 | > ++ . print ' ' 21 | << +++++ +++++ +++++ . print 'W' 22 | > . print 'o' 23 | +++ . print 'r' 24 | ----- - . print 'l' 25 | ----- --- . print 'd' 26 | > + . print '!' 27 | > . print '\n' 28 | ``` 29 | 30 | How to use the interpreter: 31 | 32 | ```bash 33 | python2 ./bf.py hello.bf 34 | Hello World! 35 | ``` 36 | 37 | ## Speeding things up 38 | 39 | ### With Pypy 40 | 41 | If you try to run a long BrainFuck program like `mandel.b`, you will realize our interpreter is pretty slow. 42 | 43 | ```bash 44 | python2 ./bf.py examples/mandel.b 45 | # wait 1h45 46 | ``` 47 | 48 | A first simple way of speeding things up is to use Pypy instead of CPython. 49 | 50 | ```bash 51 | PYPY_VERSION="pypy2.7-v7.3.9" 52 | wget "https://downloads.python.org/pypy/${PYPY_VERSION}-linux64.tar.bz2" 53 | tar -xjf "${PYPY_VERSION}-linux64.tar.bz2" 54 | mv "${PYPY_VERSION}-linux64" pypy 55 | # Only 1m30 now! 56 | ./pypy/bin/pypy ./bf.py ./examples/mandel.b 57 | ``` 58 | 59 | ### With a JIT 60 | 61 | The interpreter is actually written in RPython, so it can be statically compiled using the Pypy toolchain. 62 | Download the latest source of Pypy and uncompress it in a `pypy-src` folder. Note that you could also install `rpython` from PyPI. 63 | 64 | ```bash 65 | wget "https://downloads.python.org/pypy/${PYPY_VERSION}-src.tar.bz2" 66 | tar -xjf "${PYPY_VERSION}-src.tar.bz2" 67 | mv "${PYPY_VERSION}-src" pypy-src 68 | ``` 69 | 70 | Then you can build from the Python script `bf.py` an executable binary `bf-c`: 71 | 72 | ```bash 73 | # The compilation will take about 20s 74 | python2 pypy-src/rpython/bin/rpython bf.py 75 | # Mandelbrot now completes in 32s 76 | ./bf-c examples/mandel.b 77 | ``` 78 | 79 | You can rebuild the `bf-c` using `--opt=jit` to add a JIT to your BrainFuck interpreter: 80 | 81 | ```bash 82 | # The compilation will take about 7m (you can speed this up by using Pypy) 83 | python2 pypy-src/rpython/bin/rpython --opt=jit bf.py 84 | # Mandelbrot now completes in about 5 seconds(!) 85 | ./bf-c examples/mandel.b 86 | ``` 87 | 88 | ### Let's compare with a C implementation 89 | 90 | I also looked for a [fast BrainFuck interpreter](http://mazonka.com/brainf/), written in C. After compilation with `gcc -O3` (6.2), running `mandel.b` take about 5 seconds to run, so it is in the same order of magnitude as the JIT version (without `-O3`, it takes 10 seconds). 91 | 92 | ```bash 93 | gcc -O3 ./resources/bff4.c -o bff4 94 | # About 5s 95 | ./bff4 < examples/mandel.b 96 | ``` 97 | 98 | ### Let's compile the BrainFuck directly 99 | 100 | To complete those numbers, I finally tested a [Brainfuck to C translator](https://gist.github.com/Ricket/939687), then compiled the C version of the `mandel.b` program. With `-O3`, the compiled `mandel.b` runs in a bit less than 1 second (without `-O3`, it takes 15 seconds). 101 | 102 | ```bash 103 | gcc resources/brainfucc.c -o brainfucc 104 | ./brainfucc < examples/mandel.b > mandel.c 105 | gcc -O3 mandel.c -o mandel 106 | # 950ms 107 | ./mandel 108 | ``` 109 | 110 | ### Summary 111 | 112 | Here is a summary of the speed gain I could observe on Ubuntu 16.10 (core i7, 8Go of RAM), running `mandel.b`: 113 | 114 | * the initial `bf.py` with CPython (2.7): about 1h45 (baseline) 115 | * the initial `bf.py` with Pypy (5.6.0): 1m30s (70x) 116 | * the `bf-c` without JIT: 32s (x200) 117 | * the `bf-c` with JIT: 5 seconds (x1250) 118 | * the `bff4` C implementation: 5 seconds with `-O3`, 10 seconds without 119 | * the `mandel` binary built when compiling `mandel.b` directly: 1 second with `-O3`, 15 seconds without 120 | 121 | The JIT addition contains code from [this amazing tutorial on JITs](http://morepypy.blogspot.fr/2011/04/tutorial-part-2-adding-jit.html). 122 | 123 | If the BrainFuck interpreter `bf.py` is a bit hairy to look at, you can check out the [step_by_step](step_by_step) folder to go from the simplest interpreter, then a bit better, then 124 | using only RPython code, then with the JIT-specific code, then with some final optimizations. 125 | -------------------------------------------------------------------------------- /bf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | Python Brainfuck interpreter. 6 | 7 | Jitted using http://morepypy.blogspot.fr/2011/04/tutorial-part-2-adding-jit.html 8 | """ 9 | 10 | import sys 11 | import os 12 | 13 | try: 14 | from rpython.rlib.jit import JitDriver, purefunction 15 | except ImportError: 16 | 17 | class JitDriver(object): 18 | def __init__(self, **kw): 19 | pass 20 | 21 | def jit_merge_point(self, **kw): 22 | pass 23 | 24 | def can_enter_jit(self, **kw): 25 | pass 26 | 27 | def purefunction(f): 28 | return f 29 | 30 | 31 | jitdriver = JitDriver(greens=['position', 'chars', 'jump_table'], 32 | reds=['ptr']) 33 | 34 | 35 | @purefunction 36 | def get_jump(jump_table, pos): 37 | return jump_table[pos] 38 | 39 | 40 | def create_jump_table(chars): 41 | jump_table = {} 42 | left_positions = [] 43 | 44 | position = 0 45 | for char in chars: 46 | if char == '[': 47 | left_positions.append(position) 48 | 49 | elif char == ']': 50 | left = left_positions.pop() 51 | right = position 52 | jump_table[left] = right 53 | jump_table[right] = left 54 | position += 1 55 | 56 | return jump_table 57 | 58 | 59 | class Array(object): 60 | def __init__(self): 61 | self._cells = [0] * 10000 # preallocation 62 | self._index = 0 63 | 64 | def get(self): 65 | return self._cells[self._index] 66 | 67 | def set(self, n): 68 | self._cells[self._index] = n 69 | 70 | def increment(self): 71 | self._cells[self._index] += 1 72 | 73 | def decrement(self): 74 | if self._cells[self._index] > 0: 75 | self._cells[self._index] -= 1 76 | 77 | def right(self): 78 | self._index += 1 79 | if self._index >= len(self._cells): 80 | self._cells.append(0) 81 | 82 | def left(self): 83 | if self._index > 0: 84 | self._index -= 1 85 | 86 | 87 | def run(chars): 88 | """Actual BrainFuck Interpreter.""" 89 | jump_table = create_jump_table(chars) 90 | ptr = Array() 91 | 92 | position = 0 93 | while position < len(chars): 94 | jitdriver.jit_merge_point(position=position, 95 | ptr=ptr, 96 | chars=chars, 97 | jump_table=jump_table) 98 | 99 | char = chars[position] 100 | 101 | if char == '>': 102 | ptr.right() 103 | 104 | elif char == '<': 105 | ptr.left() 106 | 107 | elif char == '+': 108 | ptr.increment() 109 | 110 | elif char == '-': 111 | ptr.decrement() 112 | 113 | elif char == '.': 114 | os.write(1, chr(ptr.get() % 256)) 115 | 116 | elif char == ',': 117 | ptr.set(ord(os.read(0, 1)[0])) 118 | 119 | elif char == '[' and ptr.get() == 0: 120 | position = get_jump(jump_table, position) 121 | 122 | elif char == ']' and ptr.get() != 0: 123 | position = get_jump(jump_table, position) 124 | 125 | position += 1 126 | 127 | 128 | def remove_comments(chars): 129 | codes = '<>[]-+,.' 130 | tmp = "" 131 | for c in chars: 132 | if c in codes: 133 | tmp += c 134 | return tmp 135 | 136 | 137 | def entry_point(argv): 138 | try: 139 | filename = argv[1] 140 | except IndexError: 141 | print "Usage: %s program.bf" % argv[0] 142 | return 1 143 | 144 | fp = os.open(filename, os.O_RDONLY, 0777) 145 | chars = "" 146 | while True: 147 | read = os.read(fp, 4096) 148 | if len(read) == 0: 149 | break 150 | chars += read 151 | os.close(fp) 152 | 153 | run(remove_comments(chars)) 154 | return 0 155 | 156 | 157 | def target(*args): 158 | return entry_point, None 159 | 160 | 161 | def jitpolicy(driver): 162 | from rpython.jit.codewriter.policy import JitPolicy 163 | return JitPolicy() 164 | 165 | 166 | if __name__ == "__main__": 167 | entry_point(sys.argv) 168 | -------------------------------------------------------------------------------- /examples/99bottles.b: -------------------------------------------------------------------------------- 1 | # 99 bottles of beer in Brainf*ck 2 | # Copyright (C) 2008 Raphael Bois 3 | # 1671 brainf*ck instructions. 4 | # Published under GPL v2 5 | 6 | Initialization 7 | ++ Counter for loop (a) 8 | >+ unused 9 | >++ Counter for loop (b) 10 | > Flag for 'no more' 11 | >+ Flag for not 'no more' 12 | >>> (5) to (7) : temporary values 13 | ++++++++++[->+>+>++++++++++<<<]>>> 10 10 100 in (8) (9) (10) 14 | >++++++++++ 10 in (11) 15 | [- 16 | >+++++ 50 in (12) 17 | >++++++++++ 100 in (13) 18 | >+++++++++++ 110 in (14) 19 | >++++++++ 80 in (15) 20 | >++++++++ 80 in (16) 21 | >+++ 30 in (17) 22 | >++++ 40 in (18) 23 | >+ 10 in (19) 24 | <<<<<<<<] 25 | + 26 | >-- + 48 '0' plus 1 in (12) 27 | >++ + 102 'f' plus 1 in (13) 28 | >+++++ + 115 's' plus 1 in (14) 29 | >-- + 78 'N' plus 1 in (15) 30 | >++++ + 84 'T' plus 1 in (16) 31 | >++ + 32 ' ' plus 1 in (17) 32 | >++++ + 44 comma plus 1 in (18) 33 | > + 10 LF plus 1 in (19) 34 | 35 | stuff for writing parts of the song 36 | >+ select stuff 37 | >+ select stuff 38 | >+ write song part 3 39 | >++ write song part 1 40 | >+ write song part 2 41 | >+ Flag for 'end of song' 42 | >++ Flag for not 'end of song' 43 | 44 | All bytes are at val plus 1 45 | Go back to (7) with final initialization step (remove 1 to all bytes) 46 | [-<] 47 | 48 | <<<<<<< at (0) 49 | [ loop (a) 50 | - 51 | 52 | >> at (2) 53 | [ loop (b) 54 | 55 | >>>>>>>> at (10) 56 | [ start loop 57 | 58 | <<<<<<< at (3) 59 | [->[-] 60 | print '(N|n)o more' 61 | >>>>>>>>>>>. '(N|n)' 62 | <----. 'o' 63 | >>>. ' ' 64 | <<<--. 'm' 65 | ++. 'o' 66 | +++.+ 'r' 67 | <-.+ 'e' 68 | <<+<<<<<<<< 69 | ]+> at (4) 70 | [-<[-]>>>>> at (9) 71 | prints number (using (9) and (10)) 72 | [>>>+<<<<+<+<+>>>-]<<<[->>>+<<<]> at (6) 73 | [>>>>>>+<<<<<<-]>>>>>[[-]>.<]<<<<[>>>>>-<<<<<-]>> at (9) 74 | [<<+<+<+>>>>-]<<<<[->>>>+<<<<]> at (6) 75 | [>>>>>>+<<<<<<-]>>>>>>.<<<<<[>>>>>-<<<<<-] at (7) 76 | 77 | memorize in (11) if (10) not 1 78 | >>>[-<<<+<+>>>>]<<<<[->>>>+<<<<]>-[[-]>>>>+<<<<]<<< at (4) 79 | ]+ 80 | 81 | >>>>>>>> at (12) 82 | print ' bottle(s) of beer' 83 | >>>>>. ' ' 84 | <<<<----. 'b' 85 | >----. 'o' 86 | +++++..- 'tt' 87 | <++++++++++. 'l' 88 | -------. 'e' 89 | <<[[-]>>>.<<<]>> 's' if (11)==1 ie if (10)!=1 90 | >>>>. ' ' 91 | <<<----. 'o' 92 | <+. 'f' 93 | >>>>. ' ' 94 | <<<<----. 'b' 95 | +++..+ 'ee' 96 | >+++.+ 'r' 97 | 98 | [>] at (20) 99 | 100 | +>+>[->+<<-<- 101 | print ' on the wall' DOT LF LF 102 | <<<. ' ' 103 | <<<----. 'o' 104 | -. 'n' 105 | >>>. ' ' 106 | <<<++++++. 't' 107 | <++. 'h' 108 | ---. 'e' 109 | >>>>. ' ' 110 | <<<+++. 'w' 111 | <----. 'a' 112 | +++++++++++.. 'll' 113 | ------>---- reset to 'f' and 's' 114 | >---------- ---------- ---------- -- sets (15) to 'N' 115 | 116 | >>>++.-- DOT 117 | >.. LF LF 118 | >>>] at (22) 119 | 120 | >>>[->[-]<<<<<<<[<]<[-]>>[>]>>>>>]+ if end of song reset bottles counter 121 | >[-<[-] at (25) 122 | <<<< at (21) 123 | [->>[->+<<<<- 124 | print ' on the wall' COMMA ' ' 125 | <<<. ' ' 126 | <<<----. 'o' 127 | -. 'n' 128 | >>>. ' ' 129 | <<<++++++. 't' 130 | <++. 'h' 131 | ---. 'e' 132 | >>>>. ' ' 133 | <<<+++. 'w' 134 | <----. 'a' 135 | +++++++++++.. 'll' 136 | 137 | ------>---- reset (13) and (14) to 'f' and 's' 138 | >++++++++++ ++++++++++ ++++++++++ ++ sets (15) to 'n' 139 | 140 | >>>. comma 141 | <. ' ' 142 | >>>>>>]<<]< at (20) 143 | 144 | [->>>>[-<<+< at (21) 145 | <<<++.-- DOT 146 | >. LF 147 | 148 | [<]<<<<<<<< at (3) 149 | [->[-]<]+> at (4) 150 | [-<[-]> 151 | >>>>>>>>>>>>. 'T' 152 | <<<-----. 'a' 153 | ++++++++++. 'k' 154 | ------. 'e' 155 | >>>>. ' ' 156 | <<<----. 'o' 157 | -. 'n' 158 | <. 'e' 159 | >>>>. ' ' 160 | <<<<-. 'd' 161 | >+. 'o' 162 | ++++++++. 'w' 163 | ---------. 'n' 164 | >>>. ' ' 165 | <<<<---. 'a' 166 | >. 'n' 167 | <+++. 'd' 168 | >>>>. ' ' 169 | <<<++. 'p' 170 | <---. 'a' 171 | >+++.. 'ss' 172 | >>>. ' ' 173 | <<<<++++++++. 'i' 174 | >+. 't' 175 | >>>. ' ' 176 | <<<<--------. 'a' 177 | >--. 'r' 178 | ---. 'o' 179 | ++++++. 'u' 180 | -------. 'n' 181 | <+++. 'd' 182 | ++>+++++ reset (13) and (14) to 'f' and 's' 183 | >>>>. comma 184 | <. ' ' 185 | 186 | [<]<<<<<<< at (4) 187 | ]+ 188 | 189 | >>>>>> at (10) 190 | decrements values 191 | -<<<+>>[<<[-]<+<+>>>>-]<<<<[>-<[-]]>[->>>+<<<]>[->->+++++++++<<]>>> at (10) 192 | 193 | >>[>]>>>>] at (24) 194 | <<<<] at (20) 195 | 196 | >>>>>>]+ at (26) 197 | 198 | <<<<<<<[<]< at (10) 199 | ] 200 | +<+ 201 | <<<<<<+< at (2) 202 | - 203 | ] 204 | 205 | print 'Go to the store and buy some more' comma ' ' 206 | 207 | >>>>>>>>>>[>]>>>>> at (25) 208 | [->[-]<]+> at (26) 209 | [-<[-] 210 | <<<<<<<<< at (16) 211 | -------------. 'G' 212 | <<----. 'o' 213 | >>>. ' ' 214 | <<<+++++. 't' 215 | -----. 'o' 216 | >>>. ' ' 217 | <<<+++++. 't' 218 | <++. 'h' 219 | ---. 'e' 220 | >>>>. ' ' 221 | <<<-. 's' 222 | +. 't' 223 | -----. 'o' 224 | +++. 'r' 225 | <. 'e' 226 | >>>>. ' ' 227 | <<<<----. 'a' 228 | >----. 'n' 229 | <+++. 'd' 230 | >>>>. ' ' 231 | <<<<--. 'b' 232 | >+++++++. 'u' 233 | ++++. 'y' 234 | >>>. ' ' 235 | <<<------. 's' 236 | ----. 'o' 237 | --. 'm' 238 | <+++. 'e' 239 | >>>>. ' ' 240 | <<<. 'm' 241 | ++. 'o' 242 | +++.+ 'r' 243 | <.+ 'e' 244 | >>>>>. coma 245 | <. ' ' 246 | >>>>>>>>> 247 | ]+ 248 | 249 | Initialize last loop to print final '99 bottles of beer on the wall' DOT 250 | <[-]+<[-]<[-]<[-]+<<< at (19) 251 | [<]<[-]<[-]<[-]<[-] at (7) 252 | ++++++++++[->+>+>++++++++++<<<]>->->- 253 | <<<<<<[-]+<[-]<+<< at (0) 254 | ] 255 | -------------------------------------------------------------------------------- /examples/bench.b: -------------------------------------------------------------------------------- 1 | *LL*LH*FF*01 2 | >++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++ 3 | [>++++++++<-]>.[-]<<>++++++++++[>++++++++++[>++ 4 | ++++++++[>++++++++++[>++++++++++[>++++++++++[>+ 5 | +++++++++[-]<-]<-]<-]<-]<-]<-]<-]++++++++++. 6 | *00 7 | -------------------------------------------------------------------------------- /examples/bottles.b: -------------------------------------------------------------------------------- 1 | ########################## 2 | ### 3 | ### Severely updated version! 4 | ### (now says "1 bottle" and 5 | ### contains no extra "0" verse) 6 | ### 7 | ########################## 8 | ### 99 Bottles of Beer ### 9 | ### coded in Brainfuck ### 10 | ### with explanations ### 11 | ########################## 12 | # 13 | # This Bottles of Beer program 14 | # was written by Andrew Paczkowski 15 | # Coder Alias: thepacz 16 | # three_halves_plus_one@yahoo.com 17 | ##### 18 | 19 | > 0 in the zeroth cell 20 | +++++++>++++++++++[<+++++>-] 57 in the first cell or "9" 21 | +++++++>++++++++++[<+++++>-] 57 in second cell or "9" 22 | ++++++++++ 10 in third cell 23 | >+++++++++ 9 in fourth cell 24 | 25 | ########################################## 26 | ### create ASCII chars in higher cells ### 27 | ########################################## 28 | 29 | >>++++++++[<++++>-] " " 30 | >++++++++++++++[<+++++++>-] b 31 | +>+++++++++++[<++++++++++>-] o 32 | ++>+++++++++++++++++++[<++++++>-] t 33 | ++>+++++++++++++++++++[<++++++>-] t 34 | >++++++++++++[<+++++++++>-] l 35 | +>++++++++++[<++++++++++>-] e 36 | +>+++++++++++++++++++[<++++++>-] s 37 | >++++++++[<++++>-] " " 38 | +>+++++++++++[<++++++++++>-] o 39 | ++>++++++++++[<++++++++++>-] f 40 | >++++++++[<++++>-] " " 41 | >++++++++++++++[<+++++++>-] b 42 | +>++++++++++[<++++++++++>-] e 43 | +>++++++++++[<++++++++++>-] e 44 | >+++++++++++++++++++[<++++++>-] r 45 | >++++++++[<++++>-] " " 46 | +>+++++++++++[<++++++++++>-] o 47 | >+++++++++++[<++++++++++>-] n 48 | >++++++++[<++++>-] " " 49 | ++>+++++++++++++++++++[<++++++>-] t 50 | ++++>++++++++++[<++++++++++>-] h 51 | +>++++++++++[<++++++++++>-] e 52 | >++++++++[<++++>-] " " 53 | ++>+++++++++++++[<+++++++++>-] w 54 | +>++++++++++++[<++++++++>-] a 55 | >++++++++++++[<+++++++++>-] l 56 | >++++++++++++[<+++++++++>-] l 57 | >+++++[<++>-] LF 58 | ++>+++++++++++++++++++[<++++++>-] t 59 | +>++++++++++++[<++++++++>-] a 60 | +++>+++++++++++++[<++++++++>-] k 61 | +>++++++++++[<++++++++++>-] e 62 | >++++++++[<++++>-] " " 63 | +>+++++++++++[<++++++++++>-] o 64 | >+++++++++++[<++++++++++>-] n 65 | +>++++++++++[<++++++++++>-] e 66 | >++++++++[<++++>-] " " 67 | >++++++++++[<++++++++++>-] d 68 | +>+++++++++++[<++++++++++>-] o 69 | ++>+++++++++++++[<+++++++++>-] w 70 | >+++++++++++[<++++++++++>-] n 71 | >++++++++[<++++>-] " " 72 | +>++++++++++++[<++++++++>-] a 73 | >+++++++++++[<++++++++++>-] n 74 | >++++++++++[<++++++++++>-] d 75 | >++++++++[<++++>-] " " 76 | ++>+++++++++++[<++++++++++>-] p 77 | +>++++++++++++[<++++++++>-] a 78 | +>+++++++++++++++++++[<++++++>-] s 79 | +>+++++++++++++++++++[<++++++>-] s 80 | >++++++++[<++++>-] " " 81 | +>+++++++++++++[<++++++++>-] i 82 | ++>+++++++++++++++++++[<++++++>-] t 83 | >++++++++[<++++>-] " " 84 | +>++++++++++++[<++++++++>-] a 85 | >+++++++++++++++++++[<++++++>-] r 86 | +>+++++++++++[<++++++++++>-] o 87 | >+++++++++++++[<+++++++++>-] u 88 | >+++++++++++[<++++++++++>-] n 89 | >++++++++++[<++++++++++>-] d 90 | >+++++[<++>-] LF 91 | +++++++++++++ CR 92 | 93 | [<]>>>> go back to fourth cell 94 | 95 | ################################# 96 | ### initiate the display loop ### 97 | ################################# 98 | 99 | [ loop 100 | < back to cell 3 101 | [ loop 102 | [>]<< go to last cell and back to LF 103 | .. output 2 newlines 104 | [<]> go to first cell 105 | 106 | ################################### 107 | #### begin display of characters### 108 | ################################### 109 | # 110 | #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 111 | #X X b o t t l e s o f b e e r 112 | #.>.>.>.>.>.>.>.>.>.>.>. 113 | #o n t h e w a l l N 114 | #[<]> go to first cell 115 | #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.> 116 | #X X b o t t l e s o f b e e r N 117 | #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 118 | #t a k e o n e d o w n a n d p a s s 119 | #.>.>.>.>.>.>.>.>.>. 120 | #i t a r o u n d N 121 | ##### 122 | 123 | [<]>> go to cell 2 124 | - subtract 1 from cell 2 125 | < go to cell 1 126 | 127 | ######################## 128 | ### display last line ## 129 | ######################## 130 | # 131 | #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 132 | #X X b o t t l e s o f b e e r 133 | #.>.>.>.>.>.>.>.>.>.>. 134 | #o n t h e w a l l 135 | ##### 136 | 137 | [<]>>>- go to cell 3/subtract 1 138 | ] end loop when cell 3 is 0 139 | ++++++++++ add 10 to cell 3 140 | <++++++++++ back to cell 2/add 10 141 | <- back to cell 1/subtract 1 142 | [>]<. go to last line/carriage return 143 | [<]> go to first line 144 | 145 | ######################## 146 | ### correct last line ## 147 | ######################## 148 | # 149 | #.>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 150 | #X X b o t t l e s o f b e e r 151 | #.>.>.>.>.>.>.>.>.>.>. 152 | #o n t h e w a l l 153 | ##### 154 | 155 | [<]>>>>- go to cell 4/subtract 1 156 | ] end loop when cell 4 is 0 157 | 158 | ############################################################## 159 | ### By this point verses 99\10 are displayed but to work ### 160 | ### with the lower numbered verses in a more readable way ### 161 | ### we initiate a new loop for verses 9\0 that will not ### 162 | ### use the fourth cell at all ### 163 | ############################################################## 164 | 165 | + add 1 to cell four (to keep it non\zero) 166 | <-- back to cell 3/subtract 2 167 | 168 | [ loop 169 | [>]<< go to last cell and back to LF 170 | .. output 2 newlines 171 | [<]> go to first cell 172 | 173 | ################################### 174 | #### begin display of characters### 175 | ################################### 176 | # 177 | #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 178 | # X b o t t l e s o f b e e r 179 | #.>.>.>.>.>.>.>.>.>.>.>. 180 | #o n t h e w a l l N 181 | #[<]> go to first cell 182 | #>.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.> 183 | # X b o t t l e s o f b e e r N 184 | #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 185 | #t a k e o n e d o w n a n d p a s s 186 | #.>.>.>.>.>.>.>.>.>. 187 | #i t a r o u n d N 188 | ##### 189 | 190 | [<]>> go to cell 2 191 | - subtract 1 from cell 2 192 | 193 | ######################## 194 | ### display last line ## 195 | ######################## 196 | # 197 | #.>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 198 | #X b o t t l e s o f b e e r 199 | #.>.>.>.>.>.>.>.>.>.>. 200 | #o n t h e w a l l 201 | ##### 202 | 203 | [<]>>>- go to cell 3/subtract 1 204 | ] end loop when cell 3 is 0 205 | + add 1 to cell 3 to keep it non\zero 206 | 207 | [>]<. go to last line/carriage return 208 | [<]> go to first line 209 | 210 | ######################## 211 | ### correct last line ## 212 | ######################## 213 | # 214 | #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.> 215 | # X b o t t l e o f b e e r 216 | #.>.>.>.>.>.>.>.>.>.>.<<<<. 217 | #o n t h e w a l l 218 | ##### 219 | 220 | [>]<< go to last cell and back to LF 221 | .. output 2 newlines 222 | [<]> go to first line 223 | 224 | ######################### 225 | ### the final verse ## 226 | ######################### 227 | # 228 | #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>.> 229 | # X b o t t l e o f b e e r 230 | #.>.>.>.>.>.>.>.>.>.>.>. 231 | #o n t h e w a l l N 232 | #[<]> go to first cell 233 | #>.>>>.>.>.>.>.>.>.>>.>.>.>.>.>.>.>.>>>>>>>>>>>>>.> 234 | # X b o t t l e o f b e e r N 235 | #.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 236 | #t a k e o n e d o w n a n d p a s s 237 | #.>.>.>.>.>.>.>.>.>. 238 | #i t a r o u n d N 239 | #[>]< go to last line 240 | #<<<.<<.<<<. 241 | # n o 242 | #[<]>>>> go to fourth cell 243 | #>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.> 244 | # b o t t l e s o f b e e r 245 | #.>.>.>.>.>.>.>.>.>.>.>. 246 | #o n t h e w a l l N 247 | #####fin## -------------------------------------------------------------------------------- /examples/hanoi.b: -------------------------------------------------------------------------------- 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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< 97 | <<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[- 98 | >>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<+++ 99 | +++++++++++++++++++++++++++++++++++++++++++++.<+++++++++++++++++++++++++++++ 100 | +++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>-< 101 | ]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<+++++++++++++++++++++++ 102 | +++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++. 103 | >>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>] 104 | <<]<<<<<<--------------------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>> 105 | >>[-<+<<<<<+>>>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]+++++ 106 | +++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<< 107 | +>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+ 108 | <<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-] 109 | >>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>> 110 | >>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]> 111 | >>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[ 112 | -]<<<[->>>+<<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]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-] 126 | +>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>> 127 | [[-<<<+>>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[- 128 | <<<+<<+>>>>>]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>] 129 | [-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<< 130 | <<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]> 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 | <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>>>> 441 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 442 | +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 443 | <<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 444 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<< 445 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>> 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 | ]<[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+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<] 496 | >>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<[-]>>>>[-] 497 | <[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>>>]<<[-<<<->>>]>]<<<[-]>[-]<< 498 | <<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+ 499 | <<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>> 500 | >[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[- 501 | ]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>] 502 | <[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<++++++++++++++++++++++++++ 503 | ++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.<++ 504 | ++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<< 505 | <<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++++++++++++++++++++++++++++++ 506 | ++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++ 507 | +++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<-------------- 508 | ------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<+<<<<<+>>>>>>]>>>[ 509 | -]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[-> 510 | >+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>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<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->> 525 | >+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+ 526 | >>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+> 527 | >]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>> 528 | >>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<] 529 | >>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-] 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 | <[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<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< 582 | [->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<< 583 | ->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>] 584 | <<[-]+>>]<]<]<<<]<[-]>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<+>>>> 585 | >]<<[-<<<->>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++ 586 | ++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-< 587 | <<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->> 588 | >>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[- 589 | ]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+> 590 | ]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++ 591 | ++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.> 592 | >>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++ 593 | ++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++ 594 | ++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>> 595 | >>>>]<<]<<<<<<--------------------------------.>[-]>[-]<<<<[->>>>+<<<<]>>>>[ 596 | -<+<<<+>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[ 597 | -]<<[>>>[-]<<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+<[[ 624 | -<+>]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++ 625 | ++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++ 626 | ++.>>>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++ 627 | ++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++ 628 | ++++++++.>>>>>>-<]>[[-]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++ 629 | +.>>>>>>]<<]<<<<<<+++++++++++++.<<[-]+++++++++++++++++++++++++++++++++++++++ 630 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 631 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 632 | +++++++++[>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 633 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 634 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[>[-]+++++++++ 635 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 636 | +++++++++++++++[-]<-]<-]<<<<<]<<<<+>>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<< 637 | <<+>>>>>][-]++++<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]> 638 | >>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[-> 639 | >>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]+>>>][-]<[-> 640 | +<]>[[-<+>]<<<[-]+>>>]<<<]<<->>[-]<<[->>+<<]>>[[-<<+>>]<<<<<<<<-<<<<<<<<<<<< 641 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<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>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+ 707 | <<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]< 708 | <<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[- 709 | >+<]>[[-<+>]<<<[-]+>>>]<<<]<<<<+>>>]<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 710 | -------------------------------------------------------------------------------- /examples/hello.b: -------------------------------------------------------------------------------- 1 | +++++ +++++ initialize counter (cell #0) to 10 2 | [ use loop to set the next four cells to 70/100/30/10 3 | > +++++ ++ add 7 to cell #1 4 | > +++++ +++++ add 10 to cell #2 5 | > +++ add 3 to cell #3 6 | > + add 1 to cell #4 7 | <<<< - decrement counter (cell #0) 8 | ] 9 | > ++ . print 'H' 10 | > + . print 'e' 11 | +++++ ++ . print 'l' 12 | . print 'l' 13 | +++ . print 'o' 14 | > ++ . print ' ' 15 | << +++++ +++++ +++++ . print 'W' 16 | > . print 'o' 17 | +++ . print 'r' 18 | ----- - . print 'l' 19 | ----- --- . print 'd' 20 | > + . print '!' 21 | > . print '\n' 22 | -------------------------------------------------------------------------------- /examples/mandel.b: -------------------------------------------------------------------------------- 1 | A mandelbrot set fractal viewer in brainf*** written by Erik Bosman 2 | +++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[ 3 | >>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+ 4 | <<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>> 5 | >+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>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>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++ 144 | +[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<< 145 | <<<<<]]>>>] 146 | -------------------------------------------------------------------------------- /examples/test.b: -------------------------------------------------------------------------------- 1 | loop counter 2 | +++++++++ 3 | +++++++ 4 | 5 | > 6 | 7 | value to copy 8 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9 | < 10 | [ main loop 11 | > 12 | [ >+<- ] copy value one cell to the right 13 | >. print it 14 | 15 | [ <+>- ] copy value back to the left 16 | << 17 | - decrement the loop counter 18 | ] repeat 19 | ++++++++++. print a newline 20 | -------------------------------------------------------------------------------- /hello.bf: -------------------------------------------------------------------------------- 1 | +++++ +++++ initialize counter (cell #0) to 10 2 | [ use loop to set the next four cells to 70/100/30/10 3 | > +++++ ++ add 7 to cell #1 4 | > +++++ +++++ add 10 to cell #2 5 | > +++ add 3 to cell #3 6 | > + add 1 to cell #4 7 | <<<< - decrement counter (cell #0) 8 | ] 9 | > ++ . print 'H' 10 | > + . print 'e' 11 | +++++ ++ . print 'l' 12 | . print 'l' 13 | +++ . print 'o' 14 | > ++ . print ' ' 15 | << +++++ +++++ +++++ . print 'W' 16 | > . print 'o' 17 | +++ . print 'r' 18 | ----- - . print 'l' 19 | ----- --- . print 'd' 20 | > + . print '!' 21 | > . print '\n' 22 | -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | In this directory are the two external resources I used to run the benchmarks. 2 | On file is a Brainfuck interpreter written in C, the other one is a Brainfuck to C translator. 3 | -------------------------------------------------------------------------------- /resources/bff4.c: -------------------------------------------------------------------------------- 1 | /* 2 | Optimizing brainfuck implementation of dialect based on 3 | Daniel's dbfi (see "A very short self-interpreter") 4 | 5 | This interpreter has only one input: program and input to the 6 | program have to be separated with ! e.g. ",.!a" prints 'a' 7 | To use it in interactive mode paste your program as input. 8 | 9 | This program can be compiled with NOLNR macro defined. 10 | NOLNR disables optimization of linear loops (where '<>' balanced), e.g. [->+>++<<]. 11 | Linear loop is then executed in one step. 12 | 13 | Oleg Mazonka 4 Dec 2006 http://mazonka.com/ 14 | 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | typedef struct _op 22 | { 23 | int shift, off; 24 | int * d, sz; 25 | struct _op * go; 26 | int c; 27 | int igo, linear; 28 | int * db, dbsz; 29 | } op; 30 | 31 | void printop(op *z) 32 | { 33 | int j; 34 | printf("op='"); 35 | if( !strchr("<>+-",z->c) ) printf("%c",(char)z->c); 36 | for( j=0; jdbsz; j++ ) printf("%c",(char)z->db[j]); 37 | printf("' shift=%d off=%d go=%d { " 38 | ,z->shift, z->off, z->igo ); 39 | for( j=0; jsz; j++ ) 40 | printf("%d ",z->d[j]); 41 | printf("}\n"); 42 | } 43 | 44 | void * zalloc(void *p, int sz, int osz) 45 | { 46 | p = realloc(p,sz); 47 | memset((char*)p+osz,0,sz-osz); 48 | return p; 49 | } 50 | #define zalloci(p,sz,osz) zalloc(p,(sz)*sizeof(int),(osz)*sizeof(int)); 51 | 52 | int getbf() 53 | { 54 | int a; 55 | next: 56 | a = getchar(); 57 | if( a==-1 ) return -1; 58 | if( !strchr(",.[]+-<>!",a) ) goto next; 59 | return a; 60 | } 61 | 62 | int consume(op *o) 63 | { 64 | int mp=0,i; 65 | int a = o->c; 66 | 67 | if( strchr("[]",a) ) a=getbf(); 68 | 69 | o->sz = 1; 70 | o->d = zalloci(0,1,0); 71 | o->off = 0; 72 | 73 | o->dbsz=0; 74 | o->db=0; 75 | 76 | for(;;a=getbf()) 77 | { 78 | if( a==-1 || a=='!' ) break; 79 | if( strchr(",.[]",a) ) break; 80 | 81 | o->db = zalloci(o->db,o->dbsz+1,o->dbsz); 82 | o->db[o->dbsz++] = a; 83 | 84 | if( a=='+' ) o->d[mp]++; 85 | if( a=='-' ) o->d[mp]--; 86 | if( a=='>' ) 87 | { 88 | mp++; 89 | if( mp>=o->sz ) 90 | { 91 | o->d = zalloci(o->d,o->sz+1,o->sz); 92 | o->sz++; 93 | } 94 | } 95 | if( a=='<' ) 96 | { 97 | if( mp>0 ) mp--; 98 | else 99 | { 100 | o->off--; 101 | o->d = zalloci(o->d,o->sz+1,o->sz); 102 | for( i=o->sz; i>0; i-- ) o->d[i] = o->d[i-1]; 103 | o->d[0] = 0; 104 | o->sz++; 105 | } 106 | } 107 | } 108 | o->shift = mp + o->off; 109 | 110 | /* cut corners */ 111 | while( o->sz && o->d[o->sz-1] == 0 ) o->sz--; 112 | while( o->sz && o->d[0] == 0 ) 113 | { 114 | o->sz--; 115 | for( i=0; isz; i++ ) o->d[i] = o->d[i+1]; 116 | o->off++; 117 | } 118 | 119 | return a; 120 | } 121 | 122 | int main() 123 | { 124 | op * o=0, *z, *zend; 125 | int sz=0, i, *m, mp, msz; 126 | int a = getbf(); 127 | for(;;sz++) 128 | { 129 | o = zalloc(o,(sz+1)*sizeof(op),sz*sizeof(op)); 130 | if( a==-1 || a=='!' ) break; 131 | 132 | o[sz].c = a; 133 | if( strchr(",.",a) ){ a=getbf(); continue; } 134 | if( a==']' ) 135 | { 136 | int l=1, i=sz; 137 | while(l&&i>=0) if(i--) l+=(o[i].c==']')-(o[i].c=='['); 138 | if( i<0 ){ printf("unbalanced ']'\n"); exit(1); } 139 | o[i].igo = sz; 140 | o[sz].igo = i; 141 | } 142 | a = consume(o+sz); 143 | } 144 | 145 | for( i=0;ic == ']' ) 177 | { 178 | if( m[mp] ) z=z->go; 179 | } 180 | 181 | else if( z->c == '[' ) 182 | { 183 | if( !m[mp] ) z=z->go; 184 | } 185 | 186 | else if( z->c == ',' ){ m[mp] = getchar(); continue; } 187 | 188 | else if( z->c == '.' ){ putchar(m[mp]); continue; } 189 | 190 | /* apply */ 191 | if( z->sz ) 192 | { 193 | int nmsz = mp+z->sz+z->off; 194 | if( nmsz > msz ) 195 | { 196 | m = zalloci(m,nmsz,msz); 197 | msz = nmsz; 198 | } 199 | 200 | 201 | #ifndef NOLNR 202 | if( z->linear ) 203 | { 204 | int del = m[mp]/z->linear; 205 | for( i=0; isz; i++ ) m[mp+z->off+i]+=del*z->d[i]; 206 | }else 207 | #endif 208 | for( i=0; isz; i++ ) m[mp+z->off+i]+=z->d[i]; 209 | 210 | } 211 | 212 | if( z->shift>0 ) 213 | { 214 | int nmsz = mp+z->shift+1; 215 | if( nmsz > msz ) 216 | { 217 | m = zalloci(m,nmsz,msz); 218 | msz = nmsz; 219 | } 220 | } 221 | mp += z->shift; 222 | 223 | #ifdef DBG 224 | for( i=0; i 11 | 12 | int main(int argc, char **argv) 13 | { 14 | FILE *in = stdin, *out = stdout; 15 | int c; 16 | int cellsize = 30000; 17 | 18 | fprintf(out, 19 | "#include \n" 20 | "#include \n\n" 21 | "int main(int argc, char **argv)\n{\n" 22 | "\tunsigned char *cell = calloc(%d, 1);\n" 23 | "\tunsigned char *cells = cell;\n" 24 | "\tif (!cell) {\n" 25 | "\t\tfprintf(stderr, \"Error allocating memory.\\n\");\n" 26 | "\t\treturn 1;\n" 27 | "\t}\n\n", cellsize 28 | ); 29 | 30 | while ((c = getc(in)) != EOF) { 31 | switch (c) { 32 | case '>': fprintf(out, "\t\t++cell;\n"); break; 33 | case '<': fprintf(out, "\t\t--cell;\n"); break; 34 | case '+': fprintf(out, "\t\t++*cell;\n"); break; 35 | case '-': fprintf(out, "\t\t--*cell;\n"); break; 36 | case '.': fprintf(out, "\t\tputchar(*cell);\n"); break; 37 | case ',': fprintf(out, "\t\t*cell = getchar();\n"); break; 38 | case '[': fprintf(out, "\twhile (*cell) {\n"); break; 39 | case ']': fprintf(out, "\t}\n"); break; 40 | default: break; 41 | } 42 | } 43 | 44 | fprintf(out, "\n\tfree(cells);\n\treturn 0;\n}\n\n"); 45 | } 46 | -------------------------------------------------------------------------------- /step_by_step/0.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | 6 | 7 | def create_jump_table(chars): 8 | jump_table = {} 9 | left_positions = [] 10 | 11 | position = 0 12 | for char in chars: 13 | if char == '[': 14 | left_positions.append(position) 15 | 16 | elif char == ']': 17 | left = left_positions.pop() 18 | right = position 19 | jump_table[left] = right 20 | jump_table[right] = left 21 | position += 1 22 | 23 | return jump_table 24 | 25 | 26 | def run(chars): 27 | """Actual BrainFuck Interpreter.""" 28 | jump_table = create_jump_table(chars) 29 | cells = [0] * 10000 30 | index = 0 31 | 32 | position = 0 33 | while position < len(chars): 34 | char = chars[position] 35 | 36 | if char == '>': 37 | index += 1 38 | 39 | elif char == '<': 40 | if index > 0: 41 | index -= 1 42 | 43 | elif char == '+': 44 | cells[index] += 1 45 | 46 | elif char == '-': 47 | if cells[index] > 0: 48 | cells[index] -= 1 49 | 50 | elif char == '.': 51 | sys.stdout.write(chr(cells[index] % 256)) 52 | sys.stdout.flush() 53 | 54 | elif char == ',': 55 | cells[index] = ord(raw_input()) 56 | 57 | elif char == '[' and cells[index] == 0: 58 | position = jump_table[position] 59 | 60 | elif char == ']' and cells[index] != 0: 61 | position = jump_table[position] 62 | 63 | position += 1 64 | 65 | 66 | def remove_comments(chars): 67 | codes = '<>[]-+,.' 68 | tmp = "" 69 | for c in chars: 70 | if c in codes: 71 | tmp += c 72 | return tmp 73 | 74 | 75 | if __name__ == "__main__": 76 | run(remove_comments(open(sys.argv[1]).read())) 77 | -------------------------------------------------------------------------------- /step_by_step/1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | 6 | 7 | def create_jump_table(chars): 8 | jump_table = {} 9 | left_positions = [] 10 | 11 | position = 0 12 | for char in chars: 13 | if char == '[': 14 | left_positions.append(position) 15 | 16 | elif char == ']': 17 | left = left_positions.pop() 18 | right = position 19 | jump_table[left] = right 20 | jump_table[right] = left 21 | position += 1 22 | 23 | return jump_table 24 | 25 | 26 | class Array(object): 27 | def __init__(self): 28 | self._cells = [0] * 10000 # preallocation 29 | self._index = 0 30 | 31 | def get(self): 32 | return self._cells[self._index] 33 | 34 | def set(self, n): 35 | self._cells[self._index] = n 36 | 37 | def increment(self): 38 | self._cells[self._index] += 1 39 | 40 | def decrement(self): 41 | if self._cells[self._index] > 0: 42 | self._cells[self._index] -= 1 43 | 44 | def right(self): 45 | self._index += 1 46 | if self._index >= len(self._cells): 47 | self._cells.append(0) 48 | 49 | def left(self): 50 | if self._index > 0: 51 | self._index -= 1 52 | 53 | 54 | def run(chars): 55 | """Actual BrainFuck Interpreter.""" 56 | jump_table = create_jump_table(chars) 57 | ptr = Array() 58 | 59 | position = 0 60 | while position < len(chars): 61 | char = chars[position] 62 | 63 | if char == '>': 64 | ptr.right() 65 | 66 | elif char == '<': 67 | ptr.left() 68 | 69 | elif char == '+': 70 | ptr.increment() 71 | 72 | elif char == '-': 73 | ptr.decrement() 74 | 75 | elif char == '.': 76 | sys.stdout.write(chr(ptr.get() % 256)) 77 | sys.stdout.flush() 78 | 79 | elif char == ',': 80 | ptr.set(ord(raw_input())) 81 | 82 | elif char == '[' and ptr.get() == 0: 83 | position = jump_table[position] 84 | 85 | elif char == ']' and ptr.get() != 0: 86 | position = jump_table[position] 87 | 88 | position += 1 89 | 90 | 91 | def remove_comments(chars): 92 | codes = '<>[]-+,.' 93 | tmp = "" 94 | for c in chars: 95 | if c in codes: 96 | tmp += c 97 | return tmp 98 | 99 | 100 | if __name__ == "__main__": 101 | run(remove_comments(open(sys.argv[1]).read())) 102 | -------------------------------------------------------------------------------- /step_by_step/2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import os 6 | 7 | 8 | def create_jump_table(chars): 9 | jump_table = {} 10 | left_positions = [] 11 | 12 | position = 0 13 | for char in chars: 14 | if char == '[': 15 | left_positions.append(position) 16 | 17 | elif char == ']': 18 | left = left_positions.pop() 19 | right = position 20 | jump_table[left] = right 21 | jump_table[right] = left 22 | position += 1 23 | 24 | return jump_table 25 | 26 | 27 | class Array(object): 28 | def __init__(self): 29 | self._cells = [0] * 10000 # preallocation 30 | self._index = 0 31 | 32 | def get(self): 33 | return self._cells[self._index] 34 | 35 | def set(self, n): 36 | self._cells[self._index] = n 37 | 38 | def increment(self): 39 | self._cells[self._index] += 1 40 | 41 | def decrement(self): 42 | if self._cells[self._index] > 0: 43 | self._cells[self._index] -= 1 44 | 45 | def right(self): 46 | self._index += 1 47 | if self._index >= len(self._cells): 48 | self._cells.append(0) 49 | 50 | def left(self): 51 | if self._index > 0: 52 | self._index -= 1 53 | 54 | 55 | def run(chars): 56 | """Actual BrainFuck Interpreter.""" 57 | jump_table = create_jump_table(chars) 58 | ptr = Array() 59 | 60 | position = 0 61 | while position < len(chars): 62 | char = chars[position] 63 | 64 | if char == '>': 65 | ptr.right() 66 | 67 | elif char == '<': 68 | ptr.left() 69 | 70 | elif char == '+': 71 | ptr.increment() 72 | 73 | elif char == '-': 74 | ptr.decrement() 75 | 76 | elif char == '.': 77 | os.write(1, chr(ptr.get() % 256)) 78 | 79 | elif char == ',': 80 | ptr.set(ord(os.read(0, 1)[0])) 81 | 82 | elif char == '[' and ptr.get() == 0: 83 | position = jump_table[position] 84 | 85 | elif char == ']' and ptr.get() != 0: 86 | position = jump_table[position] 87 | 88 | position += 1 89 | 90 | 91 | def remove_comments(chars): 92 | codes = '<>[]-+,.' 93 | tmp = "" 94 | for c in chars: 95 | if c in codes: 96 | tmp += c 97 | return tmp 98 | 99 | 100 | def entry_point(argv): 101 | try: 102 | filename = argv[1] 103 | except IndexError: 104 | print "Usage: %s program.bf" % argv[0] 105 | return 1 106 | 107 | fp = os.open(filename, os.O_RDONLY, 0777) 108 | chars = "" 109 | while True: 110 | read = os.read(fp, 4096) 111 | if len(read) == 0: 112 | break 113 | chars += read 114 | os.close(fp) 115 | 116 | run(remove_comments(chars)) 117 | return 0 118 | 119 | 120 | def target(*args): 121 | return entry_point, None 122 | 123 | 124 | if __name__ == "__main__": 125 | entry_point(sys.argv) 126 | -------------------------------------------------------------------------------- /step_by_step/3.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | Python Brainfuck interpreter. 6 | 7 | Jitted using http://morepypy.blogspot.fr/2011/04/tutorial-part-2-adding-jit.html 8 | """ 9 | 10 | import sys 11 | import os 12 | 13 | try: 14 | from rpython.rlib.jit import JitDriver 15 | except ImportError: 16 | 17 | class JitDriver(object): 18 | def __init__(self, **kw): 19 | pass 20 | 21 | def jit_merge_point(self, **kw): 22 | pass 23 | 24 | def can_enter_jit(self, **kw): 25 | pass 26 | 27 | 28 | jitdriver = JitDriver(greens=['position', 'chars', 'jump_table'], 29 | reds=['ptr']) 30 | 31 | 32 | def create_jump_table(chars): 33 | jump_table = {} 34 | left_positions = [] 35 | 36 | position = 0 37 | for char in chars: 38 | if char == '[': 39 | left_positions.append(position) 40 | 41 | elif char == ']': 42 | left = left_positions.pop() 43 | right = position 44 | jump_table[left] = right 45 | jump_table[right] = left 46 | position += 1 47 | 48 | return jump_table 49 | 50 | 51 | class Array(object): 52 | def __init__(self): 53 | self._cells = [0] * 10000 # preallocation 54 | self._index = 0 55 | 56 | def get(self): 57 | return self._cells[self._index] 58 | 59 | def set(self, n): 60 | self._cells[self._index] = n 61 | 62 | def increment(self): 63 | self._cells[self._index] += 1 64 | 65 | def decrement(self): 66 | if self._cells[self._index] > 0: 67 | self._cells[self._index] -= 1 68 | 69 | def right(self): 70 | self._index += 1 71 | if self._index >= len(self._cells): 72 | self._cells.append(0) 73 | 74 | def left(self): 75 | if self._index > 0: 76 | self._index -= 1 77 | 78 | 79 | def run(chars): 80 | """Actual BrainFuck Interpreter.""" 81 | jump_table = create_jump_table(chars) 82 | ptr = Array() 83 | 84 | position = 0 85 | while position < len(chars): 86 | jitdriver.jit_merge_point(position=position, 87 | ptr=ptr, 88 | chars=chars, 89 | jump_table=jump_table) 90 | 91 | char = chars[position] 92 | 93 | if char == '>': 94 | ptr.right() 95 | 96 | elif char == '<': 97 | ptr.left() 98 | 99 | elif char == '+': 100 | ptr.increment() 101 | 102 | elif char == '-': 103 | ptr.decrement() 104 | 105 | elif char == '.': 106 | os.write(1, chr(ptr.get() % 256)) 107 | 108 | elif char == ',': 109 | ptr.set(ord(os.read(0, 1)[0])) 110 | 111 | elif char == '[' and ptr.get() == 0: 112 | position = jump_table[position] 113 | 114 | elif char == ']' and ptr.get() != 0: 115 | position = jump_table[position] 116 | 117 | position += 1 118 | 119 | 120 | def remove_comments(chars): 121 | codes = '<>[]-+,.' 122 | tmp = "" 123 | for c in chars: 124 | if c in codes: 125 | tmp += c 126 | return tmp 127 | 128 | 129 | def entry_point(argv): 130 | try: 131 | filename = argv[1] 132 | except IndexError: 133 | print "Usage: %s program.bf" % argv[0] 134 | return 1 135 | 136 | fp = os.open(filename, os.O_RDONLY, 0777) 137 | chars = "" 138 | while True: 139 | read = os.read(fp, 4096) 140 | if len(read) == 0: 141 | break 142 | chars += read 143 | os.close(fp) 144 | 145 | run(remove_comments(chars)) 146 | return 0 147 | 148 | 149 | def target(*args): 150 | return entry_point, None 151 | 152 | 153 | def jitpolicy(driver): 154 | from rpython.jit.codewriter.policy import JitPolicy 155 | return JitPolicy() 156 | 157 | 158 | if __name__ == "__main__": 159 | entry_point(sys.argv) 160 | -------------------------------------------------------------------------------- /step_by_step/4.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | Python Brainfuck interpreter. 6 | 7 | Jitted using http://morepypy.blogspot.fr/2011/04/tutorial-part-2-adding-jit.html 8 | """ 9 | 10 | import sys 11 | import os 12 | 13 | try: 14 | from rpython.rlib.jit import JitDriver, purefunction 15 | except ImportError: 16 | 17 | class JitDriver(object): 18 | def __init__(self, **kw): 19 | pass 20 | 21 | def jit_merge_point(self, **kw): 22 | pass 23 | 24 | def can_enter_jit(self, **kw): 25 | pass 26 | 27 | def purefunction(f): 28 | return f 29 | 30 | 31 | jitdriver = JitDriver(greens=['position', 'chars', 'jump_table'], 32 | reds=['ptr']) 33 | 34 | 35 | @purefunction 36 | def get_jump(jump_table, pos): 37 | return jump_table[pos] 38 | 39 | 40 | def create_jump_table(chars): 41 | jump_table = {} 42 | left_positions = [] 43 | 44 | position = 0 45 | for char in chars: 46 | if char == '[': 47 | left_positions.append(position) 48 | 49 | elif char == ']': 50 | left = left_positions.pop() 51 | right = position 52 | jump_table[left] = right 53 | jump_table[right] = left 54 | position += 1 55 | 56 | return jump_table 57 | 58 | 59 | class Array(object): 60 | def __init__(self): 61 | self._cells = [0] * 10000 # preallocation 62 | self._index = 0 63 | 64 | def get(self): 65 | return self._cells[self._index] 66 | 67 | def set(self, n): 68 | self._cells[self._index] = n 69 | 70 | def increment(self): 71 | self._cells[self._index] += 1 72 | 73 | def decrement(self): 74 | if self._cells[self._index] > 0: 75 | self._cells[self._index] -= 1 76 | 77 | def right(self): 78 | self._index += 1 79 | if self._index >= len(self._cells): 80 | self._cells.append(0) 81 | 82 | def left(self): 83 | if self._index > 0: 84 | self._index -= 1 85 | 86 | 87 | def run(chars): 88 | """Actual BrainFuck Interpreter.""" 89 | jump_table = create_jump_table(chars) 90 | ptr = Array() 91 | 92 | position = 0 93 | while position < len(chars): 94 | jitdriver.jit_merge_point(position=position, 95 | ptr=ptr, 96 | chars=chars, 97 | jump_table=jump_table) 98 | 99 | char = chars[position] 100 | 101 | if char == '>': 102 | ptr.right() 103 | 104 | elif char == '<': 105 | ptr.left() 106 | 107 | elif char == '+': 108 | ptr.increment() 109 | 110 | elif char == '-': 111 | ptr.decrement() 112 | 113 | elif char == '.': 114 | os.write(1, chr(ptr.get() % 256)) 115 | 116 | elif char == ',': 117 | ptr.set(ord(os.read(0, 1)[0])) 118 | 119 | elif char == '[' and ptr.get() == 0: 120 | position = get_jump(jump_table, position) 121 | 122 | elif char == ']' and ptr.get() != 0: 123 | position = get_jump(jump_table, position) 124 | 125 | position += 1 126 | 127 | 128 | def remove_comments(chars): 129 | codes = '<>[]-+,.' 130 | tmp = "" 131 | for c in chars: 132 | if c in codes: 133 | tmp += c 134 | return tmp 135 | 136 | 137 | def entry_point(argv): 138 | try: 139 | filename = argv[1] 140 | except IndexError: 141 | print "Usage: %s program.bf" % argv[0] 142 | return 1 143 | 144 | fp = os.open(filename, os.O_RDONLY, 0777) 145 | chars = "" 146 | while True: 147 | read = os.read(fp, 4096) 148 | if len(read) == 0: 149 | break 150 | chars += read 151 | os.close(fp) 152 | 153 | run(remove_comments(chars)) 154 | return 0 155 | 156 | 157 | def target(*args): 158 | return entry_point, None 159 | 160 | 161 | def jitpolicy(driver): 162 | from rpython.jit.codewriter.policy import JitPolicy 163 | return JitPolicy() 164 | 165 | 166 | if __name__ == "__main__": 167 | entry_point(sys.argv) 168 | --------------------------------------------------------------------------------