From Esolang
Jump to navigation Jump to search

BitFlip is a language by User:Zzo38.

There are an unlimited number of variables that can store 1 bit each, and they can be named using numbers, letters, and the symbols -+_~'.


.var = Toggle value of var
?name = Go to the first ?name that matches this one and is constant
[var commands] = Loop while var is set
^name = Call subroutine at label ?name if it exists
% = Return from subroutine or stop program if not in one
& = Forget one entry from call stack

Pre-processor commands:

!name{commands} = Define a macro (name cannot include _ and ~)
,macro{parameters} = Run macro (parameters are separated by semicolons)
$number = When you run the macro, $1 is replaced by the first parameter, $2 by the second parameter, etc.
@number{parameter} = Repeat parameter number times
/*comment*/ = Comment


(var) = Returns _ if var is unset, ~ if var is set
<name> = Calls an external function and returns one bit, _ or ~
#_ = Returns ~
#~ = Returns _
#char = If char isn't _ or ~ then returns value of var called char

External functions for I/O:

<IN> = Input a bit
<OUT~> = Output 1, return 1
<OUT_> = Output 0, return 0


Copy input to output, forever (infinite cat program):


Display all characters 0 to 255:


Nested macros:

/* Now these bits are set: FirstB FirstSecondC */

Compuational class

It is Turing-complete, because it is postible to translate every Smallfuck program to it

See also

Other languages operating on bits (implemented only):