Created
January 5, 2019 04:43
-
-
Save kotet/daeca8e99ca7e9521ea0ce00b527cca9 to your computer and use it in GitHub Desktop.
Stack and Heap in Brainfuck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stack and heap in brainfuck | |
result: 7 5 0 3 1 7 | |
b1 == 5 | |
b2 == 7 | |
stack == [3 7] | |
>> allocate 2 | |
>+++ push 3 | |
push 5 | |
>+ | |
>+++++ | |
<[<<] stack top to base | |
>>[>>]< base to stack top | |
pop and store to b1 | |
[ <[<<] (<) + (>) >>[>>]< - ] <-< | |
push 5 | |
>+ | |
>+++++++ | |
b2 = stack top | |
[ >>+<< <[<<] (<<) + (>>) >>[>>]< - ] >>[<<+>>-]<< | |
push b2 (nondestructive) | |
>+ [<<] (<<) [(>>) >>[>>] >+<<+ <[<<] (<<) -] | |
(>>) >>[>>]> | |
[<< <[<<] (<<) + (>>) >>[>>]> - ] << | |
pop | |
[-]<-< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment