|
Hi,
I saw your BrainFuck interpreter for BrainFuck and it encouraged me to write my own version of it. I now write to you as I thought, you might be interested about it.
I wanted to write as fast version as possible so I wrote it directly with Brainfuck. Here is a list of key tricks, that I used to get maximum performance:
No more explaining... here is the code:
>>>+[,>+++++++[<------>-]<[->+>+<<]>>[-<<+>>]<->+<[>-<[-]]>[-<<[-]++++ +>>>>>]<<[->+>+<<]>>[-<<+>>]<-->+<[>-<[-]]>[-<<[-]++++++++>>>>>]<<[->+ >+<<]>>[-<<+>>]<--->+<[>-<[-]]>[-<<[-]++++++>>>>>]<<[->+>+<<]>>[-<<+>> ]<---->+<[>-<[-]]>[-<<[-]+++++++>>>>>]<<[->+>+<<]>>[-<<+>>]++++++[<--- >-]+<[>-<[-]]>[-<<[-]++++>>>>>]<<[->+>+<<]>>[-<<+>>]+++++[<---->-]+<[> -<[-]]>[-<<[-]+++>>>>>]<<[->+>+<<]>>[-<<+>>]+++++++[<------->-]+<[>-<[ -]]>[-<<[-]+>>>>>]<<[->+>+<<]>>[-<<+>>]+++++++[<------->-]<-->+<[>-<[- ]]>[-<<[-]++>>>>>]<++++[<---->-]<]<<<[<<<]>>> [-->+<[>-]>[>]<<++>[-<<<< <+[>-->+<[>-]>[-<<+>>>]<<+>+<[>-]>[-<<->>>]<<+<[-<<<+>>>]<<<]>>>>>]<-> +<[>-]>[>]<<+>[-<->>>[>>>]>[->+>>+<<<]>[-<+>]>>[-[->>+<<]+>>]+>[->+<]> [-<+>>>[-]+<<]+>>[-<<->>]<<<<[->>[-<<+>>]<<<<]>>[-<<<<<+>>>>>]<<<<<<<[ >>[-<<<+>>>]<<<<<]+>>[>-->+<[>-]>[-<<->>>]<<+>+<[>-]>[-<<+>>>]<<+<[->> >+<<<]>>>]<]<--->+<[>-]>[->>[>>>]>+<<<<[<<<]>>]<<->+<[>-]>[->>[>>>]>-< <<<[<<<]>>]<<->+<[>-]>[->>[>>>]>[->+>>+<<<]>[-<+>]>>[-[->>+<<]+>>]+>+< [-<<]<<<<<[<<<]>>]<<->+<[>-]>[->>[>>>]>[->+>>+<<<]>[-<+>]>>[-[->>+<<]+ >>]+>-<[-<<]<<<<<[<<<]>>]<<->+<[>-]>[->>[>>>]>[->+>>+<<<]>[-<+>]>>[-[- >>+<<]+>>]+>.<[-<<]<<<<<[<<<]>>]<<->+<[>-]>[->>[>>>]>[->+>>+<<<]>[-<+> ]>>[-[->>+<<]+>>]+>,<[-<<]<<<<<[<<<]>>]<<++++++++>>>]Thanx for giving me inspiration! :-)
~NYYRIKKI
>>>+[,>+++++++[<------>-]<[->+>+<<]>>[-<<+>>]<->+<[>-<[-]]>[-<<[-]+++++ >>>>>]<<[->+>+<<]>>[-<<+NNNNNN>>]NNN<NNNNNNNN-->+<[>-<[-]]>[-<<[-]+++++ +++>>>>>]<<[->+>+<<]>>[-NNNNNNN<<NNN+NNNNNNNN>>]<--->+<[>-<[-]]>[-<<[-] ++++++>>>>>]<<[->+>+<<]>NNN>[NN-<NNN<+>>NN]<---->+<[>-<[-]]>[-<<[-]++++ +++>>>>>]<<[->+>+<<]>>[-NNN<NN<+>NNN>]++NN++++[<--->-]+<[>-<[-]]>[-<<[- ]++++>>>>>]<<[->+>+<<]>>NNNNN[-<<NNN+>>]NN+++++[<---->-]+<[>-<[-]]>[-<< [-]+++>>>>>]<<[->+>+<<]>NNN>[NN-<NNN<+>>NN]+++++++[<------->-]+<[>-<[-] ]>[-<<[-]+>>>>>]<<[->+>+NNN<<NN]>NNN>[-<NN<+>>]+++++++[<------->-]<-->+ <[>-<[-]]>[-<<[-]++>>>>>NNNNNNN]<NNN++++NN[<---->-]<]<<<[<<<]>>>[-->+<[ >-]>[>]<<++>[-<<<<<+[>--NNNNNN>+<NNN[>-]NN>[-<<+>>>]<<+>+<[>-]>[-<<->>> ]<<+<[-<<<+>>>]<<<]>>>>>]<->+<[>-]>[>]<<+>[-<->>>[>>>]>[->+>>>+<<<<]>[- <+>]>>>[-[->>>+<<<]+>>>]+>[->>+<<]>>[-<<+>>>>>[-]+<<<]<[->+<]>[-<+>>>>[ -]+<<<NNNNN]+>>>NNNN[-<<NNN<-NNN>>NNNNNN>]<NN<<<<<[NNNNNN->NNNNNN>>[-<< <+>>>]NNNNNN<<<NNNNNN<<<NNN]>NNN>>NNNNNN[-<NN<<<<<+NNNNNN>>NNNNNNN>>>>] <<<<<<NN<<NN[>NNN>[-NN<<NNN<+NNN>>NN>]NN<<<NN<<]+>>NN[>-->+NN<[>NN-]>[- <<->>>NN]<NN<+NN>+<[NN>-NNN]>NNN[-NNNNNN<<+NN>>>]<<NNNNNN+<NN[->NN>>+<< <]>>>]NN<]NNN<NN--->NN+<NNN[>NNN-]NNNNN>[->NN>[>>>]NNNNNN>+NNNNNN<<<<[< <<]>>]NN<<NN->NN+<[>NN-]NNN>[NNN->NN>[NNN>>NN>]>-<<NN<<[<<<NNNNNN]>>]<< ->+<[>NN-]NN>[NN->>[NN>>>NN]>NN[->NN+>>NN>+NN<<<<]>NN[-<+>]NN>>NN>[-[-> >>+<<<NNNNNN]+>NN>>NNN]+>NNN[NN-<+NNNNNNN>]NNNNNN>>NNNNNN+<NN<<[NN>>>-] >>>[>>NNNNN>]<<<NNNNN[-<+>NNNN]<<<NNNNNN[->NNNNNN+<NNNNNN]+NN[-<NN<<]<< <<<[<<<]>>]<<->+<[>-]>[->>[>>>]>[->+>>>+<<<<]>[-<+>]>>>[-[->>>+<<<]+>>> ]>[-<+>]>>+<<<[>>>-]>>>[>>>]<<<[-<->]<<<-[->+<]+[-<<<]<<<<<[<<<]>>]<<-> +<[>-]>[->>[>>>][ <-- Made By NYYRIKKI 2002 --> ]>[->+>>>+<<<<]>[-<+> ]>>>[-[->>>+<<<]+>>>]+>.<[-<<<]<<<<<[<<<]>>]<<->+<[>-]>[->>[>>>]>[->+>> >+<<<<]>[-<+>]>>>[-[->>>+<<<]+>>>]+>,<[-<<<]<<<<<[<<<]>>]<<++++++++>>>]
(On November 13, 2002, I recieved an email from Daniel B. Cristofani pointing to his even shorter interpreter.)