我在实现一个brainfuck汇编器时遇到了困难。我设法将字符串加载到内存中,找到它的长度,输出它,并以n次重复打印字符串等,但我似乎无法仅将小写数字加载到内存中。因此,让我们来看一下执行某些巫术的以下循环。(井号是调试标记。)
#,#[>#<[<]<<#+#>>>[>]#,#]<[<]
从指针512开始,将字符串作为ASCII值写入512之后的位置。
现在,如果(出于任何原因)我希望剥离小写字符,则在伪BF中将如下所示。
#,#[>#<[<]<<#+#>>>[>]#do{,(takes input and assigns it)}
while(input>=96/*Go arbitrarily to the right for this implementation but
make sure that the first non-lowercase number is stored at the index*/)#
//Also be sure to zero out any temporary cells used
<[<]
现在我的问题是,如何在仅使用512右侧的空间作为存储并稍后清除它们的情况下实现这样的while循环。对于那些好奇的人,这是我想在brainfuck中解决的问题。