Brainf***: Difference between revisions

From Rosetta Code
Content added Content deleted
(Creating basic page with details about this language)
 
(Redirect to category)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
#REDIRECT [[:Category:Brainf***]]
Also known as Brainfuck. Created by Urban Müller in 1993 in an attempt to create the world's smallest Turing-complete compiler. It is noted as an [[esoteric programming language]], as it is not ordinarily used for applications development, but it also noted as being a minimalist language.

The complete specification for the language can be summed up with the following eight symbols:

{| class="wikitable"
!align="center"|Character
!align="left" |Meaning
|-
|style="text-align:center"|<code>></code>
||increment the pointer (to point to the next cell to the right).
|-
|style="text-align:center"|<code><</code>
||decrement the pointer (to point to the next cell to the left).
|-
|style="text-align:center"|<code>+</code>
||increment (increase by one) the byte at the pointer.
|-
|style="text-align:center"|<code>-</code>
||decrement (decrease by one) the byte at the pointer.
|-
|style="text-align:center"|<code>.</code>
||output the value of the byte at the pointer.
|-
|style="text-align:center"|<code>,</code>
||accept one byte of input, storing its value in the byte at the pointer.
|-
|style="text-align:center"|<code>[</code>
||[[Branch (computer science)|jump]] forward to the command after the corresponding <code>]</code> if the byte at the pointer is zero.
|-
|style="text-align:center"|<code>]</code>
||jump back to the command after the corresponding <code>[</code> if the byte at the pointer is nonzero.
|}

Alternatively, the <code>]</code> command may instead be translated as an unconditional jump '''to''' the corresponding <code>[</code> command, or vice versa; programs will behave the same but will run more slowly.

All other symbols, including traditional whitespace characters, are interpreted as comments.

Due to this minimal instruction set, Brainf*** is used as an introduction to compilers and has even been successfully implemented as a microprocessor core and the foundation to an operating system using a slightly extended syntax for output.

== Citations ==

* [http://en.wikipedia.org/wiki/Brainfuck Wikipedia entry on Brainf***]
* [http://dmoz.org/Computers/Programming/Languages/Brainfuck/ DMOZ Brainf*** category]
* [http://www.iwriteiam.nl/Ha_BF.html Brainf*** tutorial]

{{Programming Language}}

Latest revision as of 02:34, 8 November 2007

Redirect to: