http://www.perlmonks.org?node_id=193942


in reply to Re: Re: Inline::Brainfuck
in thread Inline::Brainfck

Nested Brainf*ck loops can be used like this:

+++[>++++[>+++++<-]<-]>>++++++.++++.

Which in this case is only a fancy way of writting

++++++[>+++++++++++<-]>.++++.

Both of these should print "BF".

On a closer look at your code I think nested loops are indeed supported however I am having trouble with installing Filter::Simple so I cannot check.

Regarding comments and ` operator: to my understanding anything that is not a Brainf*ck operator (that is not in the []-+,.<> set) is automatically treated as a comment and is silently ignored (this lets you have Brainf*ck code span a couple lines rather than being on one long line). Of course the philosophy should say that Brainf*ck code should not be commented at all because if it was difficult to write it must be difficult to read ;)

Replies are listed 'Best First'.
Re: Re: Re: Re: Inline::Brainfuck
by jaldhar (Vicar) on Sep 02, 2002 at 04:20 UTC

    On a closer look at your code I think nested loops are indeed supported however I am having trouble with installing Filter::Simple so I cannot check.

    Oh sure, that kind of thing works. Somehow I thought you meant something more complicated.

    Regarding comments and ` operator: to my understanding anything that is not a Brainf*ck operator (that is not in the []-+,.<> set) is automatically treated as a comment and is silently ignored (this lets you have Brainf*ck code span a couple lines rather than being on one long line).

    That's true. What led me down this path was the difficulty of adding perl comments after I had commandeered the # character for my debug instruction. But now I see it is easy to work around so I'm not going to bother.

    --
    જલધર