Old page wikitext, before the edit (old_wikitext) | ''''MagiStack''' is a [[stack]]-based [[esoteric programming language]] created by Connor Scialdone. It is based loosely on [[Unefunge]] (a one-dimensional offshoot of [[Befunge]]) and uses some similar or identical commands. It is currently in development and has reached version 1.2.
==Commands==
In MagiStack, each character is a command. Any unrecognized characters are ignored. Line breaks and tabs are stripped from the program before execution.<br>
Commands may be clarified in this table by parenthesized pseudocode; each value used from the stack used will be represented by a letter, starting from "a".
{| class="wikitable"
!Command
!Version Added
!Description
|-
|<code>0-9</code>
|v1.0
|Pushes the number's value to the stack
|-
|<code>+</code>
|v1.0
|Pops the top two values from the stack and pushes the sum (a+b)
|-
|<code>-</code>
|v1.0
|Pops the top two values from the stack and pushes the difference (b-a)
|-
|<code>*</code>
|v1.0
|Pops the top two values from the stack and pushes the product (a*b)
|-
|<code>/</code>
|v1.0
|Pops the top two values from the stack and pushes the quotient (b/a)
|-
|<code>%</code>
|v1.0
|Pops the top two values from the stack and pushes the remainder (b%a)
|-
|<code>!</code>
|v1.0
|Pops the top value from the stack and pushes the inverse (!a>0)
|-
|<code>`</code>
|v1.0
|Pops the top two values from the stack and pushes whether (b>a)
|-
|<code>:</code>
|v1.0
|Duplicates the top value from the stack
|-
|<code>\</code>
|v1.0
|Swaps the top two values from the stack
|-
|<code>$</code>
|v1.0
|Pops the top value from the stack and discards it
|-
|<code>.</code>
|v1.0
|Pops the top value from the stack and outputs it as an integer
|-
|<code>,</code>
|v1.0
|Pops the top value from the stack and outputs it as the ASCII character its value represents (in range 0-127)
|-
|<code>=</code>
|v1.0
|Pops the top two values from the stack and skips the next character (Note: includes non-command characters! Be careful!) if they are not equal
|-
|<code>#</code>
|v1.0
|Skips forward to the next occurence of #, |, or ], or the end of the program
|-
|<code>@</code>
|v1.0
|Skips backward to the last occurence of @, |, or ], or the beginning of the program
|-
|<code>]</code>
|v1.0
|Terminates forward skipping (Note: # can be used, but it risks starting an unintended skip, especially with conditionals; | can be used, but is not direction-dependent)
|-
|<code>[</code>
|v1.0
|Terminates backward skipping (Note: @ can be used, but it risks starting an unintended skip, especially with conditionals; | can be used, but is not direction-dependent)
|-
|<code>|</code>
|v1.0
|Terminates skipping in either direction (Note: see #, @, [, and ] to see other options and direction-dependency)
|-
|<code>?</code>
|v1.1
|Pushes the size of the stack onto the stack (i.e. [3,2,1] -> [3,2,1,3])
|-
|<code>^</code>
|v1.1
|Waits for input, then pushes it onto the stack as a signed integer (pushes 0 on invalid input)
|-
|<code>&</code>
|v1.1
|Waits for input, then pushes it onto the stack as ASCII values (pushes each character separately)
|-
|<code>_</code>
|v1.1
|Exits the program
|-
|<code>"</code>
|v1.2
|Enters string mode until the next occurrence of "; while in string mode, each character will be pushed as an ASCII value
|-
|<code>{</code>
|v1.2
|Pops an integer from the stack and pushes each digit in it as an ASCII value
|-
|<code>></code>
|v1.2
|Skips to the final occurrence of |, or to the end of the program
|-
|<code><</code>
|v1.2
|Skips to the first occurrence of |, or to the start of the program
|-
|<code>~</code>
|v1.2
|Reverses the stack (i.e. [3,2,1] -> [1,2,3])
|-
|<code>;</code>
|v1.2
|Pops the bottom value off the stack and pushes it on top (i.e. [3,2,1] -> [2,1,3])
|-
|}
==Computational class==
As MagiStack's memory is only limited by its implementation (rather than by the language itself), it is possible that it is [[Turing-complete]]. However, versions up to v1.1 have been proven to almost certainly not be Turing-complete, and beyond that have not been definitively proven or disproven.
==Examples==
Note that these example programs may not be the most efficient implementation possible (and probably aren't).
===[[Hello, world!]]===
v1.0:
<pre class="rectwrap">89*,25*2*5*1+,25*2*5*8+,25*2*5*8+,25*2*5*9+2+,92+4*,48*,96+8*1-,25*2*5*9+2+,25*2*5*9+5+,25*2*5*8+,25*2*5*,92+3*,</pre>
v1.1:
<pre class="rectwrap">33687682798732447976766972|\91+*+,?0=#@|</pre>
v1.2+:
<pre class="rectwrap">"Hello, world!"~|,?0=#@</pre>
===[[99 bottles of beer]]===
v1.0+:
<pre class="rectwrap">91+:*|1-::::::::.48*,92+6*,91+8*1-,91+8*4+:,,91+8*4-,91+7*1-,1=#91+8*3+,]48*,91+8*1-,91+7*,48*,92+6*,91+7*1-:,,91+8*2+,48*,91+8*1-,91+8*2-,48*,91+8*4+,91+7*2+,91+7*1-,48*,91+9*3-,91+6*5+,91+8*4-:,,92+4*,91+,.48*,92+6*,91+8*1-,91+8*4+:,,91+8*4-,91+7*1-,1=#91+8*3+,]48*,91+8*1-,91+7*,48*,92+6*,91+7*1-:,,91+8*2+,92+4*,91+,91+8*4+,91+6*5+,91+7*5+,91+7*1-,48*,91+8*1-,91+8*2-,91+7*1-,48*,91+7*2-,91+8*1-,91+9*3-,91+8*2-,92+4*,48*,91+,91+8*,91+6*5+,91+8*3+:,,48*,91+7*3+,91+8*4+,48*,91+6*5+,91+8*2+,91+8*1-,91+8*5+,91+8*2-,91+7*2-,92+4*,91+,1=#1-.#91+8*2-:,1+,]48*,92+6*,91+8*1-,91+8*4+:,,91+8*4-,91+7*1-,2=#91+8*3+,]48*,91+8*1-,91+7*,48*,92+6*,91+7*1-:,,91+8*2+,48*,91+8*1-,91+8*2-,48*,91+8*4+,91+7*2+,91+7*1-,48*,91+9*3-,91+6*5+,91+8*4-:,,91+4*6+,91+:,,1=#@|</pre>
v1.2+:
<pre class="rectwrap">91+:*|1-:{" bottle"~:~;1=#"s"|" of beer on the wall,"91+~:~;{" bottle"~:~;1=#"s"|" of beer,"91+"Take one down, pass it around,"91+~:~;1-:0=#{#$"No more"|" bottle"~:~;1-1=#"s"|" of beer on the wall."91+:;~|,?1=#@|:1=#<</pre>
===[[Factorial]]===
v1.0+:
<pre class="rectwrap">78\91+*+,85\91+*+,77\91+*+,66\91+*+,69\91+*+,82\91+*+,58\91+*+,48*,^:1`1=#_|:1-:1=#@|*?1=#@|70\91+*+,65\91+*+,67\91+*+,84\91+*+,79\91+*+,82\91+*+,73\91+*+,65\91+*+,76\91+*+,58\91+*+,48*,.</pre>
Raw version (no input prompt, number is hardcoded at beginning of program):
<pre class="rectwrap">5:1`1=#_|:1-:1=#@|*?1=#@|.</pre>
===[[Cat program]]===
v1.2+:
<pre class="rectwrap">&~|,?0=#@</pre>
==External resources==
* [https://github.com/tripl3dogdare/MagiStack Official MagiStack interpreter on GitHub]
[[Category: Languages]]
[[Category: 2015]]
[[Category: Implemented]]
[[Category: Stack-based]]' |
New page wikitext, after the edit (new_wikitext) | ''''MagiStack''' is a [[stack]]-based [[esoteric programming language]] created by [[User:KatrinaKitten|Katrina Scialdone]]. It is based loosely on [[Unefunge]] (a one-dimensional offshoot of [[Befunge]]) and uses some similar or identical commands. It is no longer in development as of version 1.2.
==Commands==
In MagiStack, each character is a command. Any unrecognized characters are ignored. Line breaks and tabs are stripped from the program before execution.<br>
Commands may be clarified in this table by parenthesized pseudocode; each value used from the stack used will be represented by a letter, starting from "a".
{| class="wikitable"
!Command
!Version Added
!Description
|-
|<code>0-9</code>
|v1.0
|Pushes the number's value to the stack
|-
|<code>+</code>
|v1.0
|Pops the top two values from the stack and pushes the sum (a+b)
|-
|<code>-</code>
|v1.0
|Pops the top two values from the stack and pushes the difference (b-a)
|-
|<code>*</code>
|v1.0
|Pops the top two values from the stack and pushes the product (a*b)
|-
|<code>/</code>
|v1.0
|Pops the top two values from the stack and pushes the quotient (b/a)
|-
|<code>%</code>
|v1.0
|Pops the top two values from the stack and pushes the remainder (b%a)
|-
|<code>!</code>
|v1.0
|Pops the top value from the stack and pushes the inverse (!a>0)
|-
|<code>`</code>
|v1.0
|Pops the top two values from the stack and pushes whether (b>a)
|-
|<code>:</code>
|v1.0
|Duplicates the top value from the stack
|-
|<code>\</code>
|v1.0
|Swaps the top two values from the stack
|-
|<code>$</code>
|v1.0
|Pops the top value from the stack and discards it
|-
|<code>.</code>
|v1.0
|Pops the top value from the stack and outputs it as an integer
|-
|<code>,</code>
|v1.0
|Pops the top value from the stack and outputs it as the ASCII character its value represents (in range 0-127)
|-
|<code>=</code>
|v1.0
|Pops the top two values from the stack and skips the next character (Note: includes non-command characters! Be careful!) if they are not equal
|-
|<code>#</code>
|v1.0
|Skips forward to the next occurence of #, |, or ], or the end of the program
|-
|<code>@</code>
|v1.0
|Skips backward to the last occurence of @, |, or ], or the beginning of the program
|-
|<code>]</code>
|v1.0
|Terminates forward skipping (Note: # can be used, but it risks starting an unintended skip, especially with conditionals; | can be used, but is not direction-dependent)
|-
|<code>[</code>
|v1.0
|Terminates backward skipping (Note: @ can be used, but it risks starting an unintended skip, especially with conditionals; | can be used, but is not direction-dependent)
|-
|<code>|</code>
|v1.0
|Terminates skipping in either direction (Note: see #, @, [, and ] to see other options and direction-dependency)
|-
|<code>?</code>
|v1.1
|Pushes the size of the stack onto the stack (i.e. [3,2,1] -> [3,2,1,3])
|-
|<code>^</code>
|v1.1
|Waits for input, then pushes it onto the stack as a signed integer (pushes 0 on invalid input)
|-
|<code>&</code>
|v1.1
|Waits for input, then pushes it onto the stack as ASCII values (pushes each character separately)
|-
|<code>_</code>
|v1.1
|Exits the program
|-
|<code>"</code>
|v1.2
|Enters string mode until the next occurrence of "; while in string mode, each character will be pushed as an ASCII value
|-
|<code>{</code>
|v1.2
|Pops an integer from the stack and pushes each digit in it as an ASCII value
|-
|<code>></code>
|v1.2
|Skips to the final occurrence of |, or to the end of the program
|-
|<code><</code>
|v1.2
|Skips to the first occurrence of |, or to the start of the program
|-
|<code>~</code>
|v1.2
|Reverses the stack (i.e. [3,2,1] -> [1,2,3])
|-
|<code>;</code>
|v1.2
|Pops the bottom value off the stack and pushes it on top (i.e. [3,2,1] -> [2,1,3])
|-
|}
==Computational class==
As MagiStack's memory is only limited by its implementation (rather than by the language itself), it is possible that it is [[Turing-complete]]. However, versions up to v1.1 have been proven to almost certainly not be Turing-complete, and beyond that have not been definitively proven or disproven.
==Examples==
Note that these example programs may not be the most efficient implementation possible (and probably aren't).
===[[Hello, world!]]===
v1.0:
<pre class="rectwrap">89*,25*2*5*1+,25*2*5*8+,25*2*5*8+,25*2*5*9+2+,92+4*,48*,96+8*1-,25*2*5*9+2+,25*2*5*9+5+,25*2*5*8+,25*2*5*,92+3*,</pre>
v1.1:
<pre class="rectwrap">33687682798732447976766972|\91+*+,?0=#@|</pre>
v1.2+:
<pre class="rectwrap">"Hello, world!"~|,?0=#@</pre>
===[[99 bottles of beer]]===
v1.0+:
<pre class="rectwrap">91+:*|1-::::::::.48*,92+6*,91+8*1-,91+8*4+:,,91+8*4-,91+7*1-,1=#91+8*3+,]48*,91+8*1-,91+7*,48*,92+6*,91+7*1-:,,91+8*2+,48*,91+8*1-,91+8*2-,48*,91+8*4+,91+7*2+,91+7*1-,48*,91+9*3-,91+6*5+,91+8*4-:,,92+4*,91+,.48*,92+6*,91+8*1-,91+8*4+:,,91+8*4-,91+7*1-,1=#91+8*3+,]48*,91+8*1-,91+7*,48*,92+6*,91+7*1-:,,91+8*2+,92+4*,91+,91+8*4+,91+6*5+,91+7*5+,91+7*1-,48*,91+8*1-,91+8*2-,91+7*1-,48*,91+7*2-,91+8*1-,91+9*3-,91+8*2-,92+4*,48*,91+,91+8*,91+6*5+,91+8*3+:,,48*,91+7*3+,91+8*4+,48*,91+6*5+,91+8*2+,91+8*1-,91+8*5+,91+8*2-,91+7*2-,92+4*,91+,1=#1-.#91+8*2-:,1+,]48*,92+6*,91+8*1-,91+8*4+:,,91+8*4-,91+7*1-,2=#91+8*3+,]48*,91+8*1-,91+7*,48*,92+6*,91+7*1-:,,91+8*2+,48*,91+8*1-,91+8*2-,48*,91+8*4+,91+7*2+,91+7*1-,48*,91+9*3-,91+6*5+,91+8*4-:,,91+4*6+,91+:,,1=#@|</pre>
v1.2+:
<pre class="rectwrap">91+:*|1-:{" bottle"~:~;1=#"s"|" of beer on the wall,"91+~:~;{" bottle"~:~;1=#"s"|" of beer,"91+"Take one down, pass it around,"91+~:~;1-:0=#{#$"No more"|" bottle"~:~;1-1=#"s"|" of beer on the wall."91+:;~|,?1=#@|:1=#<</pre>
===[[Factorial]]===
v1.0+:
<pre class="rectwrap">78\91+*+,85\91+*+,77\91+*+,66\91+*+,69\91+*+,82\91+*+,58\91+*+,48*,^:1`1=#_|:1-:1=#@|*?1=#@|70\91+*+,65\91+*+,67\91+*+,84\91+*+,79\91+*+,82\91+*+,73\91+*+,65\91+*+,76\91+*+,58\91+*+,48*,.</pre>
Raw version (no input prompt, number is hardcoded at beginning of program):
<pre class="rectwrap">5:1`1=#_|:1-:1=#@|*?1=#@|.</pre>
===[[Cat program]]===
v1.2+:
<pre class="rectwrap">&~|,?0=#@</pre>
==External resources==
* [https://github.com/tripl3dogdare/MagiStack Official MagiStack interpreter on GitHub]
[[Category: Languages]]
[[Category: 2015]]
[[Category: Implemented]]
[[Category: Stack-based]]' |