alexander Posted April 21, 2009 Report Posted April 21, 2009 Don't even think of editing that title, it is a name of a programming language i have learned about just recently, and it's soo appropriately named too. Basic idea is this, in this language you work with data pointers, in a sort of, array if you will, there is an array of at least 30,000 bytes initialized at start, and the language has 2 streams of bytes that are connected to the keyboard and monitor, you work with ascii, and you can only do 8 things in this language:> - increments data pointer< - decrement data pointer+ - increment byte- - decrement byte. - output value of the current location, - accept one byte of input and write it to the current location[ - if the data at the current pointer is zero instead of executing the next command, it jumps to the ]] - if the data at the curent pointer is not zero, this will return one back to the [{last two are used for looping} so here's an example of code: ++++++++++ [ >+++++>++++++++++>+++++++++++>+++>+<<<<<- ] >++++++++++++++++. >>++++. <---. ++++++++. >----. <---. >+++++++. <---. >----------. >++. <<+++. >++++++++++. <---. >----------. ++++++++. >. <++++. <++++++. >---. <-. >>. <+++++. ----------. ++++++. ---. >. <<------. >. <-. ++++++++. >----. >. <<<--------. >>>+++++++++. >. now you figure out what it does :QuestionM well i formatted it for you, it could have easily looked like this, too ++++++++++[>+++++>++++++++++>+++++++++++>+++>+<<<<<-]>++++++++++++++++.>>++++.<---.++++++++.>----.<---.>+++++++.<---.>----------.>++.<<+++.>++++++++++.<---.>----------.++++++++.>.<++++.<++++++.>---.<-.>>.<+++++.----------.++++++.---.>.<<------.>.<-.++++++++.>----.>.<<<--------.>>>+++++++++.>. Quote
sanctus Posted April 21, 2009 Report Posted April 21, 2009 Name of thread is fine with, it kind of hits the nail on the head (not sure if this is an english saying or from another language I know...) With help I figured out that it prints, actually deducted highlight post to see it, since the first print gives anB and the secon an r...:Brain**** Quote
Boof-head Posted April 21, 2009 Report Posted April 21, 2009 It's a Turing machine with 8 instructions. You're supposed to build 'circuits' with it. It isn't what you would call a high-level language, I would say. But you might use it to compile one. Quote
alexander Posted April 21, 2009 Author Report Posted April 21, 2009 Sanctus, it does print ;) that's what the dots indicate... you figure out what (even if you post ascii values it's major kudos for you :hihi: its a fun language though) Quote
sanctus Posted April 21, 2009 Report Posted April 21, 2009 No my english was not clear, just higlight my post and told also what it prints, I did not want to spoil it for the others so I wrote in white color what it does... Quote
alexander Posted April 21, 2009 Author Report Posted April 21, 2009 it prints a little more than that, sanctus ;) it outputs 35 characters :hihi: Quote
alexander Posted April 21, 2009 Author Report Posted April 21, 2009 here, actually for others that get anxious, here's a brain**** interpreter /* Eric */main(s,i,j,k,c){char*p=malloc(s=1),*a=p+(*p=i=j=k=0)/* Bock */ ;while(~(*a=getchar())&&(++a-p<s||(a=(p=realloc(p,s+s))+s)&&(s+=s))||(*a =0));for(a=malloc(s=1),*a=0;(c=p[i])&&(c=='+'&&++a[j]||c=='-'&&--a[j]||c =='>'&&(++j<s||(a=realloc(a,s+s))&&memset(a+s,0,s)&&(s+=s))||c=='<'&&j-- ||c=='.'&&~putchar(a[j])||c==','&&~(a[j]=getchar()))|!strchr("><.,",c);i ++)while((c=='['&&!a[j]||c==']'&&a[j])&&(k+=(p[i]=='[')-(p[i]==']'))&&p[ i+=c/* Brainf*** */=='[']&&(/* worse than */i-=c==']'/* this sig! */));}compile with gcc and then in order to interpret, do ./bf < prog.bfi know it runs in cygwin, but no reason it should not work on actual nix ;) Quote
sanctus Posted April 21, 2009 Report Posted April 21, 2009 I told you Alexander, I deducted only...at least the beginning was right...the rest I wait for someone else to figure it out :-) Quote
Pyrotex Posted April 21, 2009 Report Posted April 21, 2009 Sanctus, it does print ;) that's what the dots indicate... you figure out what (even if you post ascii values it's major kudos for you :hihi: its a fun language though)Fun? You call this a FUN language?We have way different definitions of 'fun'.My definition of 'fun' includes maximum raw power, with minimum input; and that input must look 'elegant' and esthetically pleasing. PERL, with lots and lots of Regular Expressions. That's fun! :) Quote
alexander Posted April 21, 2009 Author Report Posted April 21, 2009 ofcourse i call this fun, it takes little to make a geek smile, it just has to be geekier then their current level of geekdom... I am embarking on a project though, i want to write a brain**** compiler in brain**** to perhaps go to 8085 or x86 assembly... should be fun, also it would be another thing on my resumee so yeah... Pyro, first of all learn Python, you want sheer awesomeness, that's a language for you (and mods for arbitrary precision math make it perfect for many many great and fun (your definition) applications) I call brain**** fun because it forces one to think in logic that one normally can not grasp, thus making cool things in it is not only a challenge, but is, for lack of better term, fun. Quote
alexander Posted April 21, 2009 Author Report Posted April 21, 2009 Many a Perl people have been converted to the dark side, to Python ;) namely a good friend of mine, Adam, was a total perl zealot, he was convinced that he would never like Python, nor convert from Perl, he hated it for a week, and then all of a sudden, bam it made sense and became the best language in the world, he's a hardcore Python guru now, he wrote some genetic algorithms in it, he wrote a huge piece of code for package rollout and central management for gentoo, and he writes nearly all the code in python now :hihi: Quote
alexander Posted April 21, 2009 Author Report Posted April 21, 2009 good book for anyone who wants to learn x86 assembly: x86 Assembly - Wikibooks, collection of open-content textbooks also this will be a resource later, somewhere i can find it :shrug: Quote
sanctus Posted April 21, 2009 Report Posted April 21, 2009 Alex, don't worry I call it fun too... Quote
CraigD Posted April 21, 2009 Report Posted April 21, 2009 now you figure out what it does :shrug:I manually stepped through it outputting "Brain", so I'm guessing it outputs "Brain****". I'm also not stepping through it manually anymore, but writing a program to, as this is not activity fit for a human! Quote
CraigD Posted April 22, 2009 Report Posted April 22, 2009 I manually stepped through it outputting "Brain", so I'm guessing it outputs "Brain****". I'm also not stepping through it manually anymore, but writing a program to, as this is not activity fit for a human! :shrug:I guessed wrong! It outputs: "Brain**** ****s with your brain :)" Here's a Brain**** interpreter written in MUMPS:[noparse]s D=$tr($j("",30000)," ",$c(0)),(DI,PI)=1 f q:$e(P,PI)="" x XLBF($e(P,PI)) ;XLBF:Brain**** language interpreter s $e(D,DI)=$c($a(D,DI)+1),PI=PI+1 ;XLBF("+") s $e(D,DI)=$c($a(D,DI)-1),PI=PI+1 ;XLBF("-") r *R s $e(D,DI)=$c(R),PI=PI+1 ;XLBF(",") w $e(D,DI) s PI=PI+1 ;XLBF(".") s DI=DI-1,PI=PI+1 ;XLBF("<") s DI=DI+1,PI=PI+1 ;XLBF(">") s PI=PI+1 i '$a(D,DI) f PI=PI:1 q:$e(P,PI)?1(1"]",1"") ;XLBF("[") s PI=PI+1 i $a(D,DI) f PI=PI-2:-1 q:$e(P,PI)?1(1"[",1"") ;XLBF("]") r P,! x XLBF ++++++++++[>+++++>++++++++++>+++++++++++>+++>+<<<<<-]>++++++++++++++++.>>++++.<---.++++++++.>----.<---.>+++++++.<---.>----------.>++.<<+++.>++++++++++.<---.>----------.++++++++.>.<++++.<++++++.>---.<-.>>.<+++++.----------.++++++.---.>.<<------.>.<-.++++++++.>----.>.<<<--------.>>>+++++++++.>. Brain**** ****s with your brain [/noparse]Fun! :shrug: Now, who wants to really get into the spirit of it, and write a Brain**** interpreter in Brain****? or that other programming classic, a Brain**** program that produces itself as output? :D Quote
alexander Posted April 22, 2009 Author Report Posted April 22, 2009 Craig, perhaps you didn't read my previous post, i am writing a brain**** compiler in brain**** (it will compile into x86 assembly) well or at least laying it out now. Since brain**** lack traditional control and decision structures, but i think i have finally figured out some magic to make it all work together :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.