stacky-tape.nv
· 2.4 KiB · Text
Исходник
Playground
|:: push to $x :value: $y| :stacks: $x $y
|:: push $x to $y| :stacks: $y $x
|:: pop from $x :stacks: $x $y|
:value: $y
:: reset stacks
|:: pop from $x? :stacks: $z $y|
:seen: $z $y
|:: pop from $x :default symbol: $y?|
:value: $y
:: reset stacks
|:: pop from $x|
:: stop execution :error: pop from an empty or nonexistent stack $x
|:: reset stacks? :seen: $x $y|
:stacks: $x $y
|:: reset stacks|
|:: move $direction :@math: $x|
:stack: $x
|:: move left :stack: 1 :number of stacks: $x?|
:stack: $x
|:: move left? :stack: $x|
:@math: subtract $x 1
|:: move right :stack: $x :number of stacks: $x?|
:stack: 1
|:: move right? :stack: $x|
:@math: add $x 1
|:: move $direction?|
:stack: 1
|:: compare and branch :value: ($x $x)|
|:: compare and branch :value: ($x $y)|
:: seek forward :depth:
|:: seek forward? :code: [|
:executed: [
:depth:
|:: seek forward? :code: ] :depth: :depth:|
:executed: ]
|:: seek forward :code: ] :depth:|
:executed: ]
|:: seek forward? :code: $x|
:executed: $x
|:: seek forward|
|:: seek backward? :executed: ]|
:code: ]
:depth:
|:: seek backward? :executed: [ :depth: :depth:|
:code: [
|:: seek backward :executed: [ :depth:|
:code: [
|:: seek backward? :executed: $x|
:code: $x
|:: seek backward|
|:: step :code: <|
:executed: <
:: move left
|:: step :code: >|
:executed: >
:: move right
|:: step :code: 0|
:executed: 0
:: push 0 to 1
|:: step :code: 1|
:executed: 1
:: push 1 to 1
|:: step :code: ^ :stack: $x?|
:executed: ^
:: pop from 1
:: push to $x
|:: step :code: v :stack: $x?|
:executed: v
:: pop from $x
:: push to 1
|:: step :code: [ :stack: $x?|
:executed: [
:: pop from 1
:: pop from $x
:: compare and branch
|:: step :code: ]|
:executed: ]
:: seek backward
|:: step :code: $x|
|:: step| :halt:
|:: run :halt:|
:: clean up
|:: run?|
:: step
|:: clean up? :executed: $x|
|:: clean up? :code: $x|
|:: clean up|
|:: parse? :text: '<'| :parsed: <
|:: parse? :text: '>'| :parsed: >
|:: parse? :text: '0'| :parsed: 0
|:: parse? :text: '1'| :parsed: 1
|:: parse? :text: '^'| :parsed: ^
|:: parse? :text: 'v'| :parsed: v
|:: parse? :text: '['| :parsed: [
|:: parse? :text: ']'| :parsed: ]
|:: parse? :text: $x |
|:: parse? :parsed: $x| :code: $x
|:: parse|
||:stack: 1
|:: evaluate|
:: parse
:: run
||:: evaluate :text: "0 1111 1111 1111 1^[>1^1^]"
:number of stacks: 50
| 1 | |:: push to $x :value: $y| :stacks: $x $y |
| 2 | |:: push $x to $y| :stacks: $y $x |
| 3 | |
| 4 | |:: pop from $x :stacks: $x $y| |
| 5 | :value: $y |
| 6 | :: reset stacks |
| 7 | |:: pop from $x? :stacks: $z $y| |
| 8 | :seen: $z $y |
| 9 | |:: pop from $x :default symbol: $y?| |
| 10 | :value: $y |
| 11 | :: reset stacks |
| 12 | |:: pop from $x| |
| 13 | :: stop execution :error: pop from an empty or nonexistent stack $x |
| 14 | |
| 15 | |:: reset stacks? :seen: $x $y| |
| 16 | :stacks: $x $y |
| 17 | |:: reset stacks| |
| 18 | |
| 19 | |:: move $direction :@math: $x| |
| 20 | :stack: $x |
| 21 | |:: move left :stack: 1 :number of stacks: $x?| |
| 22 | :stack: $x |
| 23 | |:: move left? :stack: $x| |
| 24 | :@math: subtract $x 1 |
| 25 | |:: move right :stack: $x :number of stacks: $x?| |
| 26 | :stack: 1 |
| 27 | |:: move right? :stack: $x| |
| 28 | :@math: add $x 1 |
| 29 | |:: move $direction?| |
| 30 | :stack: 1 |
| 31 | |
| 32 | |:: compare and branch :value: ($x $x)| |
| 33 | |:: compare and branch :value: ($x $y)| |
| 34 | :: seek forward :depth: |
| 35 | |
| 36 | |:: seek forward? :code: [| |
| 37 | :executed: [ |
| 38 | :depth: |
| 39 | |:: seek forward? :code: ] :depth: :depth:| |
| 40 | :executed: ] |
| 41 | |:: seek forward :code: ] :depth:| |
| 42 | :executed: ] |
| 43 | |:: seek forward? :code: $x| |
| 44 | :executed: $x |
| 45 | |:: seek forward| |
| 46 | |
| 47 | |:: seek backward? :executed: ]| |
| 48 | :code: ] |
| 49 | :depth: |
| 50 | |:: seek backward? :executed: [ :depth: :depth:| |
| 51 | :code: [ |
| 52 | |:: seek backward :executed: [ :depth:| |
| 53 | :code: [ |
| 54 | |:: seek backward? :executed: $x| |
| 55 | :code: $x |
| 56 | |:: seek backward| |
| 57 | |
| 58 | |:: step :code: <| |
| 59 | :executed: < |
| 60 | :: move left |
| 61 | |:: step :code: >| |
| 62 | :executed: > |
| 63 | :: move right |
| 64 | |:: step :code: 0| |
| 65 | :executed: 0 |
| 66 | :: push 0 to 1 |
| 67 | |:: step :code: 1| |
| 68 | :executed: 1 |
| 69 | :: push 1 to 1 |
| 70 | |:: step :code: ^ :stack: $x?| |
| 71 | :executed: ^ |
| 72 | :: pop from 1 |
| 73 | :: push to $x |
| 74 | |:: step :code: v :stack: $x?| |
| 75 | :executed: v |
| 76 | :: pop from $x |
| 77 | :: push to 1 |
| 78 | |:: step :code: [ :stack: $x?| |
| 79 | :executed: [ |
| 80 | :: pop from 1 |
| 81 | :: pop from $x |
| 82 | :: compare and branch |
| 83 | |:: step :code: ]| |
| 84 | :executed: ] |
| 85 | :: seek backward |
| 86 | |:: step :code: $x| |
| 87 | |:: step| :halt: |
| 88 | |
| 89 | |:: run :halt:| |
| 90 | :: clean up |
| 91 | |:: run?| |
| 92 | :: step |
| 93 | |
| 94 | |:: clean up? :executed: $x| |
| 95 | |:: clean up? :code: $x| |
| 96 | |:: clean up| |
| 97 | |
| 98 | |:: parse? :text: '<'| :parsed: < |
| 99 | |:: parse? :text: '>'| :parsed: > |
| 100 | |:: parse? :text: '0'| :parsed: 0 |
| 101 | |:: parse? :text: '1'| :parsed: 1 |
| 102 | |:: parse? :text: '^'| :parsed: ^ |
| 103 | |:: parse? :text: 'v'| :parsed: v |
| 104 | |:: parse? :text: '['| :parsed: [ |
| 105 | |:: parse? :text: ']'| :parsed: ] |
| 106 | |:: parse? :text: $x | |
| 107 | |:: parse? :parsed: $x| :code: $x |
| 108 | |:: parse| |
| 109 | |
| 110 | ||:stack: 1 |
| 111 | |
| 112 | |:: evaluate| |
| 113 | :: parse |
| 114 | :: run |
| 115 | |
| 116 | ||:: evaluate :text: "0 1111 1111 1111 1^[>1^1^]" |
| 117 | :number of stacks: 50 |
| 118 |