No, all eight characters have a one-to-one correspondence with specific C code
that's like saying that because assembly and machine code have a one-to-one conversion they are the same.
Brainfuck "interpreters" exist, but those are just programs that convert brainfuck code into the equivalent C, which would then be passed through a C compiler to produce an executable binary.
that would be called a compiler, not an interpreter.
if you want a brainfuck interpreter here's one
Code:
void parse_brainfuck(char *code)
{
unsigned int ptr=0;
unsigned char memory[1000];
while(*code!=NULL)
{
switch(*code)
{
case '>':
ptr++;
code++;
break;
case '<':
ptr--;
code++;
break;
case '+':
memory[ptr]++;
code++;
break;
case '-':
memory[ptr]--;
code++;
break;
case '.':
putchar(memory[ptr]);
code++;
break;
case ',':
memory[ptr]=getch();
code++;
break;
case '[':
if(memory[ptr]==0)
{
while(*code!=']') code++;
code++;
break;
}
else
{
code++;
}
break;
case ']':
if(memory[ptr]!=0)
{
while(*code!='[') code--;
break;
}
else
{
code++;
}
break;
default:
break;
}
}
}
you can also do one in assembly (and pretty much every other language), but i don't feel like typing that much
Bookmarks