A brainf... implementation using D templates
John S. Skogtvedt
jss2k2 at chello.no
Tue Nov 7 11:56:06 PST 2006
For those who haven't heard of it, brainf.... (BF) is a minimal
turing-complete "programming language" with eight commands.
For more information, see http://en.wikipedia.org/wiki/Brainfuck .
For fun I tried doing a template implementation that would "compile" the
BF code at compile time.
For obvious reasons it only works with small BF programs.
The BF code in the source is the multiplication example from the
wikipedia article.
Compile the code, run it, and type (e.g.) 23<enter>. The output should be 6.
Source code attached (if the attachment doesn't work:
http://home.chello.no/~jskogtv/bf.d )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bf.d
Type: text/x-dsrc
Size: 1465 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20061107/23a3a515/attachment.d
More information about the Digitalmars-d-learn
mailing list