Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Inline::Brainfuck

by moxliukas (Curate)
on Aug 29, 2002 at 13:33 UTC ( #193763=note: print w/ replies, xml ) Need Help??


in reply to Inline::Brainfck

Nice work.

I have been toying with Brainf*ck too and here are my comments about this particular interpretation:

  • I really don't like the '#' operator. It is against the Brainf*ck nature. Brainf*ck is supposed to be difficult to write and making the coding tools like '#' available is going to make Brainf*ck way too easy to program. Imagine all these 13-year-olds coding Brainf*ck straight after they have grasped Basic... definately something we do not want. Brainf*ck has been a language for those elite few who have enough stupidity and stubborness to spend about an hour to write a simple Hello, World!. Brainf*ck has been the language of die-hard brainfuckers like me since 1993 and the whole purpose of the language is that it should be difficult to write in. Dumping the memory array is for wimps. Next you will want a simple way to reset the whole memory array...oh wait... you HAVE done this with '~' operator... Where is the world coming to?
  • The '~' operator also is useless and just adds syntactic sugar and makes the language more complicated than it should be. I mean you can easily erase the contents of the memory cell by a simple [-] so there is no need to reinvent the wheel especially when tools in the Brainf*ck language are available itself and there is no need to add these new features. Again, it makes programming Brainf*ck way too easy...
  • No support for nested loops. This is a big one. As far as I can see there is no support for nested loops in your implementation (or am I wrong?). Nesting loops within loops and trying to remember where the loop counters are and *NOT* being able to print the memory array is the sort of thing that makes Brainf*ck the language fun for real programmers.

OK, enough ranting. Good job! ;)


Comment on Re: Inline::Brainfuck
Download Code
Re: Re: Inline::Brainfuck
by jaldhar (Vicar) on Aug 29, 2002 at 14:59 UTC

    • I really don't like the '#' operator. It is against the Brainf*ck nature. Brainf*ck is supposed to be difficult to write and making the coding tools like '#' available is going to make Brainf*ck way too easy to program. Imagine all these 13-year-olds coding Brainf*ck straight after they have grasped Basic... definately something we do not want. Brainf*ck has been a language for those elite few who have enough stupidity and stubborness to spend about an hour to write a simple Hello, World!. Brainf*ck has been the language of die-hard brainfuckers like me since 1993 and the whole purpose of the language is that it should be difficult to write in. Dumping the memory array is for wimps. Next you will want a simple way to reset the whole memory array...oh wait... you HAVE done this with '~' operator... Where is the world coming to?
    • The '~' operator also is useless and just adds syntactic sugar and makes the language more complicated than it should be. I mean you can easily erase the contents of the memory cell by a simple - so there is no need to reinvent the wheel especially when tools in the Brainf*ck language are available itself and there is no need to add these new features. Again, it makes programming Brainf*ck way too easy...

    • I hear what you're saying. That's why I made the extra instructions entirely optional and only switched on by a special pragma. # I've seen in other implementations. At least one web page says it is a "common" extension. As I wanted to try out implementing pragmas, it seemed like a good one. ~ I agree is just sugar. It was implemented for the same reasons as above. But like I said, its' all optional. Btw I'm also thinking about adding ` as an optional comment character (i.e ignore everything from there up to the end of the line.) How's that for blasphemy? :-)


      No support for nested loops. This is a big one. As far as I can see there is no support for nested loops in your implementation (or am I wrong?).


      Tell me more. How would you want that to work? Some sort of stack? Labels?

      --
      જલધર

      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 ;)

        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.

        --
        જલધર

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://193763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-12-27 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls