News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Brainf**k Macros

Started by AeroASM, June 20, 2005, 05:09:13 PM

Previous topic - Next topic

AeroASM

For those who don't know, Brainf**k is a minimalist programming language with 8 instructions, with no operands.

http://en.wikipedia.org/wiki/Brainfuck

Someone somewhere wrote a Brainf**k interpreter where you could define your own macros, to make programming easier.
And so I thought, why not use the incredible parsing power of MASM macros?

This is only a basic implementation of the instructions; in the next release I will include some macros. I eventually hope to turn it into a C-style compiler, built on top of Brainf**k.

There are two files: bf.asm contains the basic macros to "assemble" Brainf**k, and test.asm is a sample program that counts from 0 to 9 and then beeps.

Vortex

Concerning this amazing language, which can of syntax is that? :green

Bieb

Might I ask you what the hell actually inspired to do anything brainfuck related?

AeroASM

Boredom. I thought it might be interesting, tried it out, then gave up.

Citric

Sounds cool

Have you written, anything in MASM?

Cheer Adam

Phil

Is the BF language strong enough to allow the creation of a self-replicating program?

  You know, like:

     c:>type self-rep.source
     abcdefxydebc

     ; then assemble and link to create an exe

     c:>self-rep.exe
     abcdefxydebc

     Sounds like it might be ideal for that!

AeroASM

Yes, it is possible; such a program is called a "quine"

Phil

Here's a link to self-replicating C quines! The smallest one is really sweet:

main(a){printf(a,34,a="main(a){printf(a,34,a=%c%s%c,34);}",34);}

I managed to write one once but mine was more like the 80-line variety with a ton of constant data to do the trick. I'd guess that a BF quine could be a lot short than the C source above!

Bieb

But BF can't write to files.

Eóin

I believe that a quine need only output its source code to standard out or something similar. Following a link from the page posted by Phil there are examples in many other languages, including BBF.

http://www.nyx.net/~gthompso/quine.htm