ScratchData LogoScratchData
Back to MonkeyBean2's profile

BrainF Interpreter (100% utter confusion)

MOMonkeyBean2•Created August 24, 2022
BrainF Interpreter (100% utter confusion)
41
26
829 views
View on Scratch

Instructions

BrainF Interpreter This project interprets code written in the BrainF programming language. --- Instructions --- Enter some BrainF code (see the examples section) Then view the output in the "Output" list. If your BrainF code asks for input, keep in mind that you can only enter in ONE character at a time. --- What is brainF? --- BrainF is an esoteric programming language, which runs on a Turing-like machine. BrainF, like a Turing machine uses a "tape" of cells, but each cell is a byte (8 bits) instead of a bit. --- Syntax --- > Increments the memory pointer < Decrements the memory pointer + Increments the cell at the memory pointer - Decrements the cell at the memory pointer [ Starts a loop, if the cell at the memory pointer is not 0, else it skips the loop. ] Ends a loop, if the cell at the memory pointer is 0 , Takes 1 byte (1 character) of input, and puts it at the cell at the memory pointer . Prints the value at the memory pointer, as a character Note: A cell's value will wrap around if it exceeds 255, or is less than 0 --- Examples --- Hello World: ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. Terribly leaky repeated hello world (very tiny loop part added by @monkeybean2): +[[-]++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.] Echo: +[,.+] Caeser Cyphers: (these do not wrap around at the end/beggining of the alphabet) (by @MonkeyBean2) (+1 shift): +[,+.+] (+5 shift): +[,+++++.+] (-3 shift): +[,---.+] Odd: +>++< [[>>+>+<<<-]>[>>>+>+<<<<-]>>[-<<<+>>>] >>[-<<<<+>>>>]<[-<<+>>]<<<] Suggest more in the comments! Please tell me about any bugs. This was made in 20 minutes (but the description and thumbnail took longer loooooll) Note: BrainF *definitely* stands for BrainFart. Note: All non-printable ASCII characters were stupidly replaced with a space (" "), I should use something else, maybe a hairspace idk

Project Details

Project ID724558656
CreatedAugust 24, 2022
Last ModifiedJuly 17, 2024
SharedSeptember 5, 2022
Visibilityvisible
CommentsAllowed