This is inspired by the Brainf*** to tinyBF converter challenge.
Brainf**k (which will be henceforth referred to as BF) is a well-known estoric programming language, so I won't go over it too much here.
Nameless language is a binary-looking version of BF. See the linked page for more info.
Your challenge is to implement a golfed Nameless-to-BF converter. It should implement all of the commands except for 1100 (which isn't really possible to implement in BF) and 1010 (that isn't really possible, either). Any characters other than 1's and 0's should be ignored because they can be used for comments (after all, you wouldn't want an unreadable program, right? ;).
Here's a simple table of a Nameless -> BF mapping:
0000 -> > 0001 -> < 0010 -> + 0011 -> - 0100 -> . 0101 -> , 0110 -> [ 0111 -> ] 1011 -> [-] 1000 -> adds the base 10 value of the next command to the current memory cell (see below) 1001 -> subtracts the base 10 value of the next command from the current memory cell (see below)
NOTE: I accidentally flipped
>. Thanks to @IlmariKaronen for pointing that out.
For 1000 and 1001, you can directly implement it in the translator. For instance, this:
could be written as:
The translator determined the value of the next command in advance and wrote it out.
Invalid sequences (e.g. 1111) and the presence of 1000/1001 at the end of the program are undefined; you don't have to handle them.
MAY THE GOLFING BEGIN!!!