# TinyBF to Brainf*** converter

We have a Brainf*** to TinyBF converter, but not the other way around, so here's one.

## Rules:

• Your interpreter must take a valid TinyBF program, on one line, and it must output the corresponding BrainF*** program, on one line, with optional trailing whitespace/newline. No leading whitespace is allowed
• The input may or may not contain characters that are not any of the four TinyBF characters. If so, you must print all of these characters in the same spots.
• An answer will be accepted on April 1st (not joking), based on some obscure criteria I will use (jk ;) I will accept the shortest program that does not cheat by the following rules)
• No 0-byte or 1-byte solutions, because it ruins the fun if you make (or there is) a programming language just for this purpose)

## Test Cases

Input 1: +++++>+++++=>=|>>+=>>+|=>|>+=>+| (Computes 5 (byte 1) + 5 (byte 2) = 10 (byte 3))
Output 1: +++++>+++++<[>>+<<-]>[>+<-]

Input 2: +++>++++Hi+++:P+=>=|>|>+>+=>>&&+|=>>|=>>=+!!>>=+|>>>+| (Computes 3 (byte 1) * 8 (byte 2) = 24 (byte 3)) Output 2: +++>++++Hi+++:P+<[>[>+>+<<&&-]>>[<<+!!>>-]<<<-]

• Will there ever be I/O commands? – lirtosiast Feb 15 '16 at 22:05
• No, because TinyBF doesn't have IO commands. – HyperNeutrino Feb 16 '16 at 2:27
• That's incorrect; == is brainfuck's .. – Dennis Feb 13 '18 at 23:16

## Python 2, 106 bytes

a=0
r=''
for c in input():a=[a,~a][c=='='];r+={'+':'+-','>':'><','|':'[]'}.get(c,c)[a%-2]*(c!='=')
print r


Implements the TinyBF specification as found here. Try it online. Improvements were made using techniques from @Dica's answer. Requires quoted string input.

• This works for all of my test cases! Good job. – HyperNeutrino Feb 16 '16 at 14:43
• You can save 5 bytes with r+=b.get(c,c+c)[a]*(c!='='). You can also make the for loop one line to save 3 more. You can inline the dict to save 4 more. Inlining input() is another 4. – Morgan Thrapp Feb 16 '16 at 14:44
• Also, you need to either use raw_input or switch to Python 3 and take the byte penalty for print. Right now I get SyntaxError: invalid syntax. – Morgan Thrapp Feb 16 '16 at 14:50
• @Mergo I based my answer on yours but I guess it's okay because the modifications are heavy, let me know if you want me to remove it – Dica Feb 16 '16 at 17:14
• @MorganThrapp The input is quoted, so it works for 2. Taking quoted string input is allowed per a meta post that I can't find right now because I'm on mobile. – Mego Feb 16 '16 at 17:36

# Python 3, 97 bytes

This script is based on @Mego's answer

a=0
for c in input():a-=c=='=';print({'+':'+-','>':'><','|':'[]'}.get(c,c)[a%-2]*(c!='='),end='')

• I think this is too similar to Mego's answer and should have been suggested as an optimization in a comment. – mbomb007 Feb 26 '16 at 3:31
• Although this is shorter, I accepted Mego's answer because your answer is too similar to Mego's an seems like an optimization rather than a distinct answer. – HyperNeutrino Jan 19 '17 at 21:05