├── .gitignore ├── CMakeLists.txt ├── FindLLVM.cmake ├── README.md ├── bf.cpp ├── bfast.h ├── bfc ├── bfc1.cpp ├── bfcodegen.cpp ├── bfcodegen.h ├── bfcompiler.cpp ├── bfcompiler.h ├── bfjit.cpp ├── bfjit.h ├── bfparser.h └── test ├── factor.b ├── hanoi.b ├── hello.b ├── mandelbrot.b ├── oobrain.b └── rot13.b /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | 9 | # Compiled Static libraries 10 | *.lai 11 | *.la 12 | *.a 13 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(brainfuck) 3 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) 4 | 5 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) 6 | 7 | find_package(Boost 1.50.0 REQUIRED) 8 | find_package(LLVM 3.1 REQUIRED) 9 | set_property(GLOBAL PROPERTY COMPILE_FLAGS ${LLVM_COMPILE_FLAGS}) 10 | set_property(GLOBAL PROPERTY LINK_FLAGS ${LLVM_LDFLAGS}) 11 | set(CMAKE_EXE_LINKER_FLAGS ${LLVM_LDFLAGS}) 12 | 13 | INCLUDE_DIRECTORIES( 14 | ${Boost_INCLUDE_DIRS} 15 | ${LLVM_INCLUDE_DIR} 16 | ) 17 | 18 | add_executable(bfc1 bfast.h bfcodegen.h bfcodegen.cpp bfparser.h bfcompiler.h bfcompiler.cpp bfc1.cpp) 19 | TARGET_LINK_LIBRARIES(bfc1 ${LLVM_LDFLAGS} -L${LLVM_LIB_DIR} ${LLVM_LIBS_CORE} dl pthread) 20 | 21 | file(COPY ${CMAKE_SOURCE_DIR}/bfc DESTINATION ${EXECUTABLE_OUTPUT_PATH}) 22 | 23 | add_executable(bf bfast.h bfcodegen.h bfcodegen.cpp bfparser.h bfjit.h bfjit.cpp bf.cpp) 24 | TARGET_LINK_LIBRARIES(bf ${LLVM_LDFLAGS} -L${LLVM_LIB_DIR} ${LLVM_LIBS_JIT} dl pthread) 25 | -------------------------------------------------------------------------------- /FindLLVM.cmake: -------------------------------------------------------------------------------- 1 | # Detect LLVM and set various variable to link against the different component of LLVM 2 | # 3 | # NOTE: This is a modified version of the module originally found in the OpenGTL project 4 | # at www.opengtl.org 5 | # 6 | # LLVM_BIN_DIR : directory with LLVM binaries 7 | # LLVM_LIB_DIR : directory with LLVM library 8 | # LLVM_INCLUDE_DIR : directory with LLVM include 9 | # 10 | # LLVM_COMPILE_FLAGS : compile flags needed to build a program using LLVM headers 11 | # LLVM_LDFLAGS : ldflags needed to link 12 | # LLVM_LIBS_CORE : ldflags needed to link against a LLVM core library 13 | # LLVM_LIBS_JIT : ldflags needed to link against a LLVM JIT 14 | # LLVM_LIBS_JIT_OBJECTS : objects you need to add to your source when using LLVM JIT 15 | 16 | if (MSVC) 17 | set(LLVM_ROOT "C:/Program Files/LLVM") 18 | if (NOT IS_DIRECTORY ${LLVM_ROOT}) 19 | message(FATAL_ERROR "Could NOT find LLVM") 20 | endif () 21 | 22 | message(STATUS "Found LLVM: ${LLVM_ROOT}") 23 | set(LLVM_BIN_DIR ${LLVM_ROOT}/bin) 24 | set(LLVM_LIB_DIR ${LLVM_ROOT}/lib) 25 | set(LLVM_INCLUDE_DIR ${LLVM_ROOT}/include) 26 | 27 | set(LLVM_COMPILE_FLAGS "") 28 | set(LLVM_LDFLAGS "") 29 | set(LLVM_LIBS_CORE LLVMLinker LLVMArchive LLVMBitWriter LLVMBitReader LLVMInstrumentation LLVMScalarOpts LLVMipo LLVMTransformUtils LLVMipa LLVMAnalysis LLVMTarget LLVMMC LLVMCore LLVMSupport LLVMSystem) 30 | set(LLVM_LIBS_JIT LLVMX86AsmParser LLVMX86AsmPrinter LLVMX86CodeGen LLVMSelectionDAG LLVMAsmPrinter LLVMX86Info LLVMJIT LLVMExecutionEngine LLVMCodeGen LLVMScalarOpts LLVMTransformUtils LLVMipa LLVMAnalysis LLVMTarget LLVMMC LLVMCore LLVMSupport LLVMSystem) 31 | set(LLVM_LIBS_JIT_OBJECTS "") 32 | endif (MSVC) 33 | 34 | if (LLVM_INCLUDE_DIR) 35 | set(LLVM_FOUND TRUE) 36 | else (LLVM_INCLUDE_DIR) 37 | 38 | find_program(LLVM_CONFIG_EXECUTABLE 39 | NAMES llvm-config 40 | PATHS 41 | /opt/local/bin 42 | /opt/llvm/2.6/bin 43 | /opt/llvm/bin 44 | ) 45 | 46 | find_program(LLVM_GCC_EXECUTABLE 47 | NAMES llvm-gcc llvmgcc 48 | PATHS 49 | /opt/local/bin 50 | /opt/llvm/2.6/bin 51 | /opt/llvm/bin 52 | /Developer/usr/bin 53 | /usr/lib/llvm/llvm/gcc-4.2/bin 54 | ) 55 | 56 | find_program(LLVM_GXX_EXECUTABLE 57 | NAMES llvm-g++ llvmg++ 58 | PATHS 59 | /opt/local/bin 60 | /opt/llvm/2.6/bin 61 | /opt/llvm/bin 62 | /Developer/usr/bin 63 | /usr/lib/llvm/llvm/gcc-4.2/bin 64 | ) 65 | 66 | if(LLVM_GCC_EXECUTABLE) 67 | MESSAGE(STATUS "LLVM llvm-gcc found at: ${LLVM_GCC_EXECUTABLE}") 68 | #CMAKE_FORCE_C_COMPILER(${LLVM_GCC_EXECUTABLE} GNU) 69 | endif(LLVM_GCC_EXECUTABLE) 70 | 71 | if(LLVM_GXX_EXECUTABLE) 72 | MESSAGE(STATUS "LLVM llvm-g++ found at: ${LLVM_GXX_EXECUTABLE}") 73 | #CMAKE_FORCE_CXX_COMPILER(${LLVM_GXX_EXECUTABLE} GNU) 74 | endif(LLVM_GXX_EXECUTABLE) 75 | 76 | if(LLVM_CONFIG_EXECUTABLE) 77 | MESSAGE(STATUS "LLVM llvm-config found at: ${LLVM_CONFIG_EXECUTABLE}") 78 | else(LLVM_CONFIG_EXECUTABLE) 79 | MESSAGE(FATAL_ERROR "Could NOT find LLVM") 80 | endif(LLVM_CONFIG_EXECUTABLE) 81 | 82 | MACRO(FIND_LLVM_LIBS LLVM_CONFIG_EXECUTABLE _libname_ LIB_VAR OBJECT_VAR) 83 | exec_program( ${LLVM_CONFIG_EXECUTABLE} ARGS --libs ${_libname_} OUTPUT_VARIABLE ${LIB_VAR} ) 84 | STRING(REGEX MATCHALL "[^ ]*[.]o[ $]" ${OBJECT_VAR} ${${LIB_VAR}}) 85 | SEPARATE_ARGUMENTS(${OBJECT_VAR}) 86 | STRING(REGEX REPLACE "[^ ]*[.]o[ $]" "" ${LIB_VAR} ${${LIB_VAR}}) 87 | ENDMACRO(FIND_LLVM_LIBS) 88 | 89 | 90 | # this function borrowed from PlPlot, Copyright (C) 2006 Alan W. Irwin 91 | function(TRANSFORM_VERSION numerical_result version) 92 | # internal_version ignores everything in version after any character that 93 | # is not 0-9 or ".". This should take care of the case when there is 94 | # some non-numerical data in the patch version. 95 | #message(STATUS "DEBUG: version = ${version}") 96 | string(REGEX REPLACE "^([0-9.]+).*$" "\\1" internal_version ${version}) 97 | 98 | # internal_version is normally a period-delimited triplet string of the form 99 | # "major.minor.patch", but patch and/or minor could be missing. 100 | # Transform internal_version into a numerical result that can be compared. 101 | string(REGEX REPLACE "^([0-9]*).+$" "\\1" major ${internal_version}) 102 | string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" minor ${internal_version}) 103 | #string(REGEX REPLACE "^[0-9]*\\.[0-9]*\\.([0-9]*)$" "\\1" patch ${internal_version}) 104 | 105 | #if(NOT patch MATCHES "[0-9]+") 106 | # set(patch 0) 107 | #endif(NOT patch MATCHES "[0-9]+") 108 | set(patch 0) 109 | 110 | if(NOT minor MATCHES "[0-9]+") 111 | set(minor 0) 112 | endif(NOT minor MATCHES "[0-9]+") 113 | 114 | if(NOT major MATCHES "[0-9]+") 115 | set(major 0) 116 | endif(NOT major MATCHES "[0-9]+") 117 | #message(STATUS "DEBUG: internal_version = ${internal_version}") 118 | #message(STATUS "DEBUG: major = ${major}") 119 | #message(STATUS "DEBUG: minor= ${minor}") 120 | #message(STATUS "DEBUG: patch = ${patch}") 121 | math(EXPR internal_numerical_result 122 | #"${major}*1000000 + ${minor}*1000 + ${patch}" 123 | "${major}*1000000 + ${minor}*1000" 124 | ) 125 | #message(STATUS "DEBUG: ${numerical_result} = ${internal_numerical_result}") 126 | set(${numerical_result} ${internal_numerical_result} PARENT_SCOPE) 127 | endfunction(TRANSFORM_VERSION) 128 | 129 | 130 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --version OUTPUT_VARIABLE LLVM_STRING_VERSION ) 131 | MESSAGE(STATUS "LLVM version: " ${LLVM_STRING_VERSION}) 132 | transform_version(LLVM_VERSION ${LLVM_STRING_VERSION}) 133 | 134 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --bindir OUTPUT_VARIABLE LLVM_BIN_DIR ) 135 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --libdir OUTPUT_VARIABLE LLVM_LIB_DIR ) 136 | #MESSAGE(STATUS "LLVM lib dir: " ${LLVM_LIB_DIR}) 137 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIR ) 138 | 139 | 140 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --cxxflags OUTPUT_VARIABLE LLVM_COMPILE_FLAGS ) 141 | MESSAGE(STATUS "LLVM CXX flags: " ${LLVM_COMPILE_FLAGS}) 142 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS ) 143 | MESSAGE(STATUS "LLVM LD flags: " ${LLVM_LDFLAGS}) 144 | exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --libs core ipa ipo instrumentation bitreader bitwriter linker OUTPUT_VARIABLE LLVM_LIBS_CORE ) 145 | MESSAGE(STATUS "LLVM core libs: " ${LLVM_LIBS_CORE}) 146 | IF(APPLE AND UNIVERSAL) 147 | FIND_LLVM_LIBS( ${LLVM_CONFIG_EXECUTABLE} "jit native x86 PowerPC ARM" LLVM_LIBS_JIT LLVM_LIBS_JIT_OBJECTS ) 148 | ELSE(APPLE AND UNIVERSAL) 149 | FIND_LLVM_LIBS( ${LLVM_CONFIG_EXECUTABLE} "jit native" LLVM_LIBS_JIT LLVM_LIBS_JIT_OBJECTS ) 150 | ENDIF(APPLE AND UNIVERSAL) 151 | MESSAGE(STATUS "LLVM JIT libs: " ${LLVM_LIBS_JIT}) 152 | MESSAGE(STATUS "LLVM JIT objs: " ${LLVM_LIBS_JIT_OBJECTS}) 153 | 154 | if(LLVM_INCLUDE_DIR) 155 | set(LLVM_FOUND TRUE) 156 | endif(LLVM_INCLUDE_DIR) 157 | 158 | if(LLVM_FOUND) 159 | message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIR}") 160 | else(LLVM_FOUND) 161 | if(LLVM_FIND_REQUIRED) 162 | message(FATAL_ERROR "Could NOT find LLVM") 163 | endif(LLVM_FIND_REQUIRED) 164 | endif(LLVM_FOUND) 165 | 166 | endif (LLVM_INCLUDE_DIR) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | brainfuck 2 | ========= 3 | 4 | [Brainfuck](http://en.wikipedia.org/wiki/Brainfuck) is an esoteric programming language noted for its extreme minimalism. It is a [Turing tarpit](http://en.wikipedia.org/wiki/Turing_tarpit), designed to challenge and amuse programmers, and was not made to be suitable for practical use. It was created in 1993 by Urban Müller. 5 | 6 | The project contains a full-functional compiler and a JIT runner for the language. 7 | 8 | Installation 9 | ------------ 10 | 11 | Before installing the program, you'll need to install [LLVM](http://llvm.org) 3.1 or higher and a working C/C++ linker, [Clang](http://clang.llvm.org) is recommended as [GCC](http://gcc.gnu.org) failed to link on some platforms. 12 | 13 | Usage 14 | ----- 15 | 16 | * `bf` is the JIT runner, which can run brainfuck program directly 17 | * `bfc` is the compiler, can be invoked as `bfc [-o output] src`, default output file name is `a.out` 18 | 19 | Notes 20 | ----- 21 | 22 | You can find some Brainfuck programs under `test` directory 23 | 24 | Have Fun. 25 | 26 | -------------------------------------------------------------------------------- /bf.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // bf.cpp 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-9. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | #include "bfjit.h" 13 | 14 | // TODO: Use some real command line option parser 15 | int main(int argc, const char * argv[]) 16 | { 17 | brainfuck::jit::main_func_type fp; 18 | if (argc>1) { 19 | std::ifstream src(argv[1]); 20 | fp=brainfuck::jit::compile(src); 21 | } else { 22 | fp=brainfuck::jit::compile(std::cin); 23 | } 24 | fp(); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /bfast.h: -------------------------------------------------------------------------------- 1 | // 2 | // bfast.h 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-8. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #ifndef brainfuck_bfast_h 16 | #define brainfuck_bfast_h 17 | 18 | namespace brainfuck { 19 | namespace ast { 20 | struct MoveLeft { 21 | // Minimized container interface, used by Boost.Spirit 22 | typedef size_t value_type; 23 | inline int end() const { return 0; } 24 | inline void insert(int /*unused*/, char /*unused*/) { count_++; } 25 | 26 | inline MoveLeft() : count_(0) {} 27 | size_t count_; 28 | }; 29 | 30 | inline std::ostream &operator << (std::ostream &os, const MoveLeft &n) { 31 | os << "MoveLeft[" << n.count_ << ']'; 32 | return os; 33 | } 34 | 35 | struct MoveRight { 36 | // Minimized container interface, used by Boost.Spirit 37 | typedef size_t value_type; 38 | inline int end() const { return 0; } 39 | inline void insert(int /*unused*/, char /*unused*/) { count_++; } 40 | 41 | inline MoveRight() : count_(0) {} 42 | size_t count_; 43 | }; 44 | 45 | inline std::ostream &operator<<(std::ostream &os, const MoveRight &n) { 46 | os << "MoveRight[" << n.count_ << ']'; 47 | return os; 48 | } 49 | 50 | struct Add { 51 | // Minimized container interface, used by Boost.Spirit 52 | typedef size_t value_type; 53 | inline int end() const { return 0; } 54 | inline void insert(int /*unused*/, char c) { if(c=='+') count_++; } 55 | 56 | inline Add() : count_(0) {} 57 | size_t count_; 58 | }; 59 | 60 | inline std::ostream &operator<<(std::ostream &os, const Add &n) { 61 | os << "Add[" << n.count_ << ']'; 62 | return os; 63 | } 64 | 65 | struct Minus { 66 | // Minimized container interface, used by Boost.Spirit 67 | typedef size_t value_type; 68 | inline int end() const { return 0; } 69 | inline void insert(int /*unused*/, char c) { if(c=='-') count_++; } 70 | 71 | inline Minus() : count_(0) {} 72 | size_t count_; 73 | }; 74 | 75 | inline std::ostream &operator<<(std::ostream &os, const Minus &n) { 76 | os << "Minus[" << n.count_ << ']'; 77 | return os; 78 | } 79 | 80 | struct Input { 81 | inline Input() {} 82 | inline Input(char /* unused */) {} 83 | }; 84 | 85 | inline std::ostream &operator<<(std::ostream &os, const Input &n) { 86 | os << "Input"; 87 | return os; 88 | } 89 | 90 | struct Output { 91 | inline Output() {} 92 | inline Output(char /* unused */) {} 93 | }; 94 | 95 | inline std::ostream &operator<<(std::ostream &os, const Output &n) { 96 | os << "Output"; 97 | return os; 98 | } 99 | 100 | typedef boost::variant Primitive; 101 | 102 | struct Loop; 103 | typedef boost::variant Command; 104 | typedef std::vector Commands; 105 | typedef boost::shared_ptr Commands_ptr; 106 | 107 | struct Loop { 108 | // Minimized container interface, used by Boost.Spirit 109 | typedef std::vector value_type; 110 | void insert(Commands::iterator i, const Commands &cmds); 111 | Commands::iterator end(); 112 | Commands::const_iterator end() const; 113 | 114 | Loop(); 115 | Commands_ptr commands_; 116 | }; 117 | 118 | inline Loop::Loop() : commands_(new Commands) 119 | {} 120 | 121 | inline void Loop::insert(Commands::iterator i, const Commands &cmds) { 122 | commands_->insert(i, cmds.begin(), cmds.end()); 123 | } 124 | 125 | inline Commands::iterator Loop::end() { 126 | return commands_->end(); 127 | } 128 | 129 | inline Commands::const_iterator Loop::end() const { 130 | return commands_->end(); 131 | } 132 | 133 | inline std::ostream &operator<<(std::ostream &os, const Loop &n) { 134 | os << "Branch["; 135 | for(Commands::const_iterator i=n.commands_->begin(); i!=n.commands_->end(); ++i){ 136 | if(i!=n.commands_->begin()) os << ','; 137 | os << *i; 138 | } 139 | os << ']'; 140 | return os; 141 | } 142 | 143 | typedef Commands Program; 144 | 145 | inline std::ostream &operator<<(std::ostream &os, const Program &n) { 146 | os << "Program["; 147 | for(Program::const_iterator i=n.begin(); i!=n.end(); ++i){ 148 | if(i!=n.begin()) os << ','; 149 | os << *i; 150 | } 151 | os << ']'; 152 | return os; 153 | } 154 | } // End of namespace ast 155 | } // End of namespace brainfuck 156 | 157 | #endif 158 | -------------------------------------------------------------------------------- /bfc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from optparse import OptionParser 3 | import sys 4 | import os 5 | 6 | 7 | bfc=os.path.abspath(sys.argv[0]) 8 | bfc1=os.path.join(os.path.dirname(bfc), "bfc1") 9 | llvm_bin_dir=os.popen("llvm-config --bindir").read().strip() 10 | if len(llvm_bin_dir)<=0: 11 | print >> sys.stderr, "LLVM not found" 12 | sys.exit(1) 13 | llc=os.path.join(llvm_bin_dir, "llc") 14 | linker=os.popen("which clang").read().strip() 15 | if len(linker)<=0: 16 | linker=os.popen("which gcc").read().strip() 17 | if len(linker)<=0: 18 | linker=os.popen("which cc").read().strip() 19 | if len(linker)<=0: 20 | print >> sys.stderr, "Clang or GCC not found" 21 | sys.exit(1) 22 | 23 | cmd_tmpl=""" "%s" "%s" | "%s" -O3 | "%s" -pipe -o "%s" -x assembler -""" 24 | 25 | parser=OptionParser() 26 | parser.add_option("-o", "--output", dest="executable", help="write executable to FILE", metavar="FILE", default="./a.out") 27 | (options, args)=parser.parse_args() 28 | if len(args)<=0 : 29 | print >> sys.stderr, os.path.basename(bfc)+": error: no input files" 30 | sys.exit(1) 31 | cmd=cmd_tmpl % (bfc1, args[0], llc, linker, options.executable) 32 | os.system(cmd) 33 | -------------------------------------------------------------------------------- /bfc1.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-9. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | #include "bfcompiler.h" 13 | 14 | // TODO: Use some real command line option parser 15 | int main(int argc, const char * argv[]) 16 | { 17 | brainfuck::compiler comp; 18 | if (argc>1) { 19 | std::ifstream src(argv[1]); 20 | if (argc>2) { 21 | std::ofstream dest(argv[2]); 22 | comp.bfc(src, dest); 23 | } else { 24 | comp.bfc(src, std::cout); 25 | } 26 | } else { 27 | comp.bfc(std::cin, std::cout); 28 | } 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /bfcodegen.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // bfcodegen.cpp 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-8. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #include "bfcodegen.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | using namespace llvm; 18 | namespace brainfuck { 19 | namespace details { 20 | 21 | inline ConstantInt *const_int(IntegerType *t, int64_t n=0, bool is_signed=false) { 22 | return ConstantInt::get(t, n, is_signed); 23 | } 24 | 25 | struct context { 26 | context(Module &m, unsigned int cell_size, size_t storage_size) 27 | : module(m) 28 | , ctx(module.getContext()) 29 | , builder(ctx) 30 | , CellType(IntegerType::get(ctx, cell_size)) 31 | , StorageType(ArrayType::get(CellType, storage_size)) 32 | , SPType(IntegerType::get(ctx, sizeof(storage_size)*8)) 33 | , storage(new GlobalVariable(m, 34 | StorageType, 35 | false, 36 | GlobalValue::InternalLinkage, 37 | 0, 38 | "s")) 39 | , sp(new GlobalVariable(m, 40 | SPType, 41 | false, 42 | GlobalValue::InternalLinkage, 43 | 0, 44 | "sp")) 45 | , get_char_(0) 46 | , put_char_(0) 47 | , entry_(0) 48 | { 49 | // Initialize storage 50 | { 51 | Constant *init=ConstantArray::get(StorageType, std::vector(0, const_int(IntegerType::getInt32Ty(ctx)))); 52 | storage->setInitializer(init); 53 | } 54 | // Initialize sp 55 | { 56 | sp->setInitializer(const_int(SPType, 0)); 57 | } 58 | // Initialize external functions 59 | { 60 | FunctionType *FT = FunctionType::get(CellType, false); 61 | get_char_=Function::Create(FT, Function::ExternalLinkage, "getchar", &module); 62 | } 63 | { 64 | std::vector args(1, CellType); 65 | FunctionType *FT = FunctionType::get(Type::getVoidTy(ctx), args, false); 66 | put_char_=Function::Create(FT, Function::ExternalLinkage, "putchar", &module); 67 | } 68 | // Initialize entry point, which is a function with name 'main' 69 | { 70 | FunctionType *MainType=FunctionType::get(Type::getVoidTy(m.getContext()), false); 71 | entry_ = Function::Create(MainType, Function::ExternalLinkage, "main", &m); 72 | BasicBlock *BB = BasicBlock::Create(m.getContext(), "", entry_); 73 | builder.SetInsertPoint(BB); 74 | } 75 | } 76 | 77 | ~context() { 78 | // Close up function 'main' 79 | builder.CreateRetVoid(); 80 | llvm::verifyFunction(*entry_); 81 | } 82 | 83 | /// Return pointer to current 84 | Value *current() { 85 | std::vector idx; 86 | idx.push_back(const_int(IntegerType::getInt32Ty(ctx))); 87 | idx.push_back(builder.CreateLoad(sp)); 88 | return builder.Insert(GetElementPtrInst::Create(storage, idx)); 89 | } 90 | 91 | Instruction *get_char() { 92 | return builder.CreateCall(get_char_); 93 | } 94 | 95 | Instruction *put_char(Value *arg) { 96 | return builder.CreateCall(put_char_, arg); 97 | } 98 | 99 | Module &module; 100 | LLVMContext &ctx; 101 | IRBuilder<> builder; 102 | 103 | // Types 104 | IntegerType *CellType; 105 | ArrayType *StorageType; 106 | IntegerType *SPType; 107 | 108 | // Global Variables 109 | GlobalVariable *storage; 110 | GlobalVariable *sp; 111 | 112 | // Predefined Functions 113 | Function *get_char_; 114 | Function *put_char_; 115 | 116 | // Entry Point 117 | Function *entry_; 118 | }; // End of context 119 | 120 | struct codegen_visitor : public boost::static_visitor { 121 | codegen_visitor(context &ctx) : ctx_(ctx) {} 122 | 123 | template 124 | void operator()(const T &n) const { 125 | codegen(n); 126 | } 127 | 128 | void codegen(const ast::MoveLeft &n) const { 129 | // sp-=n.count_ 130 | Value *result=ctx_.builder.CreateSub(ctx_.builder.CreateLoad(ctx_.sp), 131 | const_int(ctx_.SPType, n.count_)); 132 | ctx_.builder.CreateStore(result, ctx_.sp); 133 | } 134 | 135 | void codegen(const ast::MoveRight &n) const { 136 | // sp+=n.count_ 137 | Value *result=ctx_.builder.CreateAdd(ctx_.builder.CreateLoad(ctx_.sp), 138 | const_int(ctx_.SPType, n.count_)); 139 | ctx_.builder.CreateStore(result, ctx_.sp); 140 | } 141 | 142 | void codegen(const ast::Add &n) const { 143 | // storage[sp]+=n.count_ 144 | Value *current=ctx_.current(); 145 | Value *result=ctx_.builder.CreateAdd(ctx_.builder.CreateLoad(current), 146 | const_int(ctx_.CellType, n.count_)); 147 | ctx_.builder.CreateStore(result, current); 148 | } 149 | 150 | void codegen(const ast::Minus &n) const { 151 | // storage[sp]-=n.count_ 152 | Value *current=ctx_.current(); 153 | Value *result=ctx_.builder.CreateSub(ctx_.builder.CreateLoad(current), 154 | const_int(ctx_.CellType, n.count_)); 155 | ctx_.builder.CreateStore(result, current); 156 | } 157 | 158 | void codegen(const ast::Input &n) const { 159 | // storage[sp]=get_char() 160 | ctx_.builder.CreateStore(ctx_.get_char(), ctx_.current()); 161 | } 162 | 163 | void codegen(const ast::Output &n) const { 164 | // put_char(storage[sp]) 165 | ctx_.put_char(ctx_.builder.CreateLoad(ctx_.current())); 166 | } 167 | 168 | void codegen(const ast::Primitive &n) const { 169 | boost::apply_visitor(*this, n); 170 | } 171 | 172 | void codegen(const ast::Loop &n) const { 173 | // while(storage[sp]) { ... } 174 | // 175 | // while: 176 | // test storage[sp]!=0 177 | // branch true :wbegin, false :wend 178 | // wbegin: 179 | // body 180 | // goto :while 181 | // wend: 182 | // after loop 183 | Function *TheFunction = ctx_.builder.GetInsertBlock()->getParent(); 184 | BasicBlock *WhileBB = BasicBlock::Create(ctx_.ctx, "", TheFunction); 185 | BasicBlock *WBeginBB = BasicBlock::Create(ctx_.ctx, "", TheFunction); 186 | BasicBlock *WEndBB = BasicBlock::Create(ctx_.ctx, "", TheFunction); 187 | 188 | // Enter the while loop 189 | ctx_.builder.CreateBr(WhileBB); 190 | ctx_.builder.SetInsertPoint(WhileBB); 191 | 192 | // While condition 193 | Value *cur=ctx_.builder.CreateLoad(ctx_.current()); 194 | Value *cond=ctx_.builder.CreateICmpNE(cur, const_int(ctx_.CellType, 0)); 195 | ctx_.builder.CreateCondBr(cond, WBeginBB, WEndBB); 196 | 197 | // While body 198 | ctx_.builder.SetInsertPoint(WBeginBB); 199 | codegen(*(n.commands_)); 200 | 201 | // Jump to begin 202 | ctx_.builder.CreateBr(WhileBB); 203 | 204 | // After while 205 | ctx_.builder.SetInsertPoint(WEndBB); 206 | } 207 | 208 | void codegen(const ast::Command &n) const { 209 | boost::apply_visitor(*this, n); 210 | } 211 | 212 | void codegen(const ast::Commands &n) const { 213 | for (ast::Commands::const_iterator i=n.begin(); i!=n.end(); ++i) { 214 | codegen(*i); 215 | } 216 | } 217 | 218 | context &ctx_; 219 | }; // End of codegen_visitor 220 | } // End of namespace details 221 | 222 | void codegen(Module &m, const ast::Program &n, unsigned int cell_size, size_t storage_size) { 223 | { 224 | details::context ctx(m, cell_size, storage_size); 225 | details::codegen_visitor generator(ctx); 226 | generator(n); 227 | } 228 | } 229 | } // End of namespace brainfuck 230 | -------------------------------------------------------------------------------- /bfcodegen.h: -------------------------------------------------------------------------------- 1 | // 2 | // bfcodegen.h 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-8. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #ifndef __STDC_CONSTANT_MACROS 10 | # define __STDC_CONSTANT_MACROS 11 | #endif 12 | #ifndef __STDC_FORMAT_MACROS 13 | # define __STDC_FORMAT_MACROS 14 | #endif 15 | #ifndef __STDC_LIMIT_MACROS 16 | # define __STDC_LIMIT_MACROS 17 | #endif 18 | 19 | #include 20 | #include "bfast.h" 21 | 22 | #ifndef brainfuck_bfcodegen_h 23 | #define brainfuck_bfcodegen_h 24 | 25 | namespace brainfuck { 26 | void codegen(llvm::Module &m, const ast::Program &n, unsigned int cell_size=8, size_t storage_size=30000); 27 | } // End of namespace brainfuck 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /bfcompiler.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // bfcompiler.cpp 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-9. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #ifndef __STDC_CONSTANT_MACROS 10 | # define __STDC_CONSTANT_MACROS 11 | #endif 12 | #ifndef __STDC_FORMAT_MACROS 13 | # define __STDC_FORMAT_MACROS 14 | #endif 15 | #ifndef __STDC_LIMIT_MACROS 16 | # define __STDC_LIMIT_MACROS 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "bfparser.h" 26 | #include "bfast.h" 27 | #include "bfcodegen.h" 28 | #include "bfcompiler.h" 29 | 30 | namespace brainfuck { 31 | void compiler::bfc(std::istream &src, std::ostream &ir) { 32 | std::string s((std::istreambuf_iterator(src)), 33 | std::istreambuf_iterator()); 34 | ast::Program prog; 35 | bool ret=parser::parse(s.begin(), s.end(), prog); 36 | if (!ret) { 37 | std::cerr << "Syntax error\n"; 38 | exit(1); 39 | } 40 | 41 | llvm::LLVMContext &c=llvm::getGlobalContext(); 42 | llvm::Module *m=new llvm::Module("brainfuck", c); 43 | brainfuck::codegen(*m, prog); 44 | 45 | llvm::raw_os_ostream os(ir); 46 | os << *m; 47 | } 48 | } // End of namespace brainfuck 49 | -------------------------------------------------------------------------------- /bfcompiler.h: -------------------------------------------------------------------------------- 1 | // 2 | // bfcompiler.h 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-9. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #ifndef brainfuck_bfcompiler_h 14 | #define brainfuck_bfcompiler_h 15 | 16 | namespace brainfuck { 17 | struct compiler { 18 | // Compile source into IR 19 | void bfc(std::istream &src, std::ostream &ir); 20 | }; 21 | } // End of namespace brainfuck 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /bfjit.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // bfjit.cpp 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-8. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #ifndef __STDC_CONSTANT_MACROS 10 | # define __STDC_CONSTANT_MACROS 11 | #endif 12 | #ifndef __STDC_FORMAT_MACROS 13 | # define __STDC_FORMAT_MACROS 14 | #endif 15 | #ifndef __STDC_LIMIT_MACROS 16 | # define __STDC_LIMIT_MACROS 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "bfast.h" 33 | #include "bfparser.h" 34 | #include "bfcodegen.h" 35 | #include "bfjit.h" 36 | 37 | using namespace llvm; 38 | 39 | namespace brainfuck { 40 | namespace jit { 41 | struct jit_engine { 42 | jit_engine(int optimization_level=0); 43 | main_func_type compile(const ast::Program &prog); 44 | 45 | int optimization_level_; 46 | }; // End of jit_engine 47 | 48 | jit_engine::jit_engine(int optimization_level) 49 | : optimization_level_(optimization_level) 50 | { 51 | llvm::InitializeNativeTarget(); 52 | } 53 | 54 | main_func_type jit_engine::compile(const ast::Program &prog) { 55 | llvm::LLVMContext &c=llvm::getGlobalContext(); 56 | llvm::Module *m=new llvm::Module("brainfuck", c); 57 | brainfuck::codegen(*m, prog); 58 | //m->dump(); 59 | 60 | std::string ErrStr; 61 | ExecutionEngine *TheExecutionEngine = EngineBuilder(m).setErrorStr(&ErrStr).create(); 62 | if (!TheExecutionEngine) { 63 | fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str()); 64 | exit(1); 65 | } 66 | Function *f_main=m->getFunction("main"); 67 | 68 | // Optimize, target dependant 69 | if(optimization_level_>0) 70 | { 71 | FunctionPassManager OurFPM(m); 72 | 73 | // Set up the optimizer pipeline. Start with registering info about how the 74 | // target lays out data structures. 75 | OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); 76 | // Provide basic AliasAnalysis support for GVN. 77 | OurFPM.add(createBasicAliasAnalysisPass()); 78 | // Do simple "peephole" optimizations and bit-twiddling optzns. 79 | OurFPM.add(createInstructionCombiningPass()); 80 | // Reassociate expressions. 81 | OurFPM.add(createReassociatePass()); 82 | // Eliminate Common SubExpressions. 83 | OurFPM.add(createGVNPass()); 84 | // Simplify the control flow graph (deleting unreachable blocks, etc). 85 | OurFPM.add(createCFGSimplificationPass()); 86 | //OurFPM.add(createLoopSimplifyPass()); 87 | //OurFPM.add(createBlockPlacementPass()); 88 | //OurFPM.add(createConstantPropagationPass()); 89 | 90 | OurFPM.doInitialization(); 91 | 92 | OurFPM.run(*f_main); 93 | } 94 | 95 | //m->dump(); 96 | 97 | void *rp=TheExecutionEngine->getPointerToFunction(f_main); 98 | main_func_type fp=reinterpret_cast(rp); 99 | return fp; 100 | } 101 | 102 | main_func_type compile(std::istream &src) { 103 | jit_engine engine; 104 | ast::Program prog; 105 | std::string s((std::istreambuf_iterator(src)), 106 | std::istreambuf_iterator()); 107 | bool ret=parser::parse(s.begin(), s.end(), prog); 108 | if (!ret) { 109 | std::cerr << "Syntax error\n"; 110 | exit(1); 111 | } 112 | return engine.compile(prog); 113 | } 114 | } // End of namespace jit 115 | } // End of namespace brainfuck 116 | 117 | -------------------------------------------------------------------------------- /bfjit.h: -------------------------------------------------------------------------------- 1 | // 2 | // bfjit.h 3 | // brainfuck 4 | // 5 | // Created by Xu Chen on 12-9-8. 6 | // Copyright (c) 2012 Xu Chen. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | #ifndef brainfuck_bfjit_h 12 | #define brainfuck_bfjit_h 13 | 14 | namespace brainfuck { 15 | namespace jit { 16 | typedef void (*main_func_type)(); 17 | 18 | main_func_type compile(std::istream &is); 19 | } // End of namespace jit 20 | } // End of namespace brainfuck 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /bfparser.h: -------------------------------------------------------------------------------- 1 | // bfparser.h 2 | // brainfuck 3 | // 4 | // Created by Xu Chen on 12-9-8. 5 | // Copyright (c) 2012 Xu Chen. All rights reserved. 6 | // 7 | 8 | //#define BOOST_SPIRIT_DEBUG 9 | #include 10 | #include 11 | #include "bfast.h" 12 | 13 | #ifndef brainfuck_bfparser_h 14 | #define brainfuck_bfparser_h 15 | 16 | namespace brainfuck { 17 | namespace parser { 18 | template 19 | struct skipper : boost::spirit::qi::grammar { 20 | skipper() : skipper::base_type(start) { 21 | using boost::spirit::ascii::char_; 22 | using boost::spirit::no_skip; 23 | using boost::spirit::lexeme; 24 | // All chars other than these 8 are ignored 25 | start = char_ - char_("-<>+,.[]") 26 | ; 27 | } 28 | boost::spirit::qi::rule start; 29 | }; 30 | 31 | template 32 | struct parser : boost::spirit::qi::grammar > { 33 | parser() : parser::base_type(program) { 34 | using boost::spirit::ascii::char_; 35 | 36 | program = +command >> boost::spirit::eoi 37 | ; 38 | 39 | loop = '[' >> *command >> ']' 40 | ; 41 | 42 | command = loop 43 | | primitive 44 | ; 45 | 46 | primitive = moveleft 47 | | moveright 48 | | add 49 | | minus 50 | | input 51 | | output 52 | ; 53 | 54 | moveleft = +char_('<') 55 | ; 56 | 57 | moveright = +char_('>') 58 | ; 59 | 60 | add = +char_('+') 61 | ; 62 | 63 | minus = +char_('-') 64 | ; 65 | 66 | input = char_(',') 67 | ; 68 | 69 | output = char_('.') 70 | ; 71 | 72 | BOOST_SPIRIT_DEBUG_NODE(program); 73 | BOOST_SPIRIT_DEBUG_NODE(command); 74 | BOOST_SPIRIT_DEBUG_NODE(loop); 75 | BOOST_SPIRIT_DEBUG_NODE(primitive); 76 | BOOST_SPIRIT_DEBUG_NODE(moveleft); 77 | BOOST_SPIRIT_DEBUG_NODE(moveright); 78 | BOOST_SPIRIT_DEBUG_NODE(add); 79 | BOOST_SPIRIT_DEBUG_NODE(minus); 80 | BOOST_SPIRIT_DEBUG_NODE(input); 81 | BOOST_SPIRIT_DEBUG_NODE(output); 82 | } 83 | 84 | bool parse(Iterator first, Iterator last, ast::Program& prog) { 85 | return boost::spirit::qi::phrase_parse(first, last, *this, skipper(), prog); 86 | } 87 | 88 | boost::spirit::qi::rule > program; 89 | boost::spirit::qi::rule > command; 90 | boost::spirit::qi::rule > loop; 91 | boost::spirit::qi::rule > primitive; 92 | boost::spirit::qi::rule > moveleft; 93 | boost::spirit::qi::rule > moveright; 94 | boost::spirit::qi::rule > add; 95 | boost::spirit::qi::rule > minus; 96 | boost::spirit::qi::rule > input; 97 | boost::spirit::qi::rule > output; 98 | }; // End of parser 99 | 100 | template 101 | bool parse(Iterator first, Iterator last, ast::Program &prog) { 102 | parser parser; 103 | return parser.parse(first, last, prog); 104 | } 105 | } // End of namespace parser 106 | } // End of namespace brainfuck 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /test/factor.b: -------------------------------------------------------------------------------- 1 | * factor an arbitrarily large positive integer 2 | * 3 | * Copyright (C) 1999 by Brian Raiter 4 | * under the GNU General Public License 5 | 6 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>- 7 | 8 | * 9 | * read in the number 10 | * 11 | 12 | <<<<<<<<<+ 13 | [-[>>>>>>>>>>][-]<<<<<<<<<<[[->>>>>>>>>>+<<<<<<<<<<]<<<<<<<<<<] 14 | >>>>>>>>>>,----------] 15 | >>>>>>>>>>[------------------------------------->>>>>>>>>->] 16 | <[+>[>>>>>>>>>+>]<-<<<<<<<<<<]- 17 | 18 | * 19 | * display the number and initialize the loop variable to two 20 | * 21 | 22 | [>++++++++++++++++++++++++++++++++++++++++++++++++. 23 | ------------------------------------------------<<<<<<<<<<<] 24 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. 25 | --------------------------.[-] 26 | >>>>>>>>>>>>++<<<<+ 27 | 28 | * 29 | * the main loop 30 | * 31 | 32 | [ [-]>> 33 | 34 | * 35 | * make copies of the number and the loop variable 36 | * 37 | 38 | [>>>>[-]>[-]>[-]>[-] 39 | >[-]>[-] 40 | <<<<<<<[->>>+>+<<<<]>>>>>>>>] 41 | <<<<<<<<<<[>>>>>>[-<<<<+>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>> 42 | [>[->>>+>>+<<<<<]>>>>>>>>>] 43 | <<<<<<<<<<[>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>> 44 | 45 | * 46 | * divide the number by the loop variable 47 | * 48 | 49 | [>>>[-]>>>[-]>[-]>>>] initialize 50 | <<<<<<<<<<[<<<<<<<<<<] 51 | >>>>>>>>>[-]>>>>>>>+<<<<<<<<[+]+ 52 | [ ->> double divisor until above dividend 53 | [>>>>>>[->++<]>>>>]<<<<<<<<<< 54 | [>>>>>>>>[-]>[-] 55 | <<<<[->>>++<<<]<<<<<<<<<<<<<<<]>>>>>>>>>> 56 | [>>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+< 57 | [->--------->>>>>>>>>+<<<<<<<<<<[->+<]]]]]]]]]]]>>] 58 | <<<<<<<<<<[>>>>>>>>>[-<+<<<+>>>>]<<<<<<<<<<<<<<<<<<<]>>>>>>>>>> 59 | [>>>>>>>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+> 60 | [-<--------->>>>>>>>>>>+<<<<<<<<<<[-<+>]]]]]]]]]]]>>>] 61 | <<<<<<<<<< 62 | [>>>>[->>>+>>+<<<<<]<<<<<<<<<<<<<<] 63 | >>>>>>>>>>[>>>>>>>[-<<<+>>>]>>>]<<<<<<<<<< 64 | [>>>>>>>>[->-<]> 65 | [<<<<<<<<<[<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<] 66 | >>>>>>>>>>>>>>>>>>>] 67 | <<<<<<<<<<<<<<<<<<<] 68 | >>>>>>>>>[+[+[+[+[+[+[+[+[+[+[[-]<+>]]]]]]]]]]]< 69 | ] 70 | >>>>>>>> 71 | [ subtract divisor from dividend 72 | <<<<<< 73 | [>>>>>>>>[-]>[-]<<<<<[->>>+>+<<<<]>>>>>>]<<<<<<<<<< 74 | [>>>>>>>>[-<<<<+>>>>]<<<[->>>+>+<<<<]<<<<<<<<<<<<<<<]>>>>>>>>>> 75 | [>>>>>>>>>[-<<<<+>>>>]>]<<<<<<<<<< 76 | [>>>>>>>>[-<->]<<<<<<<<<<<<<<<<<<]>>>>>>>>>> 77 | [>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+< 78 | [++++++++++[+>-<]>>>>>>>>>>-<<<<<<<<<<]]]]]]]]]]]>>>] 79 | >>>>>>>+ 80 | [ if difference is nonnegative then 81 | [-]<<<<<<<<<<<<<<<<< replace dividend and increment quotient 82 | [>>>>[-]>>>>[-<<<<+>>>>]<<[->>+<<]<<<<<<<<<<<<<<<<]>>>>>>>>>> 83 | [>>>>>>>>[->+<<<+>>]>>]<<<<<<<<<< 84 | [>>>[->>>>>>+<<<<<<]<<<<<<<<<<<<<]>>>>>>>>>> 85 | [>>>>>>>>>[-<<<<<<+>>>>>>[-<<<<<<+>>>>>> 86 | [-<<<<<<+>>>>>>[-<<<<<<+>>>>>> 87 | [-<<<<<<+>>>>>>[-<<<<<<+>>>>>> 88 | [-<<<<<<+>>>>>>[-<<<<<<+>>>>>> 89 | [-<<<<<<+>>>>>>[-<<<<<<--------->>>>>>>>>>>>>>>>+<<<<<<<<<< 90 | [-<<<<<<+>>>>>>]]]]]]]]]]]>] 91 | >>>>>>> 92 | ] halve divisor and loop until zero 93 | <<<<<<<<<<<<<<<<<[<<<<<<<<<<]>>>>>>>>>> 94 | [>>>>>>>>[-]<<[->+<]<[->>>+<<<]>>>>>]<<<<<<<<<< 95 | [+>>>>>>>[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+> 96 | [-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+> 97 | [-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+> 98 | [-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+> 99 | [-<<<<<<<+>>>>>>>]]]]]]]]]<<<<<<< 100 | [->>>>>>>+<<<<<<<]-<<<<<<<<<<] 101 | >>>>>>> 102 | [-<<<<<<<<<<<+>>>>>>>>>>>] 103 | >>>[>>>>>>>[-<<<<<<<<<<<+++++>>>>>>>>>>>]>>>]<<<<<<<<<< 104 | [+>>>>>>>>[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>> 105 | [-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>> 106 | [-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>> 107 | [-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>> 108 | [-<<<<<<<<+>>>>>>>>]]]]]]]]]<<<<<<<< 109 | [->>>>>>>>+<<<<<<<<]-<<<<<<<<<<] 110 | >>>>>>>>[-<<<<<<<<<<<<<+>>>>>>>>>>>>>]>> 111 | [>>>>>>>>[-<<<<<<<<<<<<<+++++>>>>>>>>>>>>>]>>]<<<<<<<<<< 112 | [<<<<<<<<<<]>>>>>>>>>> 113 | >>>>>> 114 | ] 115 | <<<<<< 116 | 117 | * 118 | * make copies of the loop variable and the quotient 119 | * 120 | 121 | [>>>[->>>>+>+<<<<<]>>>>>>>] 122 | <<<<<<<<<< 123 | [>>>>>>>[-<<<<+>>>>]<<<<<[->>>>>+>>+<<<<<<<]<<<<<<<<<<<<] 124 | >>>>>>>>>>[>>>>>>>[-<<<<<+>>>>>]>>>]<<<<<<<<<< 125 | 126 | * 127 | * break out of the loop if the quotient is larger than the loop variable 128 | * 129 | 130 | [>>>>>>>>>[-<->]< 131 | [<<<<<<<< 132 | [<<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<] 133 | >>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<] 134 | >>>>>>>>[>-<[+[+[+[+[+[+[+[+[+[[-]>+<]]]]]]]]]]]>+ 135 | 136 | [ [-] 137 | 138 | * 139 | * partially increment the loop variable 140 | * 141 | 142 | <[-]+>>>>+>>>>>>>>[>>>>>>>>>>]<<<<<<<<<< 143 | 144 | * 145 | * examine the remainder for nonzero digits 146 | * 147 | 148 | [<<<<<<[<<<<[<<<<<<<<<<]>>>>+<<<<<<<<<<]<<<<] 149 | >>>>>>>>>>>>>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<[<<<<<<<<<<] 150 | >>>>- 151 | 152 | [ [+] 153 | 154 | * 155 | * decrement the loop variable and replace the number with the quotient 156 | * 157 | 158 | >>>>>>>>-<<[>[-]>>[-<<+>>]>>>>>>>]<<<<<<<<<< 159 | 160 | * 161 | * display the loop variable 162 | * 163 | 164 | [+>>[>>>>>>>>+>>]<<-<<<<<<<<<<]- 165 | [>>++++++++++++++++++++++++++++++++++++++++++++++++. 166 | ------------------------------------------------<<<<<<<<<<<<] 167 | ++++++++++++++++++++++++++++++++.[-]>>>> 168 | 169 | ] 170 | 171 | * 172 | * normalize the loop variable 173 | * 174 | 175 | >>>>>> 176 | [>>[->>>>>+<<<<<[->>>>>+<<<<< 177 | [->>>>>+<<<<<[->>>>>+<<<<< 178 | [->>>>>+<<<<<[->>>>>+<<<<< 179 | [->>>>>+<<<<<[->>>>>+<<<<< 180 | [->>>>>+<<<<<[->>>>>--------->>>>>+<<<<<<<<<< 181 | [->>>>>+<<<<<]]]]]]]]]]]>>>>>>>>] 182 | <<<<<<<<<<[>>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<<] 183 | >>>>>>>>> 184 | 185 | ]< 186 | 187 | ]>> 188 | 189 | * 190 | * display the number and end 191 | * 192 | 193 | [>>>>>>>>>>]<<<<<<<<<<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]- 194 | [>++++++++++++++++++++++++++++++++++++++++++++++++.<<<<<<<<<<<] 195 | ++++++++++. 196 | -------------------------------------------------------------------------------- /test/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 | +++++++++++++++++++++++++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>> 71 | >>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[ 72 | -]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[-> 73 | >>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<< 74 | +>>>>]>[-]<<<[->>>+<<<]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-]<<<<[->>>>+<<<<]>>>>[ 88 | [-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>> 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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<+>+>][-]>[-]<<<<[->>>>+<< 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 | <[->>>>>+<<<<<]>>>>>[[-<<<<<+>>>>>]<<<<<<<[-]<[-]<[-]>>>>>>>>>>[-]<<<<<[->>> 157 | >>+<<<<<]>>>>>[-<<<<<+<<<+>>>>>>>>][-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 158 | <<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<< 159 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 160 | >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<<<<<<<< 445 | <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>> 446 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 447 | >>>>>>>>>>>>>+>>>]<]<[->>>>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]>>[-]<< 448 | <<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>[-]>>>> 449 | >[-<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>+>>>>>][-]<<<<<<<<[->>>>>>>>+<<<<<<<<]>>> 450 | >[-]>>>>[-<<<<<<<<+>>>>+>>>>]<<<[-]++++++++++++++++++++++++++++++++>>-<]>[[- 451 | ]>[-]<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<]>>>>>>>>>>>[-]>>>>> 452 | [-<<<<<<<<<<<<<<<<+>>>>>>>>>>>+>>>>>][-]<<<<<<<[->>>>>>>+<<<<<<<]>>>[-]>>>>[ 453 | -<<<<<<<+>>>+>>>>]<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++ 454 | ++++++++++++++++++++++++++++++++++++>>]<[-]++++++++++++++++>[-]+++++++++++++ 455 | +>>>>[-]>[-]<<<<<<<<<[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>[-<+<<<<<<<<+>>>>>>>>>][ 456 | -]<<[-]+>>>[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>] 457 | <<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[- 458 | <<<+>>>]<<[-]+>>]<]<][-]<<[->>+<<]>>[[-<<+>>]<<<[-]>>>][-]<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<<<<[->>>>>>+<<<<<<]>>>>>>[-<<<<<<+>>>->>>][-]++++++++ 473 | +++++++++++++++++++.++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 474 | ++++++++.>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>]>>>[-]>[-]<<<<<[->>> 475 | >>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+> 476 | +>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<< 477 | [-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<] 478 | >>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+>]>[-]<<<[->>>+<< 479 | <]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[->>>>>+<<<<<]>>>>> 480 | [-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[ 481 | -]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]< 482 | ]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<< 483 | <+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]< 484 | <<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]< 485 | <[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+ 486 | <<<]>>>[[-<<<+>>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<<+>>>>]>[-]<<<[->>>+<<<]>> 500 | >[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[- 501 | ]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>]<[-]>] 502 | <[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+>]<++++++++++++++++++++++++++ 503 | ++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.<++ 504 | ++++++++++++++++++++++++++++++++++++++++++++++.>>>>-<]>[[-]>[-]<<<<[->>>>+<< 505 | <<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++++++++++++++++++++++++++++++ 506 | ++.<++++++++++++++++++++++++++++++++++++++++++++++++.>>>>>>-<]>[[-]<<<<<<+++ 507 | +++++++++++++++++++++++++++++++++++++++++++++.>>>>>>]<<]<<<<<<-------------- 508 | ------------------.>[-]>[-]<<<<<<[->>>>>>+<<<<<<]>>>>>>[-<+<<<<<+>>>>>>]>>>[ 509 | -]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[-> 510 | >+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<] 511 | >>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]> 512 | [-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[-]<[->+<]>[[-<+> 513 | ]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<<<[-]>[-]<<<<<[-> 514 | >>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++<<<<<[-]>>>>[>>>[-]<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++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<] 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 | <[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+ 569 | <<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>> 570 | >>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[-]<<[->>+<<]>>[[-<<+>>] 571 | <[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>> 572 | ][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>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<<<[-]>>>>[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-< 587 | <<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->> 588 | >>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]+>[- 589 | ]<<[->>+<<]>>[[-<<+>>]<[-]>]<[[-]<<<<<<<+>>>>>>>]<<<][-]<[->+<]>>[-]+<[[-<+> 590 | ]<++++++++++++++++++++++++++++++++++++++++++++++++.<++++++++++++++++++++++++ 591 | ++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++++++.> 592 | >>>-<]>[[-]>[-]<<<<[->>>>+<<<<]>>>>>[-]+<[[-<<<<+>>>>]<<<<++++++++++++++++++ 593 | ++++++++++++++++++++++++++++++.<++++++++++++++++++++++++++++++++++++++++++++ 594 | ++++.>>>>>>-<]>[[-]<<<<<<++++++++++++++++++++++++++++++++++++++++++++++++.>> 595 | >>>>]<<]<<<<<<--------------------------------.>[-]>[-]<<<<[->>>>+<<<<]>>>>[ 596 | -<+<<<+>>>>]>>>[-]>[-]<<<<<[->>>>>+<<<<<]>>>>>[-<+<<<<+>>>>>][-]++++++++++>[ 597 | -]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-]<<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]> 598 | [-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<<->>->[-]>[-]<<<<[->>>>+<<<<]>> 599 | >>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<]<<<]<<<[-]>>>>>>[ 600 | -]<[->+<]>[[-<+>]>[-]<<<[->>>+<<<]>>>[-<<<+<<<<+>>>>>>>]<<[-<<<<<->>>>>]>]<< 601 | <[-]>[-]<<<<<[->>>>>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]>[-]<<<<<[->>>>>+<<<<<]> 615 | >>>>[-<+<<<<+>>>>>][-]++++++++++>[-]<<[>>>[-]<<[->>+<<]>[-]>[-<<+>+>][-]>[-] 616 | <<<<[->>>>+<<<<]>>>>[[-<<<<+>>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]< 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 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>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| >>>]<<<[<<<<<<<<--------->>+>>>>>>>[-]++++++++>[-]>[-]<<<<<<<<<<<[->>>>>>>>> 698 | >>+<<<<<<<<<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->> 699 | >+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[- 700 | ]<<<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]< 701 | [->+<]>[[-<+>]<<<[-]+>>>]<<<]>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>>+<<<<<<<< 702 | <<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+<<<]>>>[[ 703 | -<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]<<<[->>>+< 704 | <<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[->+<]>[[-< 705 | +>]<<<[-]+>>>]<<<[<<<<<<<<--->+>>>>>>>>[-]++>[-]>[-]<<<<<<<<<<<[->>>>>>>>>>> 706 | +<<<<<<<<<<<]>>>>>>>>>>>[-<+<<<<<<<<<<+>>>>>>>>>>>]<<<[-]>>>[-]>[-]<<<[->>>+ 707 | <<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<[<<->->[-]>[-]< 708 | <<[->>>+<<<]>>>[[-<<<+>>>]>[-]<<<[->>>+<<<]>>>[[-<<<+>>>]<<[-]+>>]<]<][-]<[- 709 | >+<]>[[-<+>]<<<[-]+>>>]<<<]<<<<+>>>]<<]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 710 | -------------------------------------------------------------------------------- /test/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 | -------------------------------------------------------------------------------- /test/mandelbrot.b: -------------------------------------------------------------------------------- 1 | A mandelbrot set fractal viewer in brainf*** written by Erik Bosman 2 | +++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[ 3 | >>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+ 4 | <<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>> 5 | >+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>> 6 | >>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>> 7 | >>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>> 8 | >>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>> 9 | [>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>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<<<<<<<[>[-]<- 135 | >>>>>>>>[-<<<<<<<<+>[<->-<<+>>]<[->+<]>>>>>>>>]<<<<<<<[->>>>>>>+<<<<<<<]<+<<<<<< 136 | <<<]>>>>>>>>-<<<<<[-]+<<<]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>->[>>> 137 | >>>[->>+<<]>>>]<<<<<<<<<[>[-]<->>>>>>>>[-<<<<<<<<+>[<->-<<+>>]<[->+<]>>>>>>>>]<< 138 | <<<<<[->>>>>>>+<<<<<<<]<+<<<<<<<<<]>+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>> 139 | +>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>[-<<<<<<->>>>>>]+< 140 | <<<<<[->>>>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<< 141 | <<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>> 142 | -<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>> 143 | >>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++ 144 | +[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<< 145 | <<<<<]]>>>] 146 | -------------------------------------------------------------------------------- /test/oobrain.b: -------------------------------------------------------------------------------- 1 | %% 2 | %% (C) 2003 Chris Rathman 3 | %% 4 | 5 | %% reserve some space for a stack (note: each stack entry takes two cells ~ value and a walk byte) 6 | >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> 7 | >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> 8 | >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> 9 | 10 | %% 11 | %% Object Definition: 12 | %% 13 | %% < object# > 14 | %% << function#/step# >> 15 | %% <<< class# >>> 16 | %% <<<< slot#1 (main!shape(0) | circle!x | rectangle!x) >>>> 17 | %% <<<<< slot#2 (main!shape(1) | circle!y | rectangle!y) >>>>> 18 | %% <<<<<< slot#3 (main!rect | circle!radius | rectangle!width) >>>>>> 19 | %% <<<<<<< slot#4 ( | | rectangle!height) >>>>>>> 20 | %% <<<<<<<< slot#5 >>>>>>>> 21 | %% <<<<<<<<< reserved >>>>>>>>> 22 | %% <<<<<<<<<<<<<<<<<<<< object length >>>>>>>>>>>>>>>>>>>> 23 | %% 24 | 25 | %% auto-allocate main root object 26 | >>>>>>>>>>>> 9~20 %% workspace (for previous object) 27 | [-]> 8 %% slot#5 28 | [-]> 7 %% slot#4 29 | [-]> 6 %% slot#3 30 | [-]> 5 %% slot#2 31 | [-]> 4 %% slot#1 32 | [-]> 3 %% class# 33 | [-]> 2 %% function#/step# 34 | [-]> 1 %% object# 35 | 36 | %% stack push step#1 for main object 37 | <<<<<<<<<<<<<<<<<<<< [<<]+<+>[>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push step# 38 | <<<<<<<<<<<<<<<<<<<< [<<]+<> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push object# 39 | 40 | <<<<<<<<<<<<<<<<<<<< <<[>> >>>>>>>>>>>>>>>>>>>> %% while stack do 41 | 42 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull next object# 43 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 44 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 45 | 46 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull next function#/step# 47 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 48 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 49 | [ %% walk to next object#n 50 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 51 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 52 | >>>>>>>>>>>>>>>>>>>> 53 | -] 54 | 55 | <<[-]>> >[<< <+> >>-]< %% set function#/step# for the object 56 | 57 | 58 | ================================================================================================ 59 | = main process = 60 | ================================================================================================ 61 | [-]<<<[>>>+>+<<< <-]>>> >[<<< <+> >>>-]< %% get class# 62 | >[-] [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (class#0) 63 | 64 | %% set to return to the next step# after continue 65 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< + %% get step# 66 | <<<<<<<<<<<<<<<<<<<< [<<]+<++++> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push step# 67 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for step# 68 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push step# 69 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push object# 70 | 71 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 72 | % step#1 new shape() % 73 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 74 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 75 | >[-]+ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#1) 76 | 77 | %% allocate a new object in the heap 78 | <[<<<<<<<<<<<<<<<<<<<<]> %% walk back to root object 79 | >>>>>>>>>>>>>>>>>>>> %% skip over first object 80 | <[> %% find free space in the heap 81 | [-]<[>+>+< <-]> >[< <+> >-]< %% get object# 82 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<<-] 83 | >>>>>>>>>>>>>>>>>>>> 84 | <]> 85 | <[-]+ >[<+>-]<> %% object#n 86 | <<<[-]+>>> %% class# rectangle 87 | [-]<[>+>+< <-]> >[< <+> >-]< %% get new object# 88 | <[ %% walk back to root object 89 | >[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< 90 | <<<<<<<<<<<<<<<<<<<< 91 | ]> 92 | 93 | %% set local slot# for shape(0) 94 | [<<<< + >>>> -] %% set slot# shape(0) 95 | 96 | %% make a function call: shape(0) = new rectangle(x y width height) 97 | <<<<[>>>>+>+<<<< <-]>>>> >[<<<< <+> >>>>-]< %% get shape(0) from slot 98 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# height = 6 99 | <++++++> 100 | [>>]<< >>>>>>>>>>>>>>>>>>>> 101 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# width = 5 102 | <+++++> 103 | [>>]<< >>>>>>>>>>>>>>>>>>>> 104 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# y = 20 105 | <++++++++++++++++++++> 106 | [>>]<< >>>>>>>>>>>>>>>>>>>> 107 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# x = 10 108 | <++++++++++> 109 | [>>]<< >>>>>>>>>>>>>>>>>>>> 110 | <<<<<<<<<<<<<<<<<<<< [<<]+<+> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# rectangle 111 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 112 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# shape(0) 113 | 114 | %% allocate a new object in the heap 115 | <[<<<<<<<<<<<<<<<<<<<<]> %% walk back to root object 116 | >>>>>>>>>>>>>>>>>>>> %% skip over first object 117 | <[> %% find free space in the heap 118 | [-]<[>+>+< <-]> >[< <+> >-]< %% get object# 119 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<<-] 120 | >>>>>>>>>>>>>>>>>>>> 121 | <]> 122 | <[-]+ >[<+>-]<> %% object#n 123 | <<<[-]++>>> %% class# 124 | [-]<[>+>+< <-]> >[< <+> >-]< %% get new object# 125 | <[ %% walk back to root object 126 | >[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< 127 | <<<<<<<<<<<<<<<<<<<< 128 | ]> 129 | 130 | %% set local slot# for shape(1) 131 | [<<<<< + >>>>> -] %% set slot# shape(1) 132 | 133 | %% make a function call: shape(1) = new circle(x y radius) 134 | <<<<<[>>>>>+>+<<<<< <-]>>>>> >[<<<<< <+> >>>>>-]< %% get shape(1) from slot 135 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# radius = 8 136 | <++++++++> 137 | [>>]<< >>>>>>>>>>>>>>>>>>>> 138 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# y = 25 139 | <+++++++++++++++++++++++++> 140 | [>>]<< >>>>>>>>>>>>>>>>>>>> 141 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# x = 15 142 | <+++++++++++++++> 143 | [>>]<< >>>>>>>>>>>>>>>>>>>> 144 | <<<<<<<<<<<<<<<<<<<< [<<]+<+> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# circle 145 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 146 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# shape(1) 147 | >]< %% END IF (function#1) 148 | 149 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 150 | % step#2 shape!draw() % 151 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 152 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 153 | >[-]++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#2) 154 | %% get the two shapes to process 155 | <<<<[>>>>+>+<<<< <-]>>>> >[<<<< <+> >>>>-]< %% get shape(0) from slot 156 | [>>>>+<<<<-] %% push shape(0) in the workspace 157 | <<<<<[>>>>>+>+<<<<< <-]>>>>> >[<<<<< <+> >>>>>-]< %% get shape(1) from slot 158 | [>>>>>+<<<<<-] %% push shape(1) in the workspace 159 | 160 | %% make a function call: shape(i)!draw() 161 | >>>++[-<<< %% for i = 1 downto 0 162 | >>>>[<<<<+>>>>-]<<<< %% get next shape to process 163 | <<<<<<<<<<<<<<<<<<<< [<<]+<++++> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# draw 164 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 165 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# shape(0) 166 | >>>>>[<+>-]<<<<< %% pull down next shape 167 | >>>]<<< 168 | >]< %% END IF (function#1) 169 | 170 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 171 | % step#3 shape!rMoveTo() % 172 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 173 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 174 | >[-]+++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#3) 175 | %% get the two shapes to process 176 | <<<<[>>>>+>+<<<< <-]>>>> >[<<<< <+> >>>>-]< %% get shape(0) from slot 177 | [>>>>+<<<<-] %% push shape(0) in the workspace 178 | <<<<<[>>>>>+>+<<<<< <-]>>>>> >[<<<<< <+> >>>>>-]< %% get shape(1) from slot 179 | [>>>>>+<<<<<-] %% push shape(1) in the workspace 180 | 181 | %% make a function call: shape(i)!rMoveTo(100) 182 | >>>++[-<<< %% for i = 1 downto 0 183 | >>>>[<<<<+>>>>-]<<<< %% get next shape to process 184 | <<<<<<<<<<<<<<<<<<<< [<<] %% stack push param# dy = 100 185 | <++++[>+++++<-]>[<+++++>-]<>+ 186 | [>>]<< >>>>>>>>>>>>>>>>>>>> 187 | <<<<<<<<<<<<<<<<<<<< [<<] %% stack push param# dx = 100 188 | <++++[>+++++<-]>[<+++++>-]<>+ 189 | [>>]<< >>>>>>>>>>>>>>>>>>>> 190 | <<<<<<<<<<<<<<<<<<<< [<<]+<+++> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# rmoveto 191 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 192 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# shape(0) 193 | >>>>>[<+>-]<<<<< %% pull down next shape 194 | >>>]<<< 195 | >]< %% END IF (function#1) 196 | 197 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 198 | % step#4 shape!draw() % 199 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 200 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 201 | >[-]++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#4) 202 | %% get the two shapes to process 203 | <<<<[>>>>+>+<<<< <-]>>>> >[<<<< <+> >>>>-]< %% get shape(0) from slot 204 | [>>>>+<<<<-] %% push shape(0) in the workspace 205 | <<<<<[>>>>>+>+<<<<< <-]>>>>> >[<<<<< <+> >>>>>-]< %% get shape(1) from slot 206 | [>>>>>+<<<<<-] %% push shape(1) in the workspace 207 | 208 | %% make a function call: shape(i)!draw() 209 | >>>++[-<<< %% for i = 1 downto 0 210 | >>>>[<<<<+>>>>-]<<<< %% get next shape to process 211 | <<<<<<<<<<<<<<<<<<<< [<<]+<++++> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# draw 212 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 213 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# shape(0) 214 | >>>>>[<+>-]<<<<< %% pull down next shape 215 | >>>]<<< 216 | >]< %% END IF (function#1) 217 | 218 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 219 | % step#5 new rect() % 220 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 221 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 222 | >[-]+++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#5) 223 | 224 | %% allocate a new object in the heap 225 | <[<<<<<<<<<<<<<<<<<<<<]> %% walk back to root object 226 | >>>>>>>>>>>>>>>>>>>> %% skip over first object 227 | <[> %% find free space in the heap 228 | [-]<[>+>+< <-]> >[< <+> >-]< %% get object# 229 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<<-] 230 | >>>>>>>>>>>>>>>>>>>> 231 | <]> 232 | <[-]+ >[<+>-]<> %% object#n 233 | <<<[-]+>>> %% class# rectangle 234 | [-]<[>+>+< <-]> >[< <+> >-]< %% get new object# 235 | <[ %% walk back to root object 236 | >[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< 237 | <<<<<<<<<<<<<<<<<<<< 238 | ]> 239 | 240 | %% set local slot# for rect 241 | [<<<<<< + >>>>>> -] %% set slot# rect 242 | 243 | %% make a function call: rect = new rectangle(x y width height) 244 | <<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> >[<<<<<< <+> >>>>>>-]< %% get rect from slot# 245 | <<<<<<<<<<<<<<<<<<<< [<<]+<+++++++++++++++>[>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push param# height=15 246 | <<<<<<<<<<<<<<<<<<<< [<<]+<+++++++++++++++>[>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push param# width=15 247 | <<<<<<<<<<<<<<<<<<<< [<<]+<> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push param# y=0 248 | <<<<<<<<<<<<<<<<<<<< [<<]+<> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push param# x=0 249 | <<<<<<<<<<<<<<<<<<<< [<<]+<+> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# circle 250 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 251 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# rect 252 | >]< %% END IF (function#1) 253 | 254 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 255 | % step#6 rect!setWidth() % 256 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 257 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 258 | >[-]++++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#6) 259 | %% make a function call: rect!setRadius(radius) 260 | <<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> >[<<<<<< <+> >>>>>>-]< %% get rect from slot# 261 | <<<<<<<<<<<<<<<<<<<< [<<]+ %% stack push param# radius=30 262 | <++++++++++++++++++++++++++++++> 263 | [>>]<< >>>>>>>>>>>>>>>>>>>> 264 | <<<<<<<<<<<<<<<<<<<< [<<]+<+++++> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# setRadius=30 265 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 266 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# rect 267 | >]< %% END IF (function#1) 268 | 269 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 270 | % step#7 rect!draw() % 271 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 272 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 273 | >[-]+++++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#7) 274 | %% make a function call: rect!draw() 275 | <<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> >[<<<<<< <+> >>>>>>-]< %% get shape(0) from slot 276 | <<<<<<<<<<<<<<<<<<<< [<<]+<++++> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack push function# draw 277 | <<<<<<<<<<<<<<<<<<<< [<<]+<[-]> [>>]<< >>>>>>>>>>>>>>>>>>>> %% stack mark spot for object# 278 | [<<<<<<<<<<<<<<<<<<<< [<<]>+> [>>]<< >>>>>>>>>>>>>>>>>>>>-] %% stack push object# rect 279 | >]< %% END IF (function#1) 280 | 281 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 282 | % step#8 exit() % 283 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 284 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 285 | >[-]++++++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#8) 286 | <<<<<<<<<<<<<<<<<<<< <<[-]>> >>>>>>>>>>>>>>>>>>>> %% kill stack to exit 287 | >]< %% END IF (function#99) 288 | 289 | >]< %% END IF (class#0) 290 | 291 | 292 | 293 | ================================================================================================ 294 | = rectangle class = 295 | ================================================================================================ 296 | [-]<<<[>>>+>+<<< <-]>>> >[<<< <+> >>>-]< %% get class# 297 | >[-]+ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (class#1) 298 | 299 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 300 | % function#1 rectangle(x y width height) % 301 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 302 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 303 | >[-]+ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#1) 304 | %% clear the slots 305 | <<<<[-]>>>> %% x=0 306 | <<<<<[-]>>>>> %% y=0 307 | <<<<<<[-]>>>>>> %% width=0 308 | <<<<<<<[-]>>>>>>> %% height=0 309 | 310 | %% grab the x value from the stack 311 | <[>+>+< <-]> >[< <+> >-]< %% get object# 312 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 313 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# x 314 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 315 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 316 | [ %% walk to object#n (drag param# & object index) 317 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 318 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 319 | >>>>>>>>>>>>>>>>>>>> 320 | -] 321 | >[< <<<<+>>>> >-]< %% set slot# x 322 | 323 | %% grab the y value from the stack 324 | <[>+>+< <-]> >[< <+> >-]< %% get object# 325 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 326 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# y 327 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 328 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 329 | [ %% walk to object#n (drag param# & object index) 330 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 331 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 332 | >>>>>>>>>>>>>>>>>>>> 333 | -] 334 | >[< <<<<<+>>>>> >-]< %% set slot# y 335 | 336 | %% grab the width value from the stack 337 | <[>+>+< <-]> >[< <+> >-]< %% get object# 338 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 339 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# width 340 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 341 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 342 | [ %% walk to object#n (drag param# & object index) 343 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 344 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 345 | >>>>>>>>>>>>>>>>>>>> 346 | -] 347 | >[< <<<<<<+>>>>>> >-]< %% set slot# width 348 | 349 | %% grab the height value from the stack 350 | <[>+>+< <-]> >[< <+> >-]< %% get object# 351 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 352 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# height 353 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 354 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 355 | [ %% walk to object#n (drag param# & object index) 356 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 357 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 358 | >>>>>>>>>>>>>>>>>>>> 359 | -] 360 | >[< <<<<<<<+>>>>>>> >-]< %% set slot# height 361 | >]< %% END IF (function#1) 362 | 363 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 364 | % function#2 moveTo(x y) % 365 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 366 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 367 | >[-]++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#2) 368 | %% grab the x value from the stack 369 | <<<<[-]>>>> %% x=0 370 | <[>+>+< <-]> >[< <+> >-]< %% get object# 371 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 372 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# x 373 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 374 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 375 | [ %% walk to object#n (drag param# & object index) 376 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 377 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 378 | >>>>>>>>>>>>>>>>>>>> 379 | -] 380 | >[< <<<<+>>>> >-]< %% set slot# x 381 | 382 | %% grab the y value from the stack 383 | <<<<<[-]>>>>> %% y=0 384 | <[>+>+< <-]> >[< <+> >-]< %% get object# 385 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 386 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# y 387 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 388 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 389 | [ %% walk to object#n (drag param# & object index) 390 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 391 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 392 | >>>>>>>>>>>>>>>>>>>> 393 | -] 394 | >[< <<<<<+>>>>> >-]< %% set slot# y 395 | >]< %% END IF (function#2) 396 | 397 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 398 | % function#3 rMoveTo(x y) % 399 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 400 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 401 | >[-]+++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#3) 402 | %% grab the x value from the stack 403 | <[>+>+< <-]> >[< <+> >-]< %% get object# 404 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 405 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# x 406 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 407 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 408 | [ %% walk to object#n (drag param# & object index) 409 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 410 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 411 | >>>>>>>>>>>>>>>>>>>> 412 | -] 413 | >[< <<<<+>>>> >-]< %% set slot# x 414 | 415 | %% grab the y value from the stack 416 | <[>+>+< <-]> >[< <+> >-]< %% get object# 417 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 418 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# y 419 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 420 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 421 | [ %% walk to object#n (drag param# & object index) 422 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 423 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 424 | >>>>>>>>>>>>>>>>>>>> 425 | -] 426 | >[< <<<<<+>>>>> >-]< %% set slot# y 427 | >]< %% END IF (function#3) 428 | 429 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 430 | % function#5 setWidth(width) % 431 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 432 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 433 | >[-]+++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#5) 434 | %% grab the width value from the stack 435 | <<<<<<[-]>>>>>> %% width=0 436 | <[>+>+< <-]> >[< <+> >-]< %% get object# 437 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 438 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# width 439 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 440 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 441 | [ %% walk to object#n (drag param# & object index) 442 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 443 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 444 | >>>>>>>>>>>>>>>>>>>> 445 | -] 446 | >[< <<<<<<+>>>>>> >-]< %% set slot# width 447 | >]< %% END IF (function#5) 448 | 449 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 450 | % function#6 setHeight(height) % 451 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 452 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 453 | >[-]++++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#6) 454 | %% grab the height value from the stack 455 | <<<<<<[-]>>>>>> %% height=0 456 | <[>+>+< <-]> >[< <+> >-]< %% get object# 457 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 458 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# height 459 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 460 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 461 | [ %% walk to object#n (drag param# & object index) 462 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 463 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 464 | >>>>>>>>>>>>>>>>>>>> 465 | -] 466 | >[< <<<<<<<+>>>>>>> >-]< %% set slot# height 467 | >]< %% END IF (function#5) 468 | 469 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 470 | % function#4 draw() % 471 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 472 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 473 | >[-]++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#4) 474 | [-] #64# >++++++++[<++++++++>-]< ++++. %% D 475 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++. %% R 476 | [-] #64# >++++++++[<++++++++>-]< +. %% A 477 | [-] #64# >++++++++[<++++++++>-]< +++++++++++++++++++++++. %% W 478 | [-] #64# >++++++++[<++++++++>-]< +++++++++. %% I 479 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++. %% N 480 | [-] #64# >++++++++[<++++++++>-]< +++++++. %% G 481 | [-] #30# >+++++[<++++++>-]< ++. %% 482 | [-] #64# >++++++++[<++++++++>-]< +. %% A 483 | [-] #30# >+++++[<++++++>-]< ++. %% 484 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++. %% R 485 | [-] #64# >++++++++[<++++++++>-]< +++++. %% E 486 | [-] #64# >++++++++[<++++++++>-]< +++. %% C 487 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++++. %% T 488 | [-] #64# >++++++++[<++++++++>-]< +. %% A 489 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++. %% N 490 | [-] #64# >++++++++[<++++++++>-]< +++++++. %% G 491 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++. %% L 492 | [-] #64# >++++++++[<++++++++>-]< +++++. %% E 493 | [-] #30# >+++++[<++++++>-]< ++. %% 494 | [-] #64# >++++++++[<++++++++>-]< +. %% A 495 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++++. %% T 496 | [-] #30# >+++++++[<++++++++>-]< ++. %% : 497 | [-] #42# >++++++[<+++++++>-]< --. %% ( 498 | [-] <<<<[>>>>+>+<<<< <-]>>>> [<<<< + >>>>-] %% x 499 | >[ %% output number 500 | [>+>+<<-]>>[<<+>>-]< %% dup 501 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 502 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 503 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 504 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 505 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 506 | <+> %% inc1 507 | ] 508 | <[ 509 | [>+<-] %% mover 510 | +++++++[<+++++++>-]<-> %% add48 511 | <.[-]> %% putc 512 | >[<<+>>-]< %% movel2 513 | <-] 514 | [-]<<<<[>>>>+>+<<<< <-]>>>> >[<<<< <+> >>>>-]< %% get slot# x 515 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (x=0) 516 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 517 | >]< %% END IF (x=0) 518 | [-] #42# >++++++[<+++++++>-]< ++. %% comma 519 | [-] <<<<<[>>>>>+>+<<<<< <-]>>>>> [<<<<< + >>>>>-] %% y 520 | >[ %% output number 521 | [>+>+<<-]>>[<<+>>-]< %% dup 522 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 523 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 524 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 525 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 526 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 527 | <+> %% inc1 528 | ] 529 | <[ 530 | [>+<-] %% mover 531 | +++++++[<+++++++>-]<-> %% add48 532 | <.[-]> %% putc 533 | >[<<+>>-]< %% movel2 534 | <-] 535 | [-]<<<<<[>>>>>+>+<<<<< <-]>>>>> >[<<<<< <+> >>>>>-]< %% get slot# y 536 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (y=0) 537 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 538 | >]< %% END IF (y=0) 539 | [-] #42# >++++++[<+++++++>-]< -. %% ) 540 | [-] #42# >++++++[<+++++++>-]< ++. %% comma 541 | [-] #30# >+++++[<++++++>-]< ++. %% 542 | [-] #64# >++++++++[<++++++++>-]< +++++++++++++++++++++++. %% W 543 | [-] #64# >++++++++[<++++++++>-]< +++++++++. %% I 544 | [-] #64# >++++++++[<++++++++>-]< ++++. %% D 545 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++++. %% T 546 | [-] #64# >++++++++[<++++++++>-]< ++++++++. %% H 547 | [-] #30# >+++++[<++++++>-]< ++. %% 548 | [-] <<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> [<<<<<< + >>>>>>-] %% width 549 | >[ %% output number 550 | [>+>+<<-]>>[<<+>>-]< %% dup 551 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 552 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 553 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 554 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 555 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 556 | <+> %% inc1 557 | ] 558 | <[ 559 | [>+<-] %% mover 560 | +++++++[<+++++++>-]<-> %% add48 561 | <.[-]> %% putc 562 | >[<<+>>-]< %% movel2 563 | <-] 564 | [-]<<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> >[<<<<<< <+> >>>>>>-]< %% get slot# width 565 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (width=0) 566 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 567 | >]< %% END IF (width=0) 568 | [-] #42# >++++++[<+++++++>-]< ++. %% comma 569 | [-] #30# >+++++[<++++++>-]< ++. %% 570 | [-] #64# >++++++++[<++++++++>-]< ++++++++. %% H 571 | [-] #64# >++++++++[<++++++++>-]< +++++. %% E 572 | [-] #64# >++++++++[<++++++++>-]< +++++++++. %% I 573 | [-] #64# >++++++++[<++++++++>-]< +++++++. %% G 574 | [-] #64# >++++++++[<++++++++>-]< ++++++++. %% H 575 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++++. %% T 576 | [-] #30# >+++++[<++++++>-]< ++. %% 577 | [-] <<<<<<<[>>>>>>>+>+<<<<<<< <-]>>>>>>> [<<<<<<< + >>>>>>>-] %% width 578 | >[ %% output number 579 | [>+>+<<-]>>[<<+>>-]< %% dup 580 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 581 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 582 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 583 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 584 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 585 | <+> %% inc1 586 | ] 587 | <[ 588 | [>+<-] %% mover 589 | +++++++[<+++++++>-]<-> %% add48 590 | <.[-]> %% putc 591 | >[<<+>>-]< %% movel2 592 | <-] 593 | [-]<<<<<<<[>>>>>>>+>+<<<<<<< <-]>>>>>>> >[<<<<<<< <+> >>>>>>>-]< %% get slot# height 594 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (height=0) 595 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 596 | >]< %% END IF (height=0) 597 | [-] ++++++++++.[-] %% \n 598 | >]< %% END IF (function#4) 599 | 600 | >]< %% END IF (class#2) 601 | 602 | 603 | 604 | ================================================================================================ 605 | = circle class = 606 | ================================================================================================ 607 | [-]<<<[>>>+>+<<< <-]>>> >[<<< <+> >>>-]< %% get class# 608 | >[-]++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (class#2) 609 | 610 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 611 | % function#1 circle(x y radius) % 612 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 613 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 614 | >[-]+ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#1) 615 | %% clear the slots 616 | <<<<[-]>>>> %% x=0 617 | <<<<<[-]>>>>> %% y=0 618 | <<<<<<[-]>>>>>> %% radius=0 619 | 620 | %% grab the x value from the stack 621 | <[>+>+< <-]> >[< <+> >-]< %% get object# 622 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 623 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# x 624 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 625 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 626 | [ %% walk to object#n (drag param# & object index) 627 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 628 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 629 | >>>>>>>>>>>>>>>>>>>> 630 | -] 631 | >[< <<<<+>>>> >-]< %% set slot# x 632 | 633 | %% grab the y value from the stack 634 | <[>+>+< <-]> >[< <+> >-]< %% get object# 635 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 636 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# y 637 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 638 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 639 | [ %% walk to object#n (drag param# & object index) 640 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 641 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 642 | >>>>>>>>>>>>>>>>>>>> 643 | -] 644 | >[< <<<<<+>>>>> >-]< %% set slot# y 645 | 646 | %% grab the radius value from the stack 647 | <[>+>+< <-]> >[< <+> >-]< %% get object# 648 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 649 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# radius 650 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 651 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 652 | [ %% walk to object#n (drag param# & object index) 653 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 654 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 655 | >>>>>>>>>>>>>>>>>>>> 656 | -] 657 | >[< <<<<<<+>>>>>> >-]< %% set slot# radius 658 | >]< %% END IF (function#1) 659 | 660 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 661 | % function#2 moveTo(x y) % 662 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 663 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 664 | >[-]++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#2) 665 | %% grab the x value from the stack 666 | <<<<[-]>>>> %% x=0 667 | <[>+>+< <-]> >[< <+> >-]< %% get object# 668 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 669 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# x 670 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 671 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 672 | [ %% walk to object#n (drag param# & object index) 673 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 674 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 675 | >>>>>>>>>>>>>>>>>>>> 676 | -] 677 | >[< <<<<+>>>> >-]< %% set slot# x 678 | 679 | %% grab the y value from the stack 680 | <<<<<[-]>>>>> %% y=0 681 | <[>+>+< <-]> >[< <+> >-]< %% get object# 682 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 683 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# y 684 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 685 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 686 | [ %% walk to object#n (drag param# & object index) 687 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 688 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 689 | >>>>>>>>>>>>>>>>>>>> 690 | -] 691 | >[< <<<<<+>>>>> >-]< %% set slot# y 692 | >]< %% END IF (function#2) 693 | 694 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 695 | % function#3 rMoveTo(x y) % 696 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 697 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 698 | >[-]+++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#3) 699 | %% grab the x value from the stack 700 | <[>+>+< <-]> >[< <+> >-]< %% get object# 701 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 702 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# x 703 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 704 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 705 | [ %% walk to object#n (drag param# & object index) 706 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 707 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 708 | >>>>>>>>>>>>>>>>>>>> 709 | -] 710 | >[< <<<<+>>>> >-]< %% set slot# x 711 | 712 | %% grab the y value from the stack 713 | <[>+>+< <-]> >[< <+> >-]< %% get object# 714 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 715 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# y 716 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 717 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 718 | [ %% walk to object#n (drag param# & object index) 719 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 720 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 721 | >>>>>>>>>>>>>>>>>>>> 722 | -] 723 | >[< <<<<<+>>>>> >-]< %% set slot# y 724 | >]< %% END IF (function#3) 725 | 726 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 727 | % function#5 setRadius(radius) % 728 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 729 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 730 | >[-]+++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#5) 731 | %% grab the radius value from the stack 732 | <<<<<<[-]>>>>>> %% radius=0 733 | <[>+>+< <-]> >[< <+> >-]< %% get object# 734 | <[>[<<<<<<<<<<<<<<<<<<<< + >>>>>>>>>>>>>>>>>>>>-]< <<<<<<<<<<<<<<<<<<<<]> %% walk back to root object (drag object#) 735 | <<<<<<<<<<<<<<<<<<<< [<<] >> %% stack pull param# radius 736 | <[> [>>] << >>>>>>>>>>>>>>>>>>>> >+< <<<<<<<<<<<<<<<<<<<< [<<] >> <-]> 737 | [-]>> [>>] << >>>>>>>>>>>>>>>>>>>> 738 | [ %% walk to object#n (drag param# & object index) 739 | >[>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -]< 740 | [>>>>>>>>>>>>>>>>>>>> + <<<<<<<<<<<<<<<<<<<< -] 741 | >>>>>>>>>>>>>>>>>>>> 742 | -] 743 | >[< <<<<<<+>>>>>> >-]< %% set slot# radius 744 | >]< %% END IF (function#5) 745 | 746 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 747 | % function#4 draw() % 748 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 749 | [-]<<[>>+>+<< <-]>> >[<< <+> >>-]< %% get function# 750 | >[-]++++ [<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (function#4) 751 | [-] #64# >++++++++[<++++++++>-]< ++++. %% D 752 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++. %% R 753 | [-] #64# >++++++++[<++++++++>-]< +. %% A 754 | [-] #64# >++++++++[<++++++++>-]< +++++++++++++++++++++++. %% W 755 | [-] #64# >++++++++[<++++++++>-]< +++++++++. %% I 756 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++. %% N 757 | [-] #64# >++++++++[<++++++++>-]< +++++++. %% G 758 | [-] #30# >+++++[<++++++>-]< ++. %% 759 | [-] #64# >++++++++[<++++++++>-]< +. %% A 760 | [-] #30# >+++++[<++++++>-]< ++. %% 761 | [-] #64# >++++++++[<++++++++>-]< +++. %% C 762 | [-] #64# >++++++++[<++++++++>-]< +++++++++. %% I 763 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++. %% R 764 | [-] #64# >++++++++[<++++++++>-]< +++. %% C 765 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++. %% L 766 | [-] #64# >++++++++[<++++++++>-]< +++++. %% E 767 | [-] #30# >+++++[<++++++>-]< ++. %% 768 | [-] #64# >++++++++[<++++++++>-]< +. %% A 769 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++++. %% T 770 | [-] #30# >+++++++[<++++++++>-]< ++. %% : 771 | [-] #42# >++++++[<+++++++>-]< --. %% ( 772 | [-] <<<<[>>>>+>+<<<< <-]>>>> [<<<< + >>>>-] %% x 773 | >[ %% output number 774 | [>+>+<<-]>>[<<+>>-]< %% dup 775 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 776 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 777 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 778 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 779 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 780 | <+> %% inc1 781 | ] 782 | <[ 783 | [>+<-] %% mover 784 | +++++++[<+++++++>-]<-> %% add48 785 | <.[-]> %% putc 786 | >[<<+>>-]< %% movel2 787 | <-] 788 | [-]<<<<[>>>>+>+<<<< <-]>>>> >[<<<< <+> >>>>-]< %% get slot# x 789 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (x=0) 790 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 791 | >]< %% END IF (x=0) 792 | [-] #42# >++++++[<+++++++>-]< ++. %% comma 793 | [-] <<<<<[>>>>>+>+<<<<< <-]>>>>> [<<<<< + >>>>>-] %% y 794 | >[ %% output number 795 | [>+>+<<-]>>[<<+>>-]< %% dup 796 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 797 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 798 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 799 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 800 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 801 | <+> %% inc1 802 | ] 803 | <[ 804 | [>+<-] %% mover 805 | +++++++[<+++++++>-]<-> %% add48 806 | <.[-]> %% putc 807 | >[<<+>>-]< %% movel2 808 | <-] 809 | [-]<<<<<[>>>>>+>+<<<<< <-]>>>>> >[<<<<< <+> >>>>>-]< %% get slot# y 810 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (y=0) 811 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 812 | >]< %% END IF (y=0) 813 | [-] #42# >++++++[<+++++++>-]< -. %% ) 814 | [-] #42# >++++++[<+++++++>-]< ++. %% comma 815 | [-] #30# >+++++[<++++++>-]< ++. %% 816 | [-] #64# >++++++++[<++++++++>-]< ++++++++++++++++++. %% R 817 | [-] #64# >++++++++[<++++++++>-]< +. %% A 818 | [-] #64# >++++++++[<++++++++>-]< ++++. %% D 819 | [-] #64# >++++++++[<++++++++>-]< +++++++++. %% I 820 | [-] #64# >++++++++[<++++++++>-]< +++++++++++++++++++++. %% U 821 | [-] #64# >++++++++[<++++++++>-]< +++++++++++++++++++. %% S 822 | [-] #30# >+++++[<++++++>-]< ++. %% 823 | [-] <<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> [<<<<<< + >>>>>>-] %% radius 824 | >[ %% output number 825 | [>+>+<<-]>>[<<+>>-]< %% dup 826 | >+++++++++<[>>>+<< [>+>[-]<<-] >[<+>-] %% mod10 827 | >[<<++++++++++>>-] <<- <-] +++++++++ >[<->-]< 828 | [>+<-] < [>+<-] < [>+<-] >>>[<<<+>>>-] < %% rrot 829 | >+++++++++< [ >>>+<< [>+>[-]<<-] >[<+>-] %% div10 830 | >[<<++++++++++>>>+<-] <<- <- ] >>>>[<<<<+>>>>-]<<<< >[-]< 831 | <+> %% inc1 832 | ] 833 | <[ 834 | [>+<-] %% mover 835 | +++++++[<+++++++>-]<-> %% add48 836 | <.[-]> %% putc 837 | >[<<+>>-]< %% movel2 838 | <-] 839 | [-]<<<<<<[>>>>>>+>+<<<<<< <-]>>>>>> >[<<<<<< <+> >>>>>>-]< %% get slot# radius 840 | >[-][<->-]< >[-]< [>[-]+<-] >- [[-]< %% IF (radius=0) 841 | [-]>[-]+++++++[<+++++++>-]<-.[-] %% output 0 digit 842 | >]< %% END IF (radius=0) 843 | [-] ++++++++++.[-] %% \n 844 | >]< %% END IF (function#4) 845 | 846 | >]< %% END IF (class#2) 847 | 848 | 849 | <[<<<<<<<<<<<<<<<<<<<<]> %% walk back to root object 850 | <<<<<<<<<<<<<<<<<<<< <<] 851 | 852 | %% 853 | %% [ http://www.angelfire.com/tx4/cus/shapes/ ] 854 | %% 855 | -------------------------------------------------------------------------------- /test/rot13.b: -------------------------------------------------------------------------------- 1 | -,+[ Read first character and start outer character reading loop 2 | -[ Skip forward if character is 0 3 | >>++++[>++++++++<-] Set up divisor (32) for division loop 4 | (MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero) 5 | <+<-[ Set up dividend (x minus 1) and enter division loop 6 | >+>+>-[>>>] Increase copy and remainder / reduce divisor / Normal case: skip forward 7 | <[[>+<-]>>+>] Special case: move remainder back to divisor and increase quotient 8 | <<<<<- Decrement dividend 9 | ] End division loop 10 | ]>>>[-]+ End skip loop; zero former divisor and reuse space for a flag 11 | >--[-[<->+++[-]]]<[ Zero that flag unless quotient was 2 or 3; zero quotient; check flag 12 | ++++++++++++<[ If flag then set up divisor (13) for second division loop 13 | (MEMORY LAYOUT: zero copy dividend divisor remainder quotient zero zero) 14 | >-[>+>>] Reduce divisor; Normal case: increase remainder 15 | >[+[<+>-]>+>>] Special case: increase remainder / move it back to divisor / increase quotient 16 | <<<<<- Decrease dividend 17 | ] End division loop 18 | >>[<+>-] Add remainder back to divisor to get a useful 13 19 | >[ Skip forward if quotient was 0 20 | -[ Decrement quotient and skip forward if quotient was 1 21 | -<<[-]>> Zero quotient and divisor if quotient was 2 22 | ]<<[<<->>-]>> Zero divisor and subtract 13 from copy if quotient was 1 23 | ]<<[<<+>>-] Zero divisor and add 13 to copy if quotient was 0 24 | ] End outer skip loop (jump to here if ((character minus 1)/32) was not 2 or 3) 25 | <[-] Clear remainder from first division if second division was skipped 26 | <.[-] Output ROT13ed character from copy and clear it 27 | <-,+ Read next character 28 | ] End character reading loop 29 | [edit] 30 | --------------------------------------------------------------------------------