Text to Brainfuck translator
If you pass a long text to the code generator, the resulting program will overflow its memory. This is because you do &gt;+++.&gt; for each character, but you never come back to clean up behind you. Instead of &gt;+++.&gt;, the generated code should be &gt;+++.[-]&lt;, which is slower but can handle arbitrary long text.

You say that your text contains mostly ASCII characters. Therefore it is probably more efficient to add or subtract the difference of the characters. In pseudo code:



curr = 0
for ch in str:
    if ch &gt; curr:
        emit_add(ch - curr)
    if ch &lt; curr:
        emit_sub(curr - ch)
    emit_putchar()
    curr = ch
emit_setzero()


Emitting only the difference is especially efficient for long runs of lowercase ASCII letters.

Regarding your Python code: are you sure that Python really does not have a repeat string function? The letter_to_brainfuck function would become a one-liner then.