Brainfuck: Free Version
Jump to navigation
Jump to search
Brainfuck: Free Version (or brainfuck: free version) is a subset of brainfuck premium (or Brainfuck Premium), which is essentially brainfuck. It is made as part of this repost chain on wasteof.
Definition
In the post, it is written:
brainfuck premium:
without it you cant:[sic]
- use
+
,[]
, and,
Thus, the commands of brainfuck: free version are:
Command | Description |
---|---|
>
|
Move the pointer to the right |
<
|
Move the pointer to the left |
-
|
Decrement the memory cell at the pointer |
.
|
Output the character signified by the cell at the pointer |
Computational class
Since brainfuck: free version doesn't have any control loop whatsoever, this language always halts, making it not Turing complete.
Interpreter
Trivial brainfuck substitution style interpreter.
#!/usr/bin/ruby eval 'm=Hash.new(p=0);'+ARGF.read.gsub( /./, '>'=>'p+=1;', '<'=>'p-=1;', # '+'=>'m[p]+=1;', '-'=>'m[p]-=1;', # '['=>'(', # ']'=>')while((m[p]&=255)!=0);', # ','=>'m[p]=STDIN.getbyte if !STDIN.eof;', '.'=>'putc m[p];')