brainf̶u̶c̶k̶

From Esolang
Jump to navigation Jump to search

brainfuck is a pretty good esolang, but you can't use it without a hippocampus. Though this is an awful esolang, you don't need a hippocampus to use it.

Introduction

This is an esolang created by User:D, for people who wouldn't bother to remember the state of the program. But people with a normal hippocampus can still use it as well.

Execution

This esolang has only one command: [, which jumps to the end of the program. All other characters are NOPs. Brackets don't have to match.

Example Programs

Do nothing

[

or:

[]

A more elaborate one:

[[][[]][]]

Another version:

>>>[>>]<<[>]<[>]

Interpreters

><>

12 bytes

i:0(?;"["=?;

brainfuck

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

The program is generated by BFFuck.

C

#include<stdio.h>
int main(){
   char c;
   while((c=getchar())!=EOF){
      if(c=='[') return 0;
   }
   return 0;
}

Common Lisp

An implementation in Common Lisp follows. Please note that, owing to brainfuck's name, Unicode support is mandated; however, the concrete character set deployed constitutes a dependency on the Common Lisp implementation; in corollary, Unicode support may or may not be a feature incorporated in the personal environment. The interpreter at hand has been developed and tested with Steel Bank Common Lisp (SBCL) version 1.1.4 as part of the Lisp Cabinet 0.3.5 bundle.

(defun interpret-brainf̶u̶c̶k̶ (code)
  "Interprets the piece of brainf̶u̶c̶k̶ code and returns ``NIL."
  (declare (type string code))
  (loop with ip of-type fixnum = 0 while (< ip (length code)) do
    (if (char= (char code ip) #\[)
      (setf ip (length code))
      (incf ip))))

JavaScript

function you_can_brain_without_a_fuck(program){
    var ip=0;
    while(ip<program.length){
        if(program[ip]=="["){
            ip=program.length;
        }else{
            ip=ip+1;
        }
    }
}

Python

import sys

ptr = 0
prog = open(sys.argv[0]).read()

while ptr < len(prog):
    if prog[ptr] == '[':
        ptr = len(prog)
        continue
    ptr += 1

WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic++

do
bulk infect
if number of Infections = 91 Then
Exit Do
end If
Loop while number of Infections <> 10

See also