scene.org File Archive

File download

<root>­/­parties­/­2018­/­thegathering18­/­useless_utility/brainf_ck_interpreter_written_in_brainf_ck_by_itr.zip

File size:
3 734 bytes (3.65K)
File date:
2018-04-01 22:33:55
Download count:
all-time: 57

Preview

  • interpreter.bf 3.93K
  • README.txt 5.46K

file_id.diz

BrainF*ck is an esoteric programming language that uses only 8 symbols: http://esolangs.org/wiki/Brainfuck
 > 	Move the pointer to the right
 < 	Move the pointer to the left
 + 	Increment the memory cell under the pointer
 - 	Decrement the memory cell under the pointer
 . 	Output the character signified by the cell at the pointer
 , 	Input a character and store it in the cell at the pointer
 [ 	Jump past the matching ] if the cell under the pointer is 0
 ] 	Jump back to the matching [ if the cell under the pointer is nonzero


To run a BrainF*ck program you need to have an interpreter, for example the one at https://copy.sh/brainfuck/
I wrote such an interpreter in BrainF*ck itself, which you can find in the file "interpreter.bf"

To test the interpreter, go to https://copy.sh/brainfuck/ then paste the text from "interpreter.bf" into the code field, and the code then input, separated by a 0 byte, in the input field.
For example, using `,[<,]>[.>]\x00!dlrow olleH` will take the program `,[<,]>[.>]` which takes a text and inverts it, then load it into the interpreter I wrote, and subsequently take the input "!dlrow olleH" and invert it.

The interpreter assumes an infinite band in both directions, and a looping cells, and can run any program that would run on that implementation, even itself.
Keep in mind that if you do try to run the interpreter in itself, it may take quite a lot of time, running the program below took approximately 5.5 minutes: (You may have to turn on dynamic memory)


+<<<<<<<<<+>>>>>>+>>>>>>+>>>>>>>>>,[>>>>>,]<<-[+<<<<<-]+<<<[>>>>>>>>>>>>>>[>>>>>]+>[-<<+>>>>>+<<<]>>>[-<<<+>>>]+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<->>>>>>>>>>>>>]<<<<<------------------------------------------->>>>>+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+>>>[[>>>>>]<<<<+<[<<<<<]]<<<<<[[<<<<<]>>>>>>+<[>>>>>]]<<<<<<<<-[+>>>>>-]+>>>>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>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>]+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<<<<<<<[<<<<<]>>>>>-<-[+>>>>>-]+<<<<<<<<<[->>>>>>>>>>>>>>>>>>>+>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>]+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<<<<<<+>>>>>>>>>>>>>>>>>>]<<<<<[+]-[+<<<<<-][+>>>>>-]+>>>>>>>>>>]<<<<<->>>>>+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<<<<<<<<+[>>>>>>>>>>>>>>>>>>>>>[>>>>>]<<<<<-<<<<[-<<+>>>>>+<<<]>>>[-<<<+>>>]+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>]<<<<<--------------------------------------------------------------------------------------------->>>>>+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<<<<<<<<[<<<<<]+>>>>>[>>>>>]>>>>>>>>>>>>>>>]<<<<<++>>>>>+<<<<<[>>>>>-]>>>>>[>>>>>]<<<<<[--[+<<<<<-]+<<<<<<<<<<[<<<<<]>>>>>->>>>>[>>>>>]>>>>>>>>>>>>>>>]<<<<<[+]-[+<<<<<-]+<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>]<<<<<[+]-[+<<<<<-]+<<<<<<<<<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>]<<<<<[+]-[+<<<<<-]+<<<]<<<<<<<<<<<[->>>>>>+<<<<<<]>>>>>>[+++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++.++++++++++++.+.-----------.---------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++..---.+++.--------------------------------------------------------------------.------------------------------------.[-]]\x00,[<,]>[.>]\x00!dlrow olleH