Brainfunk: Porovnání verzí

Z ZděchovNET
Skočit na navigaci Skočit na vyhledávání
(Založena nová stránka: =Overview= Brainfunk is derivative of Brainfuck language with aims to: * Unify cell pointer and cell increment and decrement operations to single + and - operations…)
 
Bez shrnutí editace
Řádek 67: Řádek 67:
|-
|-
| Copy value || <code>>[-]>[-]<<[->+>+<<]>>[-<<+>>]</code> || <code>#@%&+@#%</code>
| Copy value || <code>>[-]>[-]<<[->+>+<<]>>[-<<+>>]</code> || <code>#@%&+@#%</code>
|-
| Swap value || <code>>[-]<<[->>+<<]>[-<+>]>[-<+>]</code> || <code>#@%&++@#%&-#@%&-@#%&++#@%&-@#%</code>
|}
|}



Verze z 27. 6. 2012, 11:49

Overview

Brainfunk is derivative of Brainfuck language with aims to:

  • Unify cell pointer and cell increment and decrement operations to single + and - operations. Remove > and < operations.
  • Introduce fast copy instruction usable between all address spaces.
Command Description
+ Increment value
- Decrement value
[ Jump past the matching ] if the value is 0
] Jump back to the matching [ if the value is nonzero
# Switch value to memory space
& Switch value to pointer space
$ Switch value to I/O space
@ Switch value to accumulator space
% Copy from previous memory space to current space

Brainfuck comparison

Description Brainfuck Brainfunk
Increment value + #+
Decrement value - #-
Move the pointer to the right < &+
Move the pointer to the left > &-
Write cell to output . #$%
Read input to cell , $#%
Skip loop if cell is zero [ [
Loop back if cell is nonzero ] ]
Cat ,[.,] $#%[$%#%]
Clear value [-] #[-]
Move value >[-]<[->+<] &+#[-]&-#[-&+#+&-#]
Copy value >[-]>[-]<<[->+>+<<]>>[-<<+>>] #@%&+@#%
Swap value >[-]<<[->>+<<]>[-<+>]>[-<+>] #@%&++@#%&-#@%&-@#%&++#@%&-@#%