Differences between version 10 and revision by previous author of Brainf*ck.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 10 | Last edited on Friday, September 12, 2003 7:10:22 pm | by GlynWebster | Revert |
Older page: | version 1 | Last edited on Tuesday, September 10, 2002 2:12:42 am | by GerwinVanDeSteeg | Revert |
@@ -1,15 +1,15 @@
![Brainf*ck]
-An interesting programming language
. It is a
very easy to learn language
, but can get extremely confusing.
+An interesting [ProgrammingLanguage]
. It is very easy to learn, but can get extremely confusing.
-The language has 8 different constructs
which following
, and included is their purpose:
-; + : Increment the value of the current pointer
by 1
-; - : Decrement the value of the current pointer
by 1
-; . : Print the current value
as a character to standard output [stdout(3)]
-; , : Read a value from standard input [stdin(3)]
-; > : Move to current
pointer to the next address
-; < : Move to current
pointer to the previous address
-; [ : Start of a loop. This essentially is a while loop which will keep iterating until the referenced value
equals zero. ie. while(!
x) { }
+The language has 8 different commands
which follow
, and included is their purpose. They use a nameless pointer to manipulate an array of (typically) 30000 cells, all initially set to . The pointer starts at the left end of the array.
+; + : Increment the value of the current cell
by 1
+; - : Decrement the value of the current cell
by 1
+; . : Print the current cell
as a character to standard output [stdout(3)]
+; , : Read a value from standard input to the current cell (these two use ASCII)
[stdin(3)]
+; > : Move the
pointer to the next cell
+; < : Move the
pointer to the previous cell
+; [ : Start of a loop. This essentially is a while loop which will keep iterating until the current cell
equals zero. ie. while(x) { }
; ] : End of the while loop. Anything between these two language constructs will get executed whilst the while loop executes.
As they say about [Perl]: ''There are many ways to skin a Camel''
This also holds true for [Brainf*ck].
@@ -35,14 +35,19 @@
++++++++++++++++++++++++++++++++++++++++++++.+++++++..+++.>++++++++++++++
++++++++++++++++++.<<.>.+++.------.--------.
>>+++++++++++++.
+A big archive of brainfuck programs and implementations is at http://esoteric.sange.fi/brainfuck/ .
!Notes
-The language has the simple specification to ignore any character in the program source code which is not a valid language construct
. This allows us to put comments in our code, as long as we make sure we do not accidentally use one of the language constructs in our comments.
+The language has the simple specification to ignore any character in the program source code which is not a valid brainfuck command
. This allows us to put comments in our code, as long as we make sure we do not accidentally use one of the language constructs in our comments.
[GerwinVanDeSteeg] is planning on writing his own Compiler and an Interpreter for this language sometime in the near future. There are some available already on the WorldWideWeb, to find one, try Google.
+
+!Brainfux0r
+
+I've just written one. Insomnia has its own imperatives. Here you go: [brainfux0r.ml | http://www.wave.co.nz/~glyn/brainfux0r.ml]. It is written in [Ocaml]. It has a compiler (it compiles to [C]), an imperative interpreter and a functional interpreter. The functional interpreter has an infinite Turing tape as memory. I wrote and rewrote this program several times to try out various Ocaml features. (I'm following the advice on StuffToCode.) --GlynWebster
----
''There is someone in my head,''%%%''and it is not me.''
;:''-- Pink Floyd, Brain damage''