Brainfuck.js

Brainfuck.js is a nice Brainfuck implementation written in javascript extended by a number of additional functionalities. Brainfuck is an easy to learn and hard to master programming language. find out more about it here.*

Documentation

Brainfuck.js is nice, that means it is compliant with the inofficial portability standards as offerd by brian raiter. behaviours that in the standards are classified as undefined are implemented as follows:

Brainfuck.js contains additional extensions which are described below. however their usage can be seen as optional so that the portability standards are not broken.

Extensions/Additional Features

comments

Brainfuck.js offers you to use single line comments by opening a line with # ; or *.

Example:


# a comment that sais: initial load
>+

* a comment that sais: open potential infinite loop
[
	; a line commented out:
	; [>+>+>+<<<-]
	[>+>+<<-]>>[<<+<<-]
	
	<+
]

bf-shortcuts

annoyed by hitting your plus-key a thousand times while developing in brainfuck? tired of counting keydowns all the time? i have a solution for you: the bf-shortcuts. it not only helps you to save some time and keyboards, but also makes your brainfuck-code a little less human readable. and wow.. have we waited!

it's as easy as that: replace a long string of similar instructions with a short letter+number combination and the preprocessor included in Brainfuck.js will do the rest. see the table below to get an impression.

shortcut what it does example
iX increment cell by X i4 = ++++
dX decrement cell by X d5 = -----
rX move pointer to the right by X r3 = >>>
lX move pointer to the left by X l6 = < < < < < <

a "Hello World" program that normaly looks like this:

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

with bf-shortcuts can be compressed to:

i10[>i7>i10>i3>+l4-]>++.>+.i7..i3.>++.<<i15.>.i3.d6.d8.>+.>.

and the other tool is:

txt2bf

this is a tool that helps to translate your text into relativly slim and fast (no loops) brainfuck code. paste your text into the code-input, hit "txt2bf" and what you get is standard bf-code that uses only one cell.

Example: "it's a trap" will be translated to:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++.-----------------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-----------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-----------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.--.-----------------.+++++++++++++++.

* you say: "come on man, get your layout together. you can do better that this." i say: "brainfuck has something very hackerish to me and as experience taught me: hackers never use css. default layout is good enough for hackers. and i'm with them. at least when it comes to brainfuck."