VBA, 512 489 479 byte
Sub f(A,B):Debug.?">>>>>->>>>->--<<<"&Replace(Replace(Replace(A,"<","<<<[+]-<<"),">",">>>>>>>[+]-<<"),".",">>-<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>>+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]-<<")&">>[>>>>>]<<<<<[+<<[-]<<<]>++[-->>>>>++]+[-<<<<<+]->>"&Replace(Replace(Replace(B,"<","<<<<<"),">",">>>>>"),",","[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<"):End Sub
Penjelasan
Kode VBA mengubah kode brainfuck dengan cara, sehingga output snippet A akan disimpan dalam daftar dan input snippet B akan dibaca dari daftar itu.
Pertama menginisialisasi beberapa variabel
>>>>>->>>>->--<<<
Kemudian ia membaca snippet A dan menggantikan setiap <
oleh <<<[+]-<<
, setiap >
oleh >>>>>>>[+]-<<
dan setiap .
oleh rutinitas penyimpanan
>>>>>>>[+]-<<"),".",">>->+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]--<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>+<<
setelah itu menghapus memori snippet A dan membuat perubahan pada daftar tersimpan, sehingga dapat dibaca sebagai input untuk snippet B:
>>[>>>>>]<<<<<[+<<[-]<<<]>++[-->>>>>++]+[-<<<<<+]->>>>>-<<<
Kemudian potongan B akan dibaca, setiap <
akan digantikan oleh <<<<<
, setiap >
akan digantikan oleh >>>>>
dan setiap ,
akan digantikan oleh rutin membaca daftar:
[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<
Brainfuck kode sumber
Ini adalah sumber saya untuk bagian-bagian dari kode. Saya akan menjelaskannya secara rinci nanti.
[
Tape: tempMem data out/in dataAnchors outAnchors (all repeating)
dataAnchors of Snippet A: -1 = memory has been used, -2 = active memory cell for copying to out/in
dataAnchors of Snippet B: -1 = active memory cell for copying from out/in
outAnchors of Snippet A: -1 = start of list, -2 = next output position
outAnchors of Snippet B: -1 = character has been read (or start of input)
]
### Init
>> two blank data cells (for non wrapping pointer)
>>>- set start of input
>> >>- set first "used" flag
>-- set end of input
<<< return to first usable data cell
### A move right routine
>>>>> move to the next data cell
>>[+]- clear and set "used" flag
<< return to data cell
### A move left routine
<<<[+]- clear and set "used" flag of previous data cell
<< go to data cell
### A print routine
>>- set flag
<<[ while value greater 0
- decrement value
<+ increment tempMem
>>>>+[-<<<<<+] find start of input
+[-->>>>>++]-- find end of input
<<+ increment input
>>+[-<<<<<+]- find start of input
<++[-->>>>>++]--find flag
<< go to active data cell
]
<[->+<] move stored value back to data
>>>>+[-<<<<<+] find start of input
+[-->>>>>++] find end of input
>>>>>- set new end of input
[-<<<<<+]- return to start of input
<++[-->>>>>++]- return to and delete data flag
<< go to data cell
### After snippet A: Delete memory of A and configure out/in list
>>[>>>>>]<<<<< go to last used data
[+<<[-]<<<] delete each data
>++[-->>>>>++] find and delete end of input flag
+[-<<<<<+]- go to start of input
>> go to first data cell
### B move right routine
>>>>> go to next data cell
### B move left routine
<<<<< go to previous data cell
### B reading routine
[-] set cell = 0
>>- set flag
>[>>>>>]+[-<<<<<+]- find start of input
>>>[ if value greater 0
- decrement value
<<<[<<<<<]>>>> go to initial start of input (combined with next)
+[->>>>>+]- find mem cell flag
<<+ increment mem cell
>>>[>>>>>]+[-<<<<<+]->>> return to input cell
]
>>- set new start of input
[<<<<<]>>>> go to initial start of input (combined with next)
+[->>>>>+] find and delete mem cell flag
<< go to mem cell
Output untuk test case 1: f ",[..,]",",[...,]"
>>>>>->>>>->--<<<,[>>->+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]--<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>+<<>>->+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]--<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>+<<,]>>[>>>>>]<<<<<[+<<[-]<<<]>++[-->>>>>++]+[-<<<<<+]->>>>>-<<<[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<[...[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<]
Cobalah online!
Output untuk test case 2: f ">,[>,]<[.<]",",[...,]"
>>>>>->>>>->--<<<>>>>>>>[+]-<<,[>>>>>>>[+]-<<,]<<<[+]-<<[>>->+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]--<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>+<<<<<[+]-<<]>>[>>>>>]<<<<<[+<<[-]<<<]>++[-->>>>>++]+[-<<<<<+]->>>>>-<<<[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<[...[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<]
Cobalah online!
Output untuk test case 3: f ",.",",."
>>>>>->>>>->--<<<,>>->+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]--<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>+<<>>[>>>>>]<<<<<[+<<[-]<<<]>++[-->>>>>++]+[-<<<<<+]->>>>>-<<<[-]>>->[>>>>>]+[-<<<<<+]->>>[-<<<[<<<<<]>>>>+[->>>>>+]-<<+>>>[>>>>>]+[-<<<<<+]->>>]>>-[<<<<<]>>>>+[->>>>>+]<<.
Cobalah online!
Kaset uji kompleks:
Cuplikan A: Bangun segitiga alfabet >+++++[<+++++>-]<+[>>[>[.>]]>++++++++++.--[<++++++++>-]<[+.<]<-]>>,>[.>]++++++++++.[<[.<]>,>[.>]<]
Cobalah online!
Cuplikan B: Urutkan input dalam urutan naik >>,[>>,]<<[[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]
Coba online!
Hasil:
>>>>>->>>>->--<<<>>>>>>>[+]-<<+++++[<<<[+]-<<+++++>>>>>>>[+]-<<-]<<<[+]-<<+[>>>>>>>[+]-<<>>>>>>>[+]-<<[>>>>>>>[+]-<<[>>-<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>>+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]-<<>>>>>>>[+]-<<]]>>>>>>>[+]-<<++++++++++>>-<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<++[-->>>>>++]--<<]<[->+<]>>>>+[-<<<<<+]+[-->>>>>++]>>>>>-[-<<<<<+]-<++[-->>>>>++]-<<--[<<<[+]-<<++++++++>>>>>>>[+]-<<-]<<<[+]-<<[+>>-<<[-<+>>>>+[-<<<<<+]+[-->>>>>++]--<<+>>+[-<<<<<+]-<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+<<<<<]>>>>>[>>>>>[>>>>>>>>>>]<<<<<[.[-]<<<<<[[>>>>>>>>>>+<<<<<<<<<<-]<<<<<]>>>>>>>>>>]>>>>>]<<<<<<<<<<]
Cobalah online!
Shortest code in each language win
danShortest Brainfuck solution will be accepted
dua kriteria kemenangan yang berbeda.