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): \'`
;#
preinstalled... \$\endgroup\$#
character in it? \$\endgroup\$;
or#
? \$\endgroup\$