Page 1 of 1

Jesus...what a language!

PostPosted:Thu Dec 16, 2004 2:22 am
by SineSwiper
<div style='font: 10pt "EngraversGothic BT", "Copperplate Gothic Light", "Century Gothic"; text-align: left; '><b>Link:</b> <a href="http://en.wikipedia.org/wiki/Brainfuck">++++++++++[+++++++++++++++++++++-]</a>

Jesus...what a language!</div>

PostPosted:Thu Dec 16, 2004 10:31 am
by Tessian
<div style='font: 11pt Dominion; text-align: left; '>wtf? Is it ok if I don't understand a lick of that language?</div>

PostPosted:Thu Dec 16, 2004 10:47 am
by Kupek
<div style='font: 10pt verdana; text-align: left; padding: 0% 10% 0% 10%; '>It's a language just for the hell of it, so yes. You're limited to working with a single byte at a time, and going only one byte backwards or forwards, which is far more limited than even assembly language.</div>

PostPosted:Fri Dec 17, 2004 12:37 am
by SineSwiper
<div style='font: 10pt "EngraversGothic BT", "Copperplate Gothic Light", "Century Gothic"; text-align: left; '>When you think about it, though, you could compose an assembly compiler like that only usings letters and symbols. The command set is small enough, even if it is much larger than the 8 or so commands on this one. Can't believe the entire compiler is only 4KB.</div>

For this language? I could probably write a "compiler" in less than 500 lines - if that many. All I need to do is translate eight characters to their equivalent C statements and call gcc. Their might be small runtime environment needed, but it w

PostPosted:Fri Dec 17, 2004 2:04 am
by Kupek
<div style='font: 10pt verdana; text-align: left; padding: 0% 10% 0% 10%; '>And you might be surprised how many instructions there are in Intel's x86 instruction set. Go check the manuals if you're curious (yes, two; they split it halfway through the alphabet).</div>

PostPosted:Fri Dec 17, 2004 7:16 am
by SineSwiper
<div style='font: 10pt "EngraversGothic BT", "Copperplate Gothic Light", "Century Gothic"; text-align: left; '>Well, calling GCC is just cheating. You'd have to write the compiler in assembly. As far as Intel set, I was just talking about the basic set, without all of the MMX and other crap in there. A 486-era compiler should be small enough.</div>

Like hell it's cheating.

PostPosted:Fri Dec 17, 2004 10:25 am
by Kupek
<div style='font: 10pt verdana; text-align: left; padding: 0% 10% 0% 10%; '>First of all, I think you have your phrasing screwed up. I think you mean to say "You'd have to generate assembly," not write the compiler in assembly. A source-to-source compiler is still a compiler. The first C++ compiler written by Stroustrup was a source to source compiler; he parsed C++, generated C code, and depended on a C compiler and linker. He still wrote a compiler. In this case it's trivial because the language itself is trivial. The reason it's so difficult to get anything accomplished in Brainfuck is that you are limited to an extremely myopic view of an abstraction of a computer. And frankly, generating assembly really wouldn't be that difficult either. I also don't think the "basic" x86 instruction set is as small as you think it is.

And I was actually overestimating with 500 lines. I just found some that do it in less than 100.</div>

PostPosted:Fri Dec 17, 2004 10:49 pm
by SineSwiper
<div style='font: 10pt "EngraversGothic BT", "Copperplate Gothic Light", "Century Gothic"; text-align: left; '>You're basically calling another compiler to compile your "converted" program. So, it's cheating. A compiler is supposed to generate machine code. An -emulator- or -convertor- could convert it into a different language.</div>

PostPosted:Fri Dec 17, 2004 11:08 pm
by Kupek
<div style='font: 10pt verdana; text-align: left; padding: 0% 10% 0% 10%; '>Like I said, it's just called a source-to-source compiler. I have never heard the terms "emulator" or "convertor" in the area of compilers. Even gcc doesn't generate machine code. It generates assembly code, then calls as to generate the machine code. Do a "man as" and read the description.</div>