DoubleFuck

DoubleFuck is a modification of BF that operates on two tapes, rather than one. In addition to the normal BF commands, there is a second set of commands for working with this second tape and pointer. The accepted abbreviation for Doublefuck is DBF.
==Language overview==
DBF works with two data arrays, each with an independent pointer. Both pointers are initialized to the first cell in their respective array. The commands are:
Command 	Description
> 	Move the first pointer to the right
< 	Move the first pointer to the left
Increment the memory cell in the first array under the first pointer	
Decrement the memory cell in the first array under the first pointer	
. 	Output the character signified by the cell at the first pointer
, 	Input a character and store it in the cell at the first pointer
[ 	Jump past the matching ] if the cell under the first pointer is 0
] 	Jump back to the matching [ if the cell under the first pointer is not 0
v 	Move the second pointer to the right
^ 	Move the second pointer to the left
/ 	Increment the memory cell in the second array under the second pointer
\ 	Decrement the memory cell in the second array under the second pointer
: 	Output the character signified by the cell at the second pointer
; 	Input a character and store it in the cell at the second pointer
{ 	Jump past the matching } if the cell under the second pointer is 0
==History==
Currently, little information regarding DoubleFuck is available on the web- a failing this article hopes to rectify. If the original language author finds this page, it is hoped that more historical information can be added.
==Examples==
===Hello, World!===
 v++++++++++[-///////v//////////v////v///v////////^^^^>+++++++++++<]//:v/:///////::///:v////:v//:
 v///////:>+.+++.------.--------.^/:
First line is printing 'Hello, ', second line 'World!'
==Computational class==
DoubleFuck is Turing-complete by a trivial reduction from Brainfuck.
==Implementations==
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int bf_index = 0, dbf_index = 0;
char bf_array[5000], dbf_array[5000], f[5000], b, *s=f;
void interpret(char *c)
{
	char *d;
	while( *c ) {
		switch(*c++) {
		//bf operations
		case '<': bf_index--; break;
		case '>': bf_index++; break;
		case '+': bf_array[bf_index]++; break;
		case '-': bf_array[bf_index]--; break;
		case '.': cout<<bf_array[bf_index]; break;
		case ',': cin>>bf_array[bf_index]; break;
		case '[':
			for( b=1,d=c; b && *c; c++ )
				b+=*c=='[', b-=*c==']';
			if(!b) {
				c[-1]=0;
				while( bf_array[bf_index] )
					interpret(d);
				c[-1]=']';
				break;
			}
		case ']':
			cout<<"UNBALANCED BF BRACKETS", exit(0);
		//dbf operations
		case '^': dbf_index--; break;
		case 'v': dbf_index++; break;
		case '/': dbf_array[dbf_index]++; break;
		case '\\': dbf_array[dbf_index]--; break;
		case ':': cout<<dbf_array[dbf_index]; break;
		case ';': cin>>dbf_array[dbf_index]; break;
		case '{':
			for( b=1,d=c; b && *c; c++ )
				b+=*c=='{', b-=*c=='}';
			if(!b) {
				c[-1]=0;
				while( dbf_array[dbf_index] )
					interpret(d);
				c[-1]='}';
				break;
			}
		case '}':
			cout<<"UNBALANCED DBF BRACKETS", exit(0);
 //debug
		case '#':
		 for(int i =0; i < 6; i++)
 cout<<int(bf_array[i])<<" ";
			cout<<"position bf "<<bf_index<<endl;
			for(int i =0; i < 6; i++)
 cout<<int(dbf_array[i])<<" ";
			cout<<"position dbf "<<dbf_index<<endl;
			break;
		}
		if( bf_index<0 || bf_index>5000)
			cout<<"BF RANGE ERROR", exit(0);
 if( dbf_index<0 || dbf_index>5000)
			cout<<"DBF RANGE ERROR", exit(0);
	}
}
int main(int argc,char *argv[])
{
	FILE *z;
	if(z=fopen(argv[1],"r")) {
		while( (b=getc(z))>0 )
			*s++=b;
		*s=0;
		interpret(f);
	}
	return 0;
}
==See also==
* :Category:Brainfuck derivatives, languages based on brainfuck
Category:Brainfuck derivativesCategory:Turing tarpitsCategory:Low-levelCategory:Cell-basedCategory:ImplementedCategory:Languages