diff --git a/examples/99bottles.bf b/examples/99bottles.bf new file mode 100644 index 0000000000000000000000000000000000000000..93cff7bef2c536b5c75887a6c31f53a6e881bea2 --- /dev/null +++ b/examples/99bottles.bf @@ -0,0 +1,21 @@ +.++>+>++>>+>>>++++++++++[->+>+>++++++++++<<<]>>>>++++++++++[->+++++>++++++++++>+ +++++++++++>++++++++>++++++++>+++>++++>+<<<<<<<<]+>->+++>++++++>->+++++>+++>+++++ +>+>+>+>+>++>+>+>++[-<]<<<<<<<[->>[>>>>>>>>[<<<<<<<[->[-]>>>>>>>>>>>.<----.>>>.<< +<--.++.+++.+<-.+<<+<<<<<<<<]+>[-<[-]>>>>>[>>>+<<<<+<+<+>>>-]<<<[->>>+<<<]>[>>>>> +>+<<<<<<-]>>>>>[[-]>.<]<<<<[>>>>>-<<<<<-]>>[<<+<+<+>>>>-]<<<<[->>>>+<<<<]>[>>>>> +>+<<<<<<-]>>>>>>.<<<<<[>>>>>-<<<<<-]>>>[-<<<+<+>>>>]<<<<[->>>>+<<<<]>-[[-]>>>>+< +<<<]<<<]+>>>>>>>>>>>>>.<<<<----.>----.+++++..-<++++++++++.-------.<<[[-]>>>.<<<] +>>>>>>.<<<----.<+.>>>>.<<<<----.+++..+>+++.+[>]+>+>[->+<<-<-<<<.<<<----.-.>>>.<< +<++++++.<++.---.>>>>.<<<+++.<----.+++++++++++..------>---->--------------------- +----------->>>++.-->..>>>]>>>[->[-]<<<<<<<[<]<[-]>>[>]>>>>>]+>[-<[-]<<<<[->>[->+ +<<<<-<<<.<<<----.-.>>>.<<<++++++.<++.---.>>>>.<<<+++.<----.+++++++++++..------>- +--->++++++++++++++++++++++++++++++++>>>.<.>>>>>>]<<]<[->>>>[-<<+<<<<++.-->.[<]<< +<<<<<<[->[-]<]+>[-<[-]>>>>>>>>>>>>>.<<<-----.++++++++++.------.>>>>.<<<----.-.<. +>>>>.<<<<-.>+.++++++++.---------.>>>.<<<<---.>.<+++.>>>>.<<<++.<---.>+++..>>>.<< +<<++++++++.>+.>>>.<<<<--------.>--.---.++++++.-------.<+++.++>+++++>>>>.<.[<]<<< +<<<<]+>>>>>>-<<<+>>[<<[-]<+<+>>>>-]<<<<[>-<[-]]>[->>>+<<<]>[->->+++++++++<<]>>>> +>[>]>>>>]<<<<]>>>>>>]+<<<<<<<[<]<]+<+<<<<<<+<-]>>>>>>>>>>[>]>>>>>[->[-]<]+>[-<[- +]<<<<<<<<<-------------.<<----.>>>.<<<+++++.-----.>>>.<<<+++++.<++.---.>>>>.<<<- +.+.-----.+++.<.>>>>.<<<<----.>----.<+++.>>>>.<<<<--.>+++++++.++++.>>>.<<<------. +----.--.<+++.>>>>.<<<.++.+++.+<.+>>>>>.<.>>>>>>>>>]+<[-]+<[-]<[-]<[-]+<<<[<]<[-] +<[-]<[-]<[-]++++++++++[->+>+>++++++++++<<<]>->->-<<<<<<[-]+<[-]<+<<] \ No newline at end of file diff --git a/examples/mandelbrot.b b/examples/mandelbrot.b new file mode 100644 index 0000000000000000000000000000000000000000..5e253e105c18aa0936307ff95c31b5087cde8297 --- /dev/null +++ b/examples/mandelbrot.b @@ -0,0 +1,145 @@ + A mandelbrot set fractal viewer in brainf*** written by Erik Bosman ++++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[ +>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+ +<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>> +>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>> +>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>> +>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<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<<+>>]<[->+<]>>>>>>>>]<< +<<<<<[->>>>>>>+<<<<<<<]<+<<<<<<<<<]>+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>> ++>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>[-<<<<<<->>>>>>]+< +<<<<<[->>>>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<< +<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>> +-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>> +>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++ ++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<< +<<<<<]]>>>] diff --git a/examples/quine.bf b/examples/quine.bf new file mode 100644 index 0000000000000000000000000000000000000000..2cb3f4cf1a7ba3a164241d92ca4b5ef6f38f2c2f --- /dev/null +++ b/examples/quine.bf @@ -0,0 +1,43 @@ +>>>>>+++++>+++++>+++++>+++++>+++++>>++++++>++++>+++++++>++++>++++++>++++> ++++++++>++++>++++++>++++>+++++++>+++++>++++++>++++>++++++>++>+++++++>+>+>+>+>+> ++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+ +>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+++++>++++++>++++>++>++>++>++>++>++>++>++>++>++> +++>++>++>++>++>++>++>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>+++++>+++ ++>++++>+>+++++>+++++>++>++++++>++++>+>+++++>++++>++++>+>+++++>+++++>++>++++++>+ ++++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+> ++>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+> ++>+>+>+>+>+>+>+>+>+>+>+>+>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>++++ ++>++++>++++>+>+++++>+++++>++>++++++>++>+++++++>+++++++>+++++++>+++++++>+++++++> ++++++++>+++++++>+++++++>++++>+++>++++++>++>+++++++>+++++>+++++>+++++++>++++>+++ ++>++++>++++++>++++>+++++++>+++++>++++++>++++++>++++>++++>+>+++++>+++++>++++>+++ ++++>++>+++++++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+> ++>+>+>+>+>+>+>+>+>+>+>+++>++++++>++>+++++++>+++++>++>+++++++>++++++>++>+++++++> ++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+ +>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+++>++++++>++>+++++++>+++++>++++++ ++>++++++>++>+++++++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+ +>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+++>++++++>++> ++++++++>+++++>+++++>+++++>++++++>++++++>++++>++++>+>+++++>+++++>++++>++++++>++> ++++++++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+ +>+>+>+>+>+>+>+>+++>++++++>++>+++++++>+++++>++>+++++++>++++++>++>+++++++>+>+>+>+ +>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+> ++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+++>++++++>++>+++++++>+++++>+++++++>++++> +++++>++++>++++++>++++>+++++++>+++++>++++++>++++>++++++>++>+++++++>+>+>+>+>+>+>+ +>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+> ++>+>+>+>+>+>+>+>+>+>+>+>+>+>+++++>++++++>++++>++>++>++>++>++>++>++>++>++>++>++> +++>++>++>++>++>++>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>+++++>++++>+ ++++>+>+++++>+++++>++>++++++>++++>+>+++++>++++>++++>+>+++++>+++++>++>++++++>++++ +>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>+ +++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+>+ +>+>+>+>+>+>+>+>+>+>+>+>+++++>++++>++++>+>+++++>+++++>++>++++++>++++>+>+>+++++>+ ++++>++++>+>+++++>+++++>++>++++++>++>+++++++>+++++++>+++++++>+++++++>+++++++>+++ +++++>+++++++>+++++++>++++>+++>++++++>++>+++++++>+++++>+++++>+++++++>[<]<[<]<[<]>[< +[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[<-----------------><<+> +>-[<++><<+>>-[<+><<+>>-[<++++++++++++++><<+>>-[<++><<+>>-[<++++++++++++++++++++++++ ++++++><<+>>-[<++><<+>>-[-]]]]]]]]<.[-]>>]<<<[<]>[[<<+>><[-]+++++++++++++++++++++++++++++++ +++++++++++++.[-]>-][-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++.[-]>][-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[-]>>>[[<<+> +><[-]+++++++++++++++++++++++++++++++++++++++++++.[-]>-][-]++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++.[-]>]<<<[<]>[<[-]++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++>[<-----------------><<+>>-[<++><<+>>-[<+><<+>>-[<++++++++++ +++++><<+>>-[<++><<+>>-[<++++++++++++++++++ ++++++++++++><<+>>-[<++><<+>>-[-]]]]]]]]<.[-]>>] \ No newline at end of file diff --git a/src/REPL.hs b/src/REPL.hs index d8637303dea3cc7b142f984d5a9d70eee30fd9b9..bc9a3a284c93c9d782f8ad584a17848d461724cf 100644 --- a/src/REPL.hs +++ b/src/REPL.hs @@ -147,7 +147,10 @@ readCell = do runBrainCodeLoop :: BrainBreakBlock -> StateT REPLState IO () runBrainCodeLoop code = do - runBrainBreakCode code + cell <- getCell + case cell of + 0 -> return () + val -> runBrainBreakCode code cell <- getCell case cell of 0 -> return () diff --git a/test.bf b/test.bf deleted file mode 100644 index 7c7ddffc21f34485197beb7b10fecd656499f91b..0000000000000000000000000000000000000000 --- a/test.bf +++ /dev/null @@ -1,7 +0,0 @@ -++++++++++[ - >+++++++>++++++++++>+++>+<<<<- - ] - >++.>+.+++++++.. - +++.>++.<<+++++++++++++++. - >.+++ -.------.--------.>+.>. \ No newline at end of file