ScoreUnder / brainfuck-interpreter

Yet another brainfuck interpreter. Tries to perform optimisations for common operations.
0 stars 0 forks source link

One from the 'also ran' section. #3

Closed rdebath closed 8 years ago

rdebath commented 8 years ago

This is a cell doubling of the string +[>]; as such it should just run straight through. Instead it goes for an infinite loop and tries to use up all of memory.

>+<+[>-]>[->>+<]<<
>+<[>-]>[->+>[<-]<[<]>[-<+>]]<-[+<
>>>>
>[-]>[-]<<
>+<[>-]>[->+>[<-]<[<]>[-<+>]]<-]<

However, Note that this one completes successfully.

>+<+[>-]>[->>+<]<<
>+<[>-]>[->+>[<-]<[<]>[-<+>]]<-[+<
>>>>
>+<[>-]>[->+>[<-]<[<]>[-<+>]]<-]<
ScoreUnder commented 8 years ago

Thanks again for finding these. Is there a common test suite you're pulling from? I'd like to run as many inputs as possible to see whether there are any more strange behaviours.

rdebath commented 8 years ago

You could call it that I suppose; it's actually just all the test programs I found plus a few that I wrote.

https://github.com/rdebath/Brainfuck/blob/master/bitwidth.b https://github.com/rdebath/Brainfuck/tree/master/testing

The bitwidth.b is a bit of a torture test. Of course, the first test is just a "Hello World!" that is only a little aggressive.

>++++++++[-<+++++++++>]<.>[][<-]>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.
>->+++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+.

You seem to be successful at all you're fast enough for at the moment: https://rawgit.com/rdebath/Brainfuck/results/index.html