Skip to content
/ bfk Public

Brainf*ck programming language interpreter.

Notifications You must be signed in to change notification settings

jaschon/bfk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bfk

Brainf*ck programming language interpreter in multiple languages.

  • Python
  • Rust

https://en.wikipedia.org/wiki/Brainfuck

Characters

Memory

  • > Increment the data pointer by one.
  • < Decrement the data pinter by one.

Values

  • + Increment the byte at the data pointer by one.
  • - Decrement the byte at the data pointer by one.

Input & Output

  • . Output the byte at the data pointer.
  • , Accept one byte of input and store it in the byte at the data pointer.

Loop

  • [ If the byte at the data pointer is zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] command.
  • ] If the byte at the data pointer is nonzero, then instead of moving the instruction pointer forward to the next command, jump it back to the command after the matching [ command.

Examples

# Hello World!
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

# Hello World!
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.#>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]>++++++++[ <++++>-]<+.[-]++++++++++.

# Fibonacci sequence.
>++++++++++>+>+[ [+++++[>++++++++<-]>.<++++++[>--------<-]+<<<]>.>>[ [-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<- [>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>> ]<<< ]

About

Brainf*ck programming language interpreter.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published