You don't need to know these languages to participate. All necessary information has been provided in this question.
You should write a program or function which given a brainfuck (BF) code as input outputs its tinyBF equivalent.
BF has 8 instructions characters: +-><[],. and tinyBF has 4: =+>|. Converting works the following way: starting from the beginning of the BF code each symbol is replaced by on of its two tinyBF counterparts based on the number of = signs in the tinyBF code until that point (i.e. = behaves like a toggle switch).
The converter table (with columns: Brainfuck symbol; tinyBF symbol(s) when ther are even ='s before; tinyBF symbol(s) when ther are odd ='s before):
BF even odd + + =+ - =+ + > > => < => > [ | =| ] =| | . == == , |=| =|=| (This creates an almost unique tinyBF code. The only conflict occurs if the BF code contains a [] which is generally unused as it creates an infinite void loop.)
Input
- An at least 1 byte long valid brainfuck program containing only the characters
+-><[],. - Guaranteed not to contain the string
[] - Trailing newline is optional.
Output
- A tinyBF program.
- Trailing newline is optional.
Examples
You can convert any BF program to tinyBF with this (1440 byte long) converter (see the Edit section for a small deviation).
Format is Input into Output ++- into ++=+ ,[.,] into |=||==|=|=| or |=|=|==|=|| (both is acceptable check the Edit section) >++.--.[<]+-, into >++===++===|=>|=+=+=|=| >++-+++++++[<+++++++++>-]<. into >++=+=+++++++|=>=+++++++++>=+|>== Edit
As @Jakube pointed out in the official tinyBF converter in the equivalents of the , BF instruction (|=| and =|=|) the last = signs aren't counted towards the toggle state. Both the official and mine interpretations are acceptable but you have to choose one.
This is code-golf so the shortest entry wins.
=characters output before the character currently being translated. Think of the=character as a toggle between two instruction sets. \$\endgroup\$=|=|that don't change the even/odd value? Or is that part of the challenge? \$\endgroup\$