Omnimaga
General Discussion => Technology and Development => Computer Programming => Topic started by: fb39ca4 on December 07, 2010, 08:07:25 pm
-
I found a brainfuck compiler on ticalc.org. Not knowing what it was, I googled it. Apparently, it is a super-minimalist language with only 8 operators. Anyone tried it yet?
-
Yep: http://ourl.ca/6692/110036 ;D
As for the compiler, any chance it's made by thepenguin77/juju2143?
EDIT: Here: http://ourl.ca/6692/110343
-
I only made an über-slow interpreter.
-
I downloaded the stuff to develop in it, but I haven't had the time to try it out yet. ;_; I also need to find a good tutorial. :P
-
Oh wow I remember you posted that juju. I wonder what kind of game quality can be made in Brainfuck?
-
Well its been proven Turring Complete, which means that you could make Portal if you were so inclined :P
-
O.O ?
I wonder how the code would look like...
-
It's set up so you have 30kb of memory all set to zero, and a pointer at the zeroth byte.
There's only 8 commands:
< > increment or decrement the pointer by 1
+ - increment or decrement the value of the byte the pointer points to
. , print or store a character in the current cell
[ if the value of the current byte is zero, then go past the corresponding ]
] go back to the matching [
What I found really ... odd ... is someone wrote a brainf*ck ... in brainf*ck.
-
/me is amazed at how hard this programming language is
Oooh, I love BrainFuck :D Try this one on for size (routine sucks probably >.>)
->[->+>+>+<<<]>>>
[-<<<+>>>]<<<<
[->>[-<+>]>[->+<<+>]>[-<+>]<<<<]>,
Multiplies the first number by the second number, and leaves the result in the... 2nd slot I think... Line breaks were added for readability :D
This is wow...
-
+++++ +++++ initialize counter (cell #0) to 10
[ use loop to set the next four cells to 70/100/30/10
> +++++ ++ add 7 to cell #1
> +++++ +++++ add 10 to cell #2
> +++ add 3 to cell #3
> + add 1 to cell #4
<<<< - decrement counter (cell #0)
]
> ++ . print 'H'
> + . print 'e'
+++++ ++ . print 'l'
. print 'l'
+++ . print 'o'
> ++ . print ' '
<< +++++ +++++ +++++ . print 'W'
> . print 'o'
+++ . print 'r'
----- - . print 'l'
----- --- . print 'd'
> + . print '!'
> . print '\n'
This prints hello world
-
+++++ +++++ initialize counter (cell #0) to 10
[ use loop to set the next four cells to 70/100/30/10
> +++++ ++ add 7 to cell #1
> +++++ +++++ add 10 to cell #2
> +++ add 3 to cell #3
> + add 1 to cell #4
<<<< - decrement counter (cell #0)
]
> ++ . print 'H'
> + . print 'e'
+++++ ++ . print 'l'
. print 'l'
+++ . print 'o'
> ++ . print ' '
<< +++++ +++++ +++++ . print 'W'
> . print 'o'
+++ . print 'r'
----- - . print 'l'
----- --- . print 'd'
> + . print '!'
> . print '\n'
+++++ +++++
[
> +++++ ++
> +++++ +++++
> +++
> +
<<<< -
]
> ++ .
> + .
+++++ ++ .
.
+++ .
> ++ .
<< +++++ +++++ +++++ .
> .
+++ .
----- - .
----- --- .
> + .
> .
Can this be done without entering lines?
-
yeah
-
+++++ +++++ [ > +++++ ++ > +++++ +++++ > +++ > + <<<< - ] > ++ .> + . +++++ ++ . . +++ . > ++ . << +++++ +++++ +++++ . > . +++ . ----- - . ----- --- . > + . >
If I ever told a programming teacher at a University this was a Hello World program he would not believe it.
-
+++++ +++++ [ > +++++ ++ > +++++ +++++ > +++ > + <<<< - ] > ++ .> + . +++++ ++ . . +++ . > ++ . << +++++ +++++ +++++ . > . +++ . ----- - . ----- --- . > + . >
If I ever told a programming teacher at a University this was a Hello World program he would not believe it.
No, you're doing it wrong. Remove the spaces :P
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>
-
This actually wouldn't be hard to make a compiler in axe :)
-
This actually wouldn't be hard to make a compiler in axe :)
A ON-CALC Compiler... Hum! That would be cool.
-
+++++ +++++ initialize counter (cell #0) to 10
[ use loop to set the next four cells to 70/100/30/10
> +++++ ++ add 7 to cell #1
> +++++ +++++ add 10 to cell #2
> +++ add 3 to cell #3
> + add 1 to cell #4
<<<< - decrement counter (cell #0)
]
> ++ . print 'H'
> + . print 'e'
+++++ ++ . print 'l'
. print 'l'
+++ . print 'o'
> ++ . print ' '
<< +++++ +++++ +++++ . print 'W'
> . print 'o'
+++ . print 'r'
----- - . print 'l'
----- --- . print 'd'
> + . print '!'
> . print '\n'
This prints hello world
ASM looks easier to read than this. O.O
This actually wouldn't be hard to make a compiler in axe :)
A ON-CALC Compiler... Hum! That would be cool.
Also I thought BrainFuck was interpreted, not compiled? ???
-
Even HEX looks simpler than that to me :)
-
It is interpreted, though that doesn't mean that it couldn't be compiled. I made a .NET interpreter recently: http://myserverathome.com/BFI.exe (http://myserverathome.com/BFI.exe).
-
In case you don't find that challenging enough, there's always this programming language (http://en.wikipedia.org/wiki/Whitespace_%28programming_language%29)... :devil:
-
In case you don't find that challenging enough, there's always this programming language (http://en.wikipedia.org/wiki/Whitespace_%28programming_language%29)... :devil:
No... I just saw Wiki Page, omG that's impossible!
-
I went to the languages linked. OMG LOLCODE!!!!
-
Actually it is very easy to compile. My compiler mentioned in the second post does just that. It almost directly translates to assembly in fact. > is inc hl, < is dec hl, + is inc (hl), and - is dec (hl). The other four commands are a little more complex, but not much bigger than 10 bytes a piece.
-
Actually it is very easy to compile. My compiler mentioned in the second post does just that. It almost directly translates to assembly in fact. > is inc hl, < is dec hl, + is inc (hl), and - is dec (hl). The other four commands are a little more complex, but not much bigger than 10 bytes a piece.
A compiler with 8 commands xD There are only8 commands so making a compiler must be easy.
-
I went to the languages linked. OMG LOLCODE!!!!
Yeah, I found LOLCODE hilarious. ;D
-
http://en.wikipedia.org/wiki/LOLCODE (http://en.wikipedia.org/wiki/LOLCODE)
Hahahahaahah
-
It is interpreted, though that doesn't mean that it couldn't be compiled. I made a .NET interpreter recently: http://myserverathome.com/BFI.exe (http://myserverathome.com/BFI.exe).
lol nice. Now I wish I knew that language X.x
And yeah I remember about Whitespace and Lolcode. About the latter, Miotatsu wrote a tutorial for it a while ago: http://ourl.ca/4689
-
If you're a fan of esoteric programming languages, you should check out the esolang wiki!:
http://esoteric.voxelperfect.net/wiki/Main_Page (http://esoteric.voxelperfect.net/wiki/Main_Page)
-
http://esoteric.voxelperfect.net/wiki/Joke_language_list (http://esoteric.voxelperfect.net/wiki/Joke_language_list)
Best link ever. Epic.
-
Loooooooooooooooooooool!
I especially liked the Text language.
-
Lol nice XD
<semi-troll>They should add TI-Nspire BASIC to the joke language list.</semi-troll>
-
<semi-troll>They should add TI-Nspire BASIC to the joke language list.</semi-troll>
XD YES That would totally beat half the languages on the list in uselessness!
-
Not even jokingly, either. There's no user input during runtime :P
-
Except 2.0 and above, which have Request, but it gets annoying (like a dialog box that appears out of nowhere. Horrible for games).
-
Yeah true, but what Deep Thought said. Same thing occurs on the TI-89 and 92+, but at least the 68K models got a Getkey function.
-
Lolcode actually looks pretty freaking awesome. You'd think it was developed by the people on that site that must not be named... O.O
Lol nice XD
<semi-troll>They should add TI-Nspire BASIC to the joke language list.</semi-troll>
:evillaugh:
Quoted For Truth
The sad part is that Nspire BASIC IS likely less funtional than most of the languages on that list. :'(
-
That is very true...
-
at least with brainf*ck you can do whatever you want with those 30K of bytes you have to use...
EDIT: 1111th post :P
-
Does it also let you mess with memory stuff like assembly languages or is it more high level?
-
It depends on the interpreter/compiler. There's are commands to modify a single byte at a time, which can technically be any byte in RAM, but some interpreters/compilers (like thepenguin77's) make sure you can only modify bytes in a safeRAM location.
-
Ah, right, thanks for the info. :)
-
Does it also let you mess with memory stuff like assembly languages or is it more high level?
If you want to mess with memory then Malbolge (http://en.wikipedia.org/wiki/Malbolge) should be your thing. It took two years to write "Hello, World" in Malbolge:
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>
The standard Malbolge is not Turing-complete because there are memory limitation, but there are some extended versions which (http://esolangs.org/wiki/Malbolge_Unshackled) are Turing-complete. Lou Scheffer posted a cryptanalysis (sic!) of Malbolge and wrote BrainFuck to Malbolge compiler (http://www.lscheffer.com/bf2malbolge.html).
-
O.O
I don't think I'll ever touch that language...
-
It looks evil.
-
It looks evil.
What do you expect from language named after eight circle of hell?
O.O
I don't think I'll ever touch that language...
I think you are missing the point. Nobody uses Malbolge (or Brainfuck, for that matter) for "real" programming. They exist to show that questions like "what can pointers do that variables can't?" are just incorrect. The answer is always the same: "nothing". You can rewrite any program in Brainfuck and/or Malbolge - and it'll do the same thing still. All constructs which exist in many languages are always about convenience and [sometimes] efficiency, not about pure implementability.
As Joel wrote in this article (http://www.joelonsoftware.com/articles/fog0000000073.html) "understanding pointers in C is not a skill, it's an aptitude", but it does not mean you can avoid them if you are not using C. There are tasks which are easy to implement with pointers and hard without them - and you can write them in any sane or insane language - including TI-Basic or Malbolge.
-
Ah I see, then. I wasn't too sure. X.x