Thread: Brainfunked, for some reason...

  1. #1
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,728

    Brainfunked, for some reason...

    Hey guys, shameless plug here:

    I recently responded to a post on writing a program to count to ten, and I implemented it in brain****, here it is.

    The weird thing is, after that I had an unavoidable itch to know more about it and... I ended up coding my own interpreter and compiler
    WHY?! I can almost hear you asking. idk

    For anyone interested, here's the page on github.

    EDIT: Oh shoot, did I post this in the wrong sub-forum? Feel free to change it if I did, this may have to go to "Projects and Job Requirement".
    Last edited by GReaper; 01-30-2017 at 05:38 AM.
    Devoted my life to programming...

  2. #2
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    I had no idea someone would love brain**** so much :P

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,728
    So many extensions/variants to implement, so little time!

    It's been a week since I started it, and I'm already seeing a sort-of "power-creep". It's starting to become a large project, far larger than I thought it'd be!
    Devoted my life to programming...

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    You could use BF as the intermediate representation for a whole compiler platform, a la LLVM. Or develop a series of processors that execute BF directly. Instead of RISC or CISC, it would me MISC - Minimalist Instruction Set Computing.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #5
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,728
    Ok, I know you're joking, but I need to point out to myself that that'd be considered "going too freakin' far!".

    OMG, I'm neck-deep into this, there's no turning back now!
    Devoted my life to programming...

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Imagine a BF-based CPU with a thousand cores, running at 4GHz.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  7. #7
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    Quote Originally Posted by GReaper View Post
    Hey guys, shameless plug here:

    I recently responded to a post on writing a program to count to ten, and I implemented it in brain****, here it is
    On that thread, you were too late to the BF party Can you count to ten?
    Congrats on your interpreter.

  8. #8
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,728
    Quote Originally Posted by Elkvis View Post
    Imagine a BF-based CPU with a thousand cores, running at 4GHz.
    Each core would run its own BF code and either have its own tape or all of them would share a single tape... Oh, the possibilities!

    Quote Originally Posted by stevesmithx View Post
    On that thread, you were too late to the BF party https://cboard.cprogramming.com/gene...ml#post1260432
    Congrats on your interpreter.
    Oh, I didn't see that! I just did a thread-wide search for "brain" and it didn't come up, so I thought I was the first.
    Thanks! ( compiler too )
    Devoted my life to programming...

  9. #9
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Location
    CA, USA
    Posts
    466
    Brain........ is so gross. Why not program in the lambda calculus instead? It's much more readable.

  10. #10
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Location
    CA, USA
    Posts
    466
    Plus, you can even implement Peano numerics... so efficient! lol

    Oh, and its super-parallizable (is that a word?)

    EDIT: No, that's not a word. But scalable is!
    Last edited by MacNilly; 02-13-2017 at 08:07 AM.

  11. #11
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,728
    Lambda calculus?... I'm afraid to even look that up!
    Devoted my life to programming...

  12. #12
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Location
    CA, USA
    Posts
    466
    Quote Originally Posted by GReaper View Post
    Lambda calculus?... I'm afraid to even look that up!
    LOL. It's not so bad. Better than Brain........!

    I was joking about it being more readable... they are both equally unreadable!

    From my understanding, Brain........ is a straighforward implementation of a Turing machine. Some computer science guys (starting with Haskell, I believe) developed an alternate semantics of general computing, which is entirely based on functions, that was proved to be equivalent to Turing machine. Thus, the lambda calculus is equivalent to Brain......... Actually, ALL programming languages (at least the "Turing complete" ones) are equivalent to Brain......... However, the main difference is that the lambda calculus has no concept of "state", whereas the Turing machine is entirely based on state.
    Last edited by MacNilly; 02-13-2017 at 03:29 PM. Reason: More info

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reason for output in C
    By deepak1906 in forum C Programming
    Replies: 13
    Last Post: 10-07-2010, 05:45 AM
  2. Returning 3 for no reason
    By bijan311 in forum C++ Programming
    Replies: 9
    Last Post: 05-12-2010, 05:30 PM
  3. Is there any reason?
    By Blanket in forum C++ Programming
    Replies: 12
    Last Post: 03-18-2003, 06:05 PM
  4. This never stops for some reason
    By Shadow12345 in forum C++ Programming
    Replies: 14
    Last Post: 09-02-2002, 10:41 AM
  5. How can you reason with this madman?
    By EvenFlow in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 10-11-2001, 06:51 PM

Tags for this Thread