跳到正文

个人记录

BF语言编译器汉化版(编写By cjt,汉化By xry)

xryjr233约 80 分钟
原文
文章信息与版本

文章信息

发布
2018年10月31日
收录
2025年12月12日
更新
2026年11月15日
篇幅
约 80 分钟

版本

  1. v2当前
  2. v1

其实我基本什么也没干,就是把源代码中的英文部分改成了中文(作者有拼写错误233)并在”运行”操作结束后加了个system(“pause”)防止自动返回主界面来不及看结果,还是感谢作者提供这个编译器,还有,我顺便写了一个字符串转相对较短的BF源代码的程序。。。

作者源代码

BF详解(也是作者写的)

下载汉化编译器(.exe),提取码vxyn

下载源代码转换器(.exe),提取码djzj

两份的原代码都放在下面。

汉化代码(其实基本没有改)(c++)

C++
//For Brainfuck
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<windows.h>
#include<conio.h>
#include<ctime>
using namespace std;
clock_t t1,t2;
int ti;
POINT pt;
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME)&0x8000)?1:0)
HWND hConsole=FindWindow("ConsoleWindowClass",NULL);
void colset(int a){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void Goto(int Y,int X){
    COORD C; C.X=X; C.Y=Y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),C);
}
void Hide(){
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
bool got(){
    GetCursorPos(&pt);
    ScreenToClient(hConsole,&pt);
    fflush(stdin);
    return true;
}
int pan(int x,int y){
    if(x<0||x>64)   return 0;
    y/=8;
    ++y;
    if(y>=3&&y<=10) return 1;
    if(y>=13&&y<=20)    return 2;
    if(y>=23&&y<=28)    return 3;
    if(y>=31&&y<=42)    return 4;
    if(y>=45&&y<=50)    return 5;
    if(y>=53&&y<=57)    return 6;
    if(y>=60&&y<=71)    return 7;
    if(y>=74&&y<=80)    return 8;
    return 0;
}
int by[10000002];
char lo[10000002],sc[10000002];
bool bp[10000002];
int now=1,ma,s=-1,nnnn=0,cs,mn;
bool ok=false,xr;
int q=0,lk;
bool aaa;
bool co(int be,int en){
    if(be>en){
        printf("运行时错误:这里没有任何东西\n");
        for(int i=1;i<en;i++)   printf("%c",lo[i]);
        colset(12);
        for(int i=en;i<=be;i++) printf("%c",lo[i]);
        colset(15);
        for(int i=be+1;i<=q;i++)    printf("%c",lo[i]);
        printf("\n");
        aaa=false;
        lk=lk+3+(q-1)/175;
        printf("-----------------------------------\n");
    }
    int nn=be;
    while(nn<=en){
        if(lo[nn]=='<'){
            --now;
            if(now==0){
                printf("超内存限制:这里没有变量\n");
                for(int i=1;i<nn;i++)   printf("%c",lo[i]);
                colset(12);
                printf("%c",lo[nn]);
                colset(15);
                for(int i=nn+1;i<=q;i++)    printf("%c",lo[i]);
                printf("\n");
                aaa=false;
                lk=lk+3+(q-1)/175;
                printf("-----------------------------------\n");
            }
        }
        else if(lo[nn]=='>'){
            ++now;
            if(now>10000000){
                printf("超内存限制:我不懂你为什么需要这么大的内存……超过10,000,000字节!\n");
                aaa=false;
                printf("-----------------------------------\n");
                lk=lk+3+(q-1)/175;
            }
        }
        else if(lo[nn]=='+'){
            ;
        }
        else if(lo[nn]=='-'){
            ;
        }
        else if(lo[nn]=='.'){
            ;
        }
        else if(lo[nn]==','){
            ;
        }
        else if(lo[nn]=='['){
            int nnn=nn+1,no=1;
            while(no!=0 && nnn<=en){
                if(lo[nnn]=='[')    ++no;
                if(lo[nnn]==']')    --no;
                ++nnn;
            }
            if(nnn!=en+1||no==0){
                aaa=co(nn+1,nnn-2);
            }
            else{
                printf("编译错误:我不能找到最后的那部分!\n");
                for(int i=1;i<nn;i++)   printf("%c",lo[i]);
                colset(12);
                printf("%c",lo[nn]);
                colset(15);
                for(int i=nn+1;i<=q;i++)    printf("%c",lo[i]);
                printf("\n");
                aaa=false;
                printf("-----------------------------------\n");
                lk=lk+3+(q-1)/175;
            }
            nn=nnn-1;
        }
        else if(lo[nn]==' '){;}
        else if(lo[nn]==']'){
            printf("编译错误:我不能找到最开始的那部分!\n");
            for(int i=1;i<nn;i++)   printf("%c",lo[i]);
            colset(12);
            printf("%c",lo[nn]);
            colset(15);
            for(int i=nn+1;i<=q;i++)    printf("%c",lo[i]);
            printf("\n");
            aaa=false;
            printf("-----------------------------------\n");
            lk=lk+3+(q-1)/175;
        }
        else{
            printf("编译错误:我不知道\'%c\'是什么\n",lo[nn]);
            for(int i=1;i<nn;i++)   printf("%c",lo[i]);
            colset(12);
            printf("%c",lo[nn]);
            colset(15);
            for(int i=nn+1;i<=q;i++)    printf("%c",lo[i]);
            printf("\n");
            aaa=false;
            printf("-----------------------------------\n");
            lk=lk+3+(q-1)/175;
        }
        ++nn;
    }
    return aaa;
}
int ssc,sg=0,sg2,sg3=0,sg4;
void sou1(int be,int en){
    int nn=be;
    while(nn<=en){
        if(bp[nn]){
            t2=clock();
            ti=ti+(t2-t1);
            Goto(7+sg3,0);
            printf("这里有个断点!\n");
            for(int i=1;i<nn;i++)   printf("%c",lo[i]);
            colset(10);
            printf("%c",lo[nn]);
            colset(15);
            for(int i=nn+1;i<=q;i++)    printf("%c",lo[i]);
            printf("\n");
            printf("你可以检查这些值\n");
            printf("+----++----+\n");
            printf("|检查||放弃|\n");
            printf("|   L||   Q|\n");
            printf("+----++----+\n");
            while(1){
                if(kbhit()){
                    char haha=getch();
                    if(haha=='L'||haha=='l'){
                        int h=(mn+9)/10;
                        for(int i=0;i<h;i++){
                            for(int j=0;j<10;j++){
                                if(i*10+j+1==now)   colset(12);
                                printf(" %3d |",by[i*10+j+1]);
                                colset(15);
                            }
                            printf("\n");
                            if((now+9)/10==i+1){
                                for(int j=1;j<(now%10);j++) printf("      ");
                                printf(" ^^^\n");
                            }
                        }
                        printf("继续...\n");
                        Sleep(3000);
                        Goto(7+sg3,0);
                        printf("                    \n");
                        for(int i=1;i<=q;i++)   printf(" ");
                        printf("\n");
                        printf("                                              \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        for(int i=0;i<h;i++){
                            for(int j=0;j<10;j++){
                                printf("      ");
                            }
                            printf("\n");
                            if((now+9)/10==i+1){
                                for(int j=1;j<(now%10);j++) printf("      ");
                                printf("     \n");
                            }
                        }
                        printf("              \n");
                        break;
                    }
                    if(haha=='Q'||haha=='q'){
                        printf("正在继续\n");
                        Sleep(3000);
                        Goto(7+sg3,0);
                        printf("                    \n");
                        for(int i=1;i<=q;i++)   printf(" ");
                        printf("\n");
                        printf("                                              \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("              \n");
                        break;
                    }
                }
                if(KEY_DOWN(MOUSE_MOVED)){
                    got();
                    if(pt.y>(10+sg3+(q-1)/175)*16&&pt.y<(14+sg3+(q-1)/175)*16&&pt.x>0&&pt.x<48){
                        int h=(mn+9)/10;
                        for(int i=0;i<h;i++){
                            for(int j=0;j<10;j++){
                                if(i*10+j+1==now)   colset(12);
                                printf(" %3d |",by[i*10+j+1]);
                                colset(15);
                            }
                            printf("\n");
                            if((now+9)/10==i+1){
                                for(int j=1;j<(now%10);j++) printf("      ");
                                printf(" ^^^\n");
                            }
                        }
                        printf("继续...\n");
                        Sleep(3000);
                        Goto(7+sg3,0);
                        printf("                    \n");
                        for(int i=1;i<=q;i++)   printf(" ");
                        printf("\n");
                        printf("                                              \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        for(int i=0;i<h;i++){
                            for(int j=0;j<10;j++){
                                printf("      ");
                            }
                            printf("\n");
                            if((now+9)/10==i+1){
                                for(int j=1;j<(now%10);j++) printf("      ");
                                printf("     \n");
                            }
                        }
                        printf("              \n");
                        break;
                    }
                    if(pt.y>(10+sg3+(q-1)/175)*16&&pt.y<(14+sg3+(q-1)/175)*16&&pt.x>48&&pt.x<96){
                        printf("继续...\n");
                        Sleep(3000);
                        Goto(7+sg3,0);
                        printf("                    \n");
                        for(int i=1;i<=q;i++)   printf(" ");
                        printf("\n");
                        printf("                                              \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("                  \n");
                        printf("              \n");
                        break;
                    }
                }
            }
            t1=clock();
        }
        if(lo[nn]=='<') --now;
        else if(lo[nn]=='>'){
            ++now;
            if(mn<now)  mn=now;
        }
        else if(lo[nn]=='+'){
            ++by[now];
            while(by[now]<0)    by[now]+=128;
            while(by[now]>127)  by[now]-=128;
        }
        else if(lo[nn]=='-'){
            --by[now];
            while(by[now]<0)    by[now]+=128;
            while(by[now]>127)  by[now]-=128;
        }
        else if(lo[nn]=='.'){
            while(by[now]<0)    by[now]+=128;
            while(by[now]>127)  by[now]-=128;
            if(by[now]=='\n'){
                ++sg3;
                Goto(5+sg3,9);
                printf("|");
                for(int i=0;i<sg4;i++)  printf(" ");
                printf("|");
                Goto(6+sg3,9);
                printf("+");
                for(int i=0;i<sg4;i++)  printf("-");
                printf("+");
                sg=0;
            }
            else{
                ++sg;
                if(sg>sg4){
                    for(int i=0;i<=sg3;i++){
                        Goto(5+i,9+sg);
                        printf(" |");
                    }
                    Goto(4,9+sg4+1);
                    for(int i=0;i<sg-sg4;i++)   printf("-");
                    printf("+");
                    Goto(6+sg3,9+sg4+1);
                    for(int i=0;i<sg-sg4;i++)   printf("-");
                    printf("+");
                    sg4=sg;
                }
                Goto(5+sg3,9+sg);
                printf("%c",by[now]);
            }
        }
        else if(lo[nn]==','){
            Goto(7+sg3,0);
            t2=clock();
            ti=ti+t2-t1;
            printf("等待读入第%d个值\n",nn);
            for(int i=1;i<nn;i++)   printf("%c",lo[i]);
            colset(12);
            printf("%c",lo[nn]);
            colset(15);
            for(int i=nn+1;i<=q;i++)    printf("%c",lo[i]);
            printf("\n");
            char haha;
            haha=getch();
            by[now]=(int)haha;
            if(by[now]==13){
                Goto(1,10+sg2);
                printf("--+");
                Goto(2,10+sg2);
                printf("\\n|");
                Goto(3,10+sg2);
                printf("--+");
                sg2+=2;
                by[now]=10;
            }
            else{
                Goto(1,10+sg2);
                printf("-+");
                Goto(2,10+sg2);
                printf("%c|",haha);
                Goto(3,10+sg2);
                printf("-+");
                ++sg2;
            }
            Goto(7+sg3,0);
            printf("                                 \n");
            for(int i=1;i<=q;i++)   printf(" ");
            t1=clock();
        }
        else if(lo[nn]=='['){
            int nnn=nn+1,no=1;
            while(no!=0){
                if(lo[nnn]=='[')    ++no;
                if(lo[nnn]==']')    --no;
                ++nnn;
            }
            while(by[now]!=0){
                sou1(nn+1,nnn-2);
                ++cs;
                if(cs>1000000){
                    Goto(7,0);
                    printf("\n运行时错误:好多循环……多于10,00,000次!\n");
                    ++ssc;
                    return;
                }
            }
            nn=nnn-1;
        }
        ++nn;
    }
}
int K=0;
bool com(){
    now=1;
    s=-1;
    nnnn=0;
    aaa=true;
    return co(1,q);
}
void run(){
    memset(by,0,sizeof(by));
    system("cls");
    Goto(0,0);
    mn=1;
    s=-1;
    ssc=0;
    printf("\n+-----+  ++\n");
    printf("|输入 |  ||\n");
    printf("+-----+  ++\n");
    printf("+-----+  ++\n");
    printf("|输出 |  ||\n");
    printf("+-----+  ++");
    sg=0;
    sg2=0;
    sg3=0;
    sg4=0;
    cs=0;
    ti=0;
    t1=clock();
    sou1(1,q);
    t2=clock();
    ti=ti+t2-t1;
    Goto(0,0);
    printf("运行了%d毫秒……",ti);
    Sleep(1000);
    system("pause");//这是我加的唯一一行有意义的代码...
}
void bpt(){
    int qw=1;
    colset(15);system("cls");
    printf("\n---------------------\n");
    int qwe=(q-1)/175+1;
    Goto(3,0);
    for(int i=0;i<qwe;i++){
        for(int j=1;j<=(i==qwe-1?(q-1)%175+1:175);j++){
            if(bp[i*175+j]) colset(10);
            if(i*175+j==1)  colset(12);
            printf("%c",lo[i*175+j]);
            colset(15);
        }
    }
    printf("\n");
    printf("      +----+\n");
    printf("      | 上 |\n");
    printf("      |   W|\n");
    printf("      +----+\n");
    printf("+----++----++-----+\n");
    printf("|左  ||确认||右   |\n");
    printf("|   A||  \\n||    D|\n");
    printf("+----++----++-----+\n");
    printf("+----++----+\n");
    printf("|放弃||下  |\n");
    printf("|   Q||   S|\n");
    printf("+----++----+\n");
    printf("\n---------------------\n");
    while(1){
        if(kbhit()){
            char hhhh=getch();
            if(hhhh=='A'||hhhh=='a'||hhhh=='D'||hhhh=='d'
                ||hhhh=='S'||hhhh=='s'||hhhh=='W'||hhhh=='w'){
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(15);
                if(bp[qw])  colset(10);
                printf("%c",lo[qw]);
            }
            if(hhhh=='A'||hhhh=='a'){
                --qw;
                if(qw<1)    qw+=q;
                while(lo[qw]=='['||lo[qw]==']'){
                    --qw;
                    if(qw<0)    qw+=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            else if(hhhh=='D'||hhhh=='d'){
                ++qw;
                if(qw>q)    qw-=q;
                while(lo[qw]=='['||lo[qw]==']'){
                    ++qw;
                    if(qw>q)    qw-=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            else if(hhhh=='w'||hhhh=='W'){
                qw-=175;
                if(qw<1){
                    while(qw<1) qw+=175;
                }
                while(lo[qw]=='['||lo[qw]==']'){
                    ++qw;
                    if(qw>q)    qw-=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            else if(hhhh=='s'||hhhh=='S'){
                qw+=175;
                if(qw>q){
                    while(qw>q) qw-=175;
                }
                while(lo[qw]=='['||lo[qw]==']'){
                    ++qw;
                    if(qw>q)    qw-=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            else if(hhhh==13){
                bp[qw]=!bp[qw];
                Goto(0,0);
                colset(12);
                if(bp[qw])  printf("现在这里有个断点");
                else    printf("现在这里没有断点");
                printf("按任意键或点击鼠标来继续……");
                while(1){
                    if(kbhit()||KEY_DOWN(MOUSE_MOVED))  return;
                }
                break;
            }
            if(hhhh=='Q'||hhhh=='q')    break;
        }
        if(KEY_DOWN(MOUSE_MOVED)){
            Sleep(100);
            got();
            if((pt.y>0+(4+(q-1)/175)*16&&pt.y<64+(4+(q-1)/175)*16&&pt.x>48&&pt.x<96)
               ||(pt.y>64+(4+(q-1)/175)*16&&pt.y<128+(4+(q-1)/175)*16&&pt.x>0&&pt.x<48)
               ||(pt.y>64+(4+(q-1)/175)*16&&pt.y<128+(4+(q-1)/175)*16&&pt.x>96&&pt.x<136)
               ||(pt.y>128+(4+(q-1)/175)*16&&pt.y<192+(4+(q-1)/175)*16&&pt.x>48&&pt.x<96)){
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(15);
                if(bp[qw])  colset(10);
                printf("%c",lo[qw]);
            }
            if(pt.y>0+(4+(q-1)/175)*16&&pt.y<64+(4+(q-1)/175)*16&&pt.x>48&&pt.x<96){
                qw-=175;
                if(qw<1){
                    while(qw<1) qw+=175;
                }
                while(lo[qw]=='['||lo[qw]==']'){
                    ++qw;
                    if(qw>q)    qw-=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            if(pt.y>64+(4+(q-1)/175)*16&&pt.y<128+(4+(q-1)/175)*16&&pt.x>0&&pt.x<48){
                --qw;
                if(qw<1)    qw+=q;
                while(lo[qw]=='['||lo[qw]==']'){
                    --qw;
                    if(qw<0)    qw+=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            if(pt.y>64+(4+(q-1)/175)*16&&pt.y<128+(4+(q-1)/175)*16&&pt.x>48&&pt.x<96){
                bp[qw]=!bp[qw];
                Goto(0,0);
                colset(12);
                if(bp[qw])  printf("现在这里有个断点");
                else    printf("现在这里没有断点");
                printf("按任意键或点击鼠标来继续");
                if(kbhit()||KEY_DOWN(MOUSE_MOVED))  return;
                break;
            }
            if(pt.y>64+(4+(q-1)/175)*16&&pt.y<128+(4+(q-1)/175)*16&&pt.x>96&&pt.x<136){
                ++qw;
                if(qw>q)    qw-=q;
                while(lo[qw]=='['||lo[qw]==']'){
                    ++qw;
                    if(qw>q)    qw-=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            if(pt.y>128+(4+(q-1)/175)*16&&pt.y<192+(4+(q-1)/175)*16&&pt.x>48&&pt.x<96){
                qw+=175;
                if(qw>q){
                    while(qw>q) qw-=175;
                }
                while(lo[qw]=='['||lo[qw]==']'){
                    ++qw;
                    if(qw>q)    qw-=q;
                }
                Goto((qw-1)/175+3,(qw-1)%175);
                colset(12);
                printf("%c",lo[qw]);
            }
            if(pt.y>128+(4+(q-1)/175)*16&&pt.y<192+(4+(q-1)/175)*16&&pt.x>0&&pt.x<48)   return;
        }
    }
    colset(15);system("cls");
}
bool r;
char haha;
void mdf(){
    colset(15);system("cls");
    colset(15);
    printf("+----+\n");
    printf("|完成|\n");
    printf("|   D|\n");
    printf("+----+\n");
    printf("在这里写代码\n");
    printf("按D/d或者按键来选择\n");
    printf("因为某些原因,我们需要把它压到一行……\n");
    memset(lo,0,sizeof(lo));
    q=0;
    while(1){
        if(kbhit()){
            haha=getch();
            if(haha=='D'||haha=='d')    return;
            if(haha==13)    haha=10;
            if(haha==8){
                if(q!=0)    --q;
                Goto(7+q/175,q%175);
                printf(" ");
            }
            else if(haha==10||haha==32||haha==9){;}
            else{
                lo[++q]=haha;
                Goto(7+(q-1)/175,(q-1)%175);
                printf("%c",haha);
            }
        }
        if(KEY_DOWN(MOUSE_MOVED)){
            got();
            if(pt.y>0&&pt.y<64&&pt.x>0&&pt.x<48)    return;
        }
    }
}
int mnn,zz,zz2,uu;
bool aaaa;
void im(int be,int en){
    int nn=be;
    int su=(q-1)/175+1;
    while(nn<=en&&aaaa){
        got();
        if(KEY_DOWN(MOUSE_MOVED)){
            if(pt.y>32&&pt.y<48){
                colset(15);
                Goto(1,2);
                printf("暂停……");
                while(KEY_DOWN(MOUSE_MOVED)){
                    Sleep(50);
                    got();
                    if(pt.x<0)  pt.x=0;
                    if(pt.x>790)    pt.x=790;
                    Goto(2,uu/5-2);
                    printf("---");
                    Goto(2,99);
                    printf("  ");
                    Goto(2,pt.x/8);
                    printf("■");
                    uu=pt.x/16*10+10;
                    Goto(0,8);
                    printf("%3d",uu);
                }
                Goto(1,2);
                printf("        ");
            }
            if(pt.y>0&&pt.y<64&&pt.x>808&&pt.x<856) return;
        }
        if(kbhit()){
            char haha=getch();
            if(haha==9){
                aaaa=false;
                return;
            }
            if(haha==-32){
                haha=getch();
                colset(15);
                Goto(2,uu/5-2);
                printf("---");
                Goto(2,99);
                printf("  ");
                if(haha==75)    uu=uu-10;
                if(haha==77)    uu=uu+10;
                if(uu<10)   uu=10;
                if(uu>500)  uu=500;
                Goto(2,uu/5-2);
                printf("■");
                Goto(0,8);
                printf("%3d",uu);
                colset(12);
            }
        }
        if(zz!=now){
            colset(11);
            Goto(4*(zz/34)+9+su,5*(zz%34)+1);
            printf("   ");
            zz=now;
            Goto(4*(now/34)+9+su,5*(now%34)+1);
            printf("^^^");
            colset(15);
        }
        Goto((nn-1)/175+6,(nn-1)%175);
        colset(12);
        printf("%c",lo[nn]);
        colset(11);
        if(zz2!=nn){
            Goto((zz2-1)/175+6,(zz2-1)%175);
            colset(11);
            printf("%c",lo[zz2]);
        }
        zz2=nn;
        if(lo[nn]=='<'){
            colset(11);
            Goto(4*(now/34)+9+su,5*(now%34)+1);
            printf("   ");
            --now;
            Goto(4*(now/34)+9+su,5*(now%34)+1);
            printf("^^^");
            zz=now;
            colset(15);
        }
        else if(lo[nn]=='>'){
            colset(11);
            Goto(4*(now/34)+9+su,5*(now%34)+1);
            printf("   ");
            ++now;
            Goto(4*(now/34)+9+su,5*(now%34)+1);
            printf("^^^");
            colset(15);
            if(mnn<now){
                mnn=now;
                colset(15-now%8);
                Goto(4*(now/34)+6+su,5*(now%34));
                printf("+---+");
                Goto(4*(now/34)+7+su,5*(now%34));
                printf("|  0|");
                Goto(4*(now/34)+8+su,5*(now%34));
                printf("+---+");
            }
            zz=now;
        }
        else if(lo[nn]=='+'){
            ++by[now];
            while(by[now]<0)    by[now]+=128;
            while(by[now]>127)  by[now]-=128;
            Goto(4*(now/34)+7+su,5*(now%34)+1);
            colset(15-now%8);
            printf("%3d",by[now]);
        }
        else if(lo[nn]=='-'){
            --by[now];
            while(by[now]<0)    by[now]+=128;
            while(by[now]>127)  by[now]-=128;
            Goto(4*(now/34)+7+su,5*(now%34)+1);
            colset(15-now%8);
            printf("%3d",by[now]);
        }
        else if(lo[nn]=='.'){
            while(by[now]<0)    by[now]+=128;
            while(by[now]>127)  by[now]-=128;
            Goto(5,++s);
            if(by[now]!=10) printf("%c",by[now]);
            else{
                printf("\\n");
                ++s;
            }
        }
        else if(lo[nn]==','){
            Goto(4,0);
            colset(12);
            printf("等待读入");
            char haha;
            while(1){
                got();
                if(KEY_DOWN(MOUSE_MOVED)){
                    if(pt.y>32&&pt.y<48){
                        colset(15);
                        Goto(1,2);
                        printf("暂停");
                        while(KEY_DOWN(MOUSE_MOVED)){
                            Sleep(50);
                            got();
                            if(pt.x<0)  pt.x=0;
                            if(pt.x>790)    pt.x=790;
                            Goto(2,uu/5-2);
                            printf("---");
                            Goto(2,99);
                            printf("  ");
                            Goto(2,pt.x/8);
                            printf("■");
                            uu=pt.x/16*10+10;
                            Goto(0,8);
                            printf("%3d",uu);
                        }
                        Goto(1,2);
                        printf("        ");
                        colset(12);
                    }
                    if(pt.y>0&&pt.y<64&&pt.x>808&&pt.x<856) return;
                }
                if(kbhit()){
                    haha=getch();
                    if(haha==9){
                        aaaa=false;
                        return;
                    }
                    else if(haha==-32){
                        haha=getch();
                        colset(15);
                        Goto(2,uu/5-2);
                        printf("---");
                        Goto(2,99);
                        printf("  ");
                        if(haha==75)    uu=uu-10;
                        if(haha==77)    uu=uu+10;
                        if(uu<10)   uu=10;
                        if(uu>500)  uu=500;
                        Goto(2,uu/5-2);
                        printf("■");
                        Goto(0,8);
                        printf("%3d",uu);
                        colset(12);
                    }
                    else{
                        by[now]=(int)haha;
                        break;
                    }
                }
            }
            if(by[now]==13) by[now]=10;
            Goto(4,0);
            printf("                ");
            Goto(4*(now/34)+7+su,5*(now%34)+1);
            colset(15-now%8);
            printf("%3d",by[now]);
        }
        else if(lo[nn]=='['){
            int nnn=nn+1,no=1;
            while(no!=0){
                if(lo[nnn]=='[')    ++no;
                if(lo[nnn]==']')    --no;
                ++nnn;
            }
            while(by[now]!=0)   im(nn+1,nnn-2);
            nn=nnn-1;
        }
        ++nn;
        Sleep(uu);
    }
}
void imt(){
    memset(by,0,sizeof(by));
    colset(15);system("cls");
    printf("你使用更少的内存,输出,代码和时间时,你将使用它\n");
    printf("你");
    colset(12);
    printf("确定");
    colset(15);
    printf("吗?\n");
    printf("+---++--+\n");
    printf("|是 ||否|\n");
    printf("|  Y|| N|\n");
    printf("+---++--+\n");
    char qwer;
    do{
        if(kbhit()) qwer=getch();
        got();
    }while((qwer!='Y'&&qwer!='y'&&qwer!='N'&&qwer!='n') && !(KEY_DOWN(MOUSE_MOVED)&&pt.y>32&&pt.y<96&&pt.x>0&&pt.x<72));
    if(KEY_DOWN(MOUSE_MOVED)){
        if(pt.x>40&&pt.x<72)  return;
    }
    if(qwer=='N'||qwer=='n')    return;
    uu=100;
    colset(15);system("cls");
    Goto(0,0);
    printf("速度  : 100 ms                                                                                       +----+\n");
    printf("←                                                                                               →  |退出|\n");
    printf("------------------■-------------------------------------------------------------------------------  | Tab|\n");
    printf("                                                                                                     +----+\n");
    mnn=0;
    s=6;
    now=0;
    zz2=1;
    int sua=(q-1)/175+1;
    Goto(6+sua,0);
    colset(15-now%8);
    printf("+---+\n|  0|\n+---+\n ^^^ ");
    zz=1;
    Goto(5,0);
    printf("输出:)");
    Goto(6,0);
    uu=100;
    for(int i=0;i<sua;i++){
        for(int j=0;j<(i==sua-1?(q-1)%175+1:175);j++){
            colset(11);
            printf("%c",lo[i*175+j+1]);
        }
    }
    colset(15);
    aaaa=true;
    im(1,q);
    if(haha==9) return;
    Goto(4,0);
    printf("按任意键继续……");
    getch();
    colset(15);system("cls");
}
void hlp(){
    system("cls");
    printf("Brainf**k(河蟹)是一种极小化的计算机语言,它是由Urban Müller在1993年创建的。\n");
    printf(">指针右移一位指向下一个字节\n<指针左移一位指向上一个字节\n+当前指针指向的字节+1\n-当前指针指向的字节-1\n");
    printf(".以字符的形式输出当前指针指向的字节(ASCII码)\n,以ASCII的形式读入到当前指针指向的字节(ASCII码)\n");
    printf("[开始一个循环\n]如果指针指向0就跳出循环继续执行,否则跳到循环开始\n");
    printf("+-----+\n|关闭 |\n|    C|\n+-----+");
    while(1){
        Sleep(50); got();
        if(kbhit()){
            char haha=getch();
            if(haha=='C'||haha=='c')    return;
        }
        if(KEY_DOWN(MOUSE_MOVED) && pt.y>=144 && pt.y<=208)
            if(pt.x>=4 && pt.x<=56) return;
    }
}
void imf(){
    colset(15);system("cls");
    printf("这是一个Brainf**k(河蟹)编译系统\n");
    printf("开发者信息                   |修改者信息                   |汉化者信息\n");
    printf("名字:\n");
    printf("++++++++[->++++++++<]>+++    |+++++++++[->+++++++++<]>+    |>++++++++++[<++++++++++++>\n");
    printf("++<]>+++.<.<++++++[->++++    |++++++++.++++++++.<++++[-    |-]<.------.+++++++.\n");
    printf("+++[->+++<]>+.<              |>++++<]>+++++.<              |\n");
    printf("昵称:\n");
    printf("++++++++++[->++++++++++<]    |++++++++[->++++++++<]>++.    |>++++++++++[<++++++++++++\n");
    printf(">++++++++++++++++.<+++[->    |<++++++[->++++++<]>++++++    |>-]<.------.+++++++.>+++[\n");
    printf("---<]>--.--.--.<+++[->+++    |+++.++++++++.<++++[->----    |<----->-]<.++++++++.>++++\n");
    printf("<]>++++.<++++++++[->-----    |<]>--.+++++++++.<+++++++[    |++++[<-------->-]<.+..\n");
    printf("---<]>.--..+++++.<           |->-------<]>------------.    |\n");
    printf("                             |+.+.<                        |\n");
    printf("---------------------------------------------------------------------\n");
    printf("+-----+\n");
    printf("|关闭 |\n");
    printf("|    C|\n");
    printf("+-----+\n");
    while(1){
        Sleep(50);got();
        if(kbhit()){
            char haha=getch();
            if(haha=='C'||haha=='c')    break;
        }
        if(KEY_DOWN(MOUSE_MOVED) && pt.y>=224 && pt.y<=288)
            if(pt.x>=4 && pt.x<=56) return;
    }
    getch();
    colset(15);system("cls");
}
int main(){
    colset(15);
    system("mode con cols=175 lines=50");
    Hide();
    r=false;
    xr=false;
    memset(sc,0,sizeof(sc));
    memset(by,0,sizeof(by));
    memset(lo,0,sizeof(lo));
    memset(bp,0,sizeof(bp));
    while(1){
        system("cls");
        colset(15);
        printf("编写By cjt->https://www.luogu.org/blog/tiger2005/bf-bian-yi-qi\n");
        printf("汉化By xry->https://www.luogu.org/blog/xryjr233/bf-bian-yi-qi-han-hua-ban-bian-xie-by-cjt-han-hua-by-xry\n");
        printf("|+-------+  +-----+  +----+|");
        printf("|+----------+  +----+|");
        if(!r)  colset(8);
        printf("|+---+  +----------+  +-----+|\n");
        colset(15);
    	printf("|| 编译  |  |编辑 |  |退出||");
        printf("||   信息   |  |帮助||");
        if(!r)  colset(8);
          printf("|运行|  |   断点   |  |调试 ||\n");
        colset(15);
        printf("||     F9|  |    W|  |   E||");
        printf("||         I|  |   H||");
        if(!r)  colset(8);
        printf("||F10|  |         B|  |   F5||\n");
        colset(15);
        printf("|+-------+  +-----+  +----+|");
        printf("|+----------+  +----+|");
        if(!r)  colset(8);
        printf("|+---+  +----------+  +-----+|\n");
        colset(15);
        printf("+-----------代码-----------+");
        printf("+-------关于---------+");
        if(!r)  colset(8);
        printf("+------------运行------------+\n");
        colset(15);
        while(kbhit())  haha=getch();
        while(1){
            Sleep(50); got();
            if(kbhit()){
                char haha=getch();
                if(haha==0){
                    char haha2=getch();
                    if(haha2==63){
                        if(r){
                            imt();
                            break;
                        }
                        else{
                            Goto(5,0);
                            colset(12);
                            printf("警告:先编译");
                            colset(15);
                        }
                    }
                    if(haha2==67){
                        system("cls");
                        lk=1;
                        printf("-----------------------------------\n");
                        r=com();
                        if(r){
                            printf("编译成功!");
                            printf("-----------------------------------\n");
                            lk+=2;
                        }
                        printf("+-----+\n");
                        printf("|关闭 |\n");
                        printf("|    C|\n");
                        printf("+-----+\n");
                        if(lk>45)   lk=45;
                        while(1){
                            Sleep(50);got();
                            if(kbhit()){
                                char haha=getch();
                                if(haha=='C'||haha=='c')    break;
                            }
                            if(KEY_DOWN(MOUSE_MOVED)){
                                if(pt.y>lk*16&&pt.y<lk*16+64&&pt.x>0&&pt.x<112) break;
                            }
                        }
                        break;
                    }
                    if(haha2==68){
                        if(r){
                            run();
                            break;
                        }
                        else{
                            Goto(5,0);
                            colset(12);
                            printf("警告:先编译");
                            colset(15);
                        }
                    }
                }
                if(haha=='W'||haha=='w'){
                    mdf();
                    r=false;
                    memset(bp,0,sizeof(bp));
                    break;
                }
                if(haha=='E'||haha=='e')    return 0;
                if(haha=='I'||haha=='i'){
                    imf();
                    break;
                }
                if(haha=='H'||haha=='h'){
                    hlp();
                    break;
                }
                if(haha=='B'||haha=='b'){
                    if(r){
                        bpt();
                        break;
                    }
                    else{
                        Goto(5,0);
                        colset(12);
                        printf("警告:先编译");
                        colset(15);
                    }
                }
            }
            if(KEY_DOWN(MOUSE_MOVED)&&pan(pt.y,pt.x)){
                if(pan(pt.y,pt.x)==1){
                    system("cls");
                    lk=1;
                    printf("-----------------------------------\n");
                    r=com();
                    if(r){
                        printf("编译成功!\n");
                        printf("-----------------------------------\n");
                        lk+=2;
                    }
					printf("+-----+\n");
                    printf("|关闭 |\n");
                    printf("|    C|\n");
                    printf("+-----+\n");
                    if(lk>45)   lk=45;
                    while(1){
                        Sleep(50);got();
                        if(kbhit()){
                            char haha=getch();
                            if(haha=='C'||haha=='c')    break;
                        }
                        if(KEY_DOWN(MOUSE_MOVED)){
                            if(pt.y>lk*16&&pt.y<lk*16+64&&pt.x>0&&pt.x<56) break;
                        }
                    }
                    break;
                }
                if(pan(pt.y,pt.x)==2){
                    mdf();
                    r=false;
                    break;
                }
                if(pan(pt.y,pt.x)==3)   return 0;
                if(pan(pt.y,pt.x)==4){
                    imf();
                    break;
                }
                if(pan(pt.y,pt.x)==5){
                    hlp();
                    break;
                }
                if(pan(pt.y,pt.x)==6){
                    if(!r){
                        Goto(5,0);
                        colset(12);
                        printf("警告:先编译");
                        colset(15);
                    }
                    else{
                        run();
                        break;
                    }

                }
                if(pan(pt.y,pt.x)==7){
                    if(!r){
                        Goto(5,0);
                        colset(12);
                        printf("警告:先编译");
                        colset(15);
                    }
                    else{
                        bpt();
                        break;
                    }
                }
                if(pan(pt.y,pt.x)==8){
                    if(!r){
                        Goto(5,0);
                        colset(12);
                        printf("警告:先编译");
                        colset(15);
                    }
                    else{
                        imt();
                        break;
                    }
                }
            }
        }
    }
}

代码转换器的源代码(c++):

C++
#include<bits/stdc++.h>
using namespace std;
int n;
char s[300010],nw;
void pt(int x,char c){
	if(x<10){//小于10个字符直接输出
		for(int i=1;i<=x;i++){
			putchar(c);
		}
		return;
	}
	int tot1=sqrt(x);//分为两份输出
	int tot2=tot1;
	for(;tot1*tot2<=x;tot2++);
	tot2--;
	x-=tot1*tot2;
	putchar('>');
	for(int i=1;i<=tot1;i++){
		putchar('+');
	}
	printf("[<");
	for(int i=1;i<=tot2;i++){
		putchar(c);
	}
	printf(">-]<");
	for(int i=1;i<=x;i++){//输出多余部分
		putchar(c);
	}
}
void print(char c){
	if(c>nw){
		pt(c-nw,'+');
		nw=c;
	}else{
		pt(nw-c,'-');
		nw=c;
	}
	cout<<".";
}
int main(){
	printf("输入一些字符(不包括换行),我将把它转化为brainf**k(河蟹)源代码,保存在brainfuck_code.txt中。\n");
	freopen("brainfuck_code.txt","w",stdout);
	gets(s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++){
		print(s[i]);
	}
    return 0;
}