Transpile ;# into your language Related to: Make a ;# interpreter and Generate ;# code

;# - A Whirlwind Guide

This is a simple language with two commands.  Its only data structure is an accumulator, which is initialized to 0.


; Increment the accumulator
# Calculate the value of the accumulator modulo 127, and print the corresponding ASCII character.  Then, reset the accumulator to 0.


The source code may contain additional characters (printable ASCII + whitespace), but these are treated as comments and have no effect on program execution.

Challenge

Since most computers do not come with ;# preinstalled, it would be very useful to have a tool that can convert ;# code into a different language.  In this challenge, you shall write a program to accomplish this.

Input

Some ;# source code, taken via argument or STDIN.  This source code may contain (comment) characters other than ; or #.

Output

Code, in the same language as your submission, which, when executed, prints/returns the same string as the original ;# code.  This resultant code may output a trailing newline after the target string, if that is more convenient for your language.

Notes

One thing to look out for is escape sequences, such as code that prints backslashes or prints quote marks.  Also look out for ;# code that could contain things that look like keywords or commands in your language.

Additional restrictions

All programs must terminate (I normally consider this a default, but someone asked about it so I'm stating it here).

Examples

input: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#
output (python): print(";#")
input: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#
output (element): \'`
brainfuck, 126 bytes

+++[-&gt;+++++&lt;]&gt;[-&gt;++++&gt;+++&lt;&lt;],[+&lt;++++++[-&lt;++++&gt;&gt;------&lt;]&gt;[&lt;]&lt;&lt;[&gt;&gt;&gt;&gt;&gt;[--&lt;--.++&gt;]&lt;+.-&lt;.&lt;&lt;&lt;&lt;]&gt;[-&gt;&gt;-&lt;&lt;]&gt;&gt;[[-]&lt;]&gt;[&gt;&gt;++++[--&gt;]&lt;[&lt;]],]


Try it online!

The output program will fail in the TIO implementation if the ;# output exceeds 65536 characters.  I also made a 130-byte version which outputs [+] instead of &lt;, avoiding this problem:

++[------&gt;++&gt;+&lt;&lt;]&gt;+++++&lt;,[+&lt;++++++[-&lt;++++&gt;&gt;------&lt;]&gt;[&lt;]&lt;&lt;[&gt;&gt;&gt;&gt;&gt;[--&lt;.&gt;]&lt;+++.---&lt;.&gt;.&lt;++.--&lt;&lt;&lt;&lt;]&gt;[-&gt;&gt;-&lt;&lt;]&gt;&gt;[[-]&lt;]&gt;[&gt;&gt;++++[--&gt;]&lt;[&lt;]],]


Explanation

+++[-&gt;+++++&lt;]&gt;[-&gt;++++&gt;+++&lt;&lt;]        initialize tape with 60 and 45
,[                                  for each input byte:
  +&lt;++++++[-&lt;++++&gt;&gt;------&lt;]         subtract 35 (#) from byte
  &gt;[&lt;]&lt;&lt;[                           if byte was #
         &gt;&gt;&gt;&gt;&gt;[--&lt;--.++&gt;]           output + (43) a number of times equal to accumulator
         &lt;+.-&lt;.&lt;&lt;&lt;&lt;                 output . (46) and &lt; (60)
  ]
  &gt;[-&gt;&gt;-&lt;&lt;]&gt;&gt;                       subtract 24 from what's left of byte
  [[-]&lt;]                            check difference and clear if nonzero
  &gt;[                                if byte was originally 59 (;)
   &gt;&gt;++++[--&gt;]&lt;[&lt;]                  add 4 to accumulator cell, then subtract 2 if nonzero. Since BF cells are mod 256, this creates an accumulator mod 127.
  ]
,]