Page namespace (page_namespace) | 0 |
Page title (without namespace) (page_title) | 'Hanabi' |
Full page title (page_prefixedtitle) | 'Hanabi' |
Old content model (old_content_model) | 'wikitext' |
New content model (new_content_model) | 'wikitext' |
Old page wikitext, before the edit (old_wikitext) | '{{infobox proglang
|name=Hanabi
|author=[[User:Elyatai]]
|paradigms=imperative
|year=[[:Category:2018|2018]]
|majorimpl=[https://github.com/elyatai/hanabi Ruby]
|class=[[:Category:Turing complete|Turing complete]]
|files=<code>.hnb</code>
}}
'''Hanabi''' (pronounced /ˈha.na.bi/) is a stack-based esoteric language written by [[User:Elyatai]], named after the Japanese word for firework, 花火 (hanabi). Each operation is decided by the amount of whitespace on all four sides of the instruction character, <code>.</code>
== Encoding instructions ==
The core of Hanabi is the method of encoding operations. To execute one instruction, the amount of whitespace on each side of the <code>.</code> is counted, and then is translated into an instruction, which is executed. For example:
<pre> #
# . #
#</pre>
In this example, there is no whitespace above the <code>.</code>, 1 to the left, 2 to the right, and 3 below.
<pre> ##
#..#
#
#</pre>
<code>.</code>s can use each other as non-whitespace characters.
If a <code>.</code> doesn't have a non-whitespace character in one of its directions, it is considered a syntax error.
<pre> #
#.
#</pre>
== Execution order ==
The <code>.</code>s are executed left-to-right then top-to-bottom.
<pre> # #
#. .#
#. .#
# #</pre>
In this example, the top-left <code>.</code> is executed first, followed by the top-right, bottom-left, and the bottom-right.
== Instructions ==
{| class="wikitable"
|-
! U !! D !! L !! R !! Instruction
|-
| 0 || <code>n</code> || 0 || 0 || push <code>n</code>
|-
| 0 || <code>n</code> || 0 || 1 || push ASCII codes for number <code>n</code>
|-
| 0 || 0 || 0 || 2 || input one byte
|-
| 0 || 0 || 0 || 3 || input one number
|-
| 0 || 0 || 0 || 4 || input one line
|-
| 0 || 1 || 1 || 0 || push stack length
|-
| 0 || 0 || 1 || 0 || swap top two
|-
| 0 || 0 || 1 || 1 || reverse entire stack
|-
| 0 || 0 || 1 || <code>n≥2</code> || reverse top <code>n</code> items
|-
| 0 || 0 || 2 || 0 || swap top two
|-
| 0 || 0 || 2 || 1 || rotate entire stack upwards
|-
| 0 || 0 || 2 || <code>n≥2</code> || rotate top <code>n</code> items upward
|-
| 0 || 1 || 2 || 0 || swap top two
|-
| 0 || 1 || 2 || 1 || rotate entire stack downwards
|-
| 0 || 1 || 2 || <code>n≥2</code> || rotate top <code>n</code> items downward
|-
| 1 || 0 || 0 || 0 || pop; print as ASCII
|-
| 1 || 1 || 0 || 0 || print entire stack as ASCII
|-
| 1 || <code>c≥2</code> || 0 || 0 || print top <code>c</code> items as ASCII
|-
| 1 || 0 || 0 || 1 || pop; print as number
|-
| 1 || 1 || 0 || 1 || print entire stack as numbers
|-
| 1 || <code>c≥2</code> || 0 || 1 || same as above; <code>c</code> times
|-
| 1 || 0 || 0 || 2 || print a newline
|-
| 1 || 0 || 1 || 0 || pop and throw away
|-
| 1 || 0 || 1 || <code>c</code> || pop and throw away <code>c</code> items
|-
| 1 || 0 || 2 || 0 || clear stack
|-
| 2 || 0 || 0 || 0 || duplicate top item
|-
| 2 || 0 || <code>c</code> || <code>n</code> || duplicate top <code>n</code> items <code>c</code> times
|-
| 2 || 1 || 0 || 0 || <code>==</code>
|-
| 2 || 1 || 1 || 1 || <code>!=</code>
|-
| 2 || 1 || 1 || 0 || <code><</code>
|-
| 2 || 1 || 2 || 0 || <code><=</code>
|-
| 2 || 1 || 0 || 1 || <code>></code>
|-
| 2 || 1 || 0 || 2 || <code>>=</code>
|-
| 2 || 2 || 0 || 0 || addition
|-
| 2 || 2 || 0 || 1 || subtraction
|-
| 2 || 2 || 1 || 0 || multiplication
|-
| 2 || 2 || 1 || 1 || division
|-
| 2 || 2 || 2 || 0 || exponentiation
|-
| 2 || 2 || 2 || 1 || logarithm
|-
| 2 || 2 || <code>n</code> || <code>m</code> || etc
|-
| 2 || 2 || 0 || 2 || modulo
|-
| 2 || 2 || 1 || 2 || integer division
|-
| 2 || 2 || 2 || 2 || divmod
|-
| 2 || 3 || 0 || 0 || pop n; push <code>1</code> if <code>n == 0</code> else <code>0</code> (not)
|-
| 3 || <code>n</code> || 0 || 0 || set label <code>n</code>
|-
| 3 || <code>n</code> || 0 || 1 || pop; go to label <code>n</code> if nonzero
|-
| 3 || <code>n</code> || 1 || 0 || pop; go to label <code>n</code> if zero
|-
| 3 || <code>n</code> || 1 || 1 || go to label <code>n</code>
|}
== Examples ==
=== Hello, world! ===
<pre> ## ## # # ## ## # ##
#..# # # # # #
## # # #
# .....# ... #.............##
# ## # ## #### ## #
#. # # # ##
##.# #. ##.#.# # # #..#
#..# # ...#.## ##. #
# ## #
#.# # ## # #
# # #..## # # #.#..#.#
# # # # # ##
# # ###
#. #.#. #.# #.# #....# # .#.#.#
# # # # #
#
# # # # ## #
# #
#
#</pre>
=== Fibonacci numbers ===
<pre> ## #
#..#
# #
# # # ## #
#.# . #
#.# # # . #. # #. #
# #.## . ##.# . #
# # #
#</pre>
=== Primality testing ===
<pre> ##
#..### # #
#
# # # #
# ...# ... #.. # # #
# #
# # # # #
#.#.# #. ###.# . ##..# . #.## #
# . # ### #
## # # ## # #
## # #. # . # # .# . #.. #
#.# . # . ##.# #.# # .#
# .##.# # # # . ##
# # ##. # # # #
# #</pre>
[[Category:Languages]]
[[Category:2018]]
[[Category:Implemented]]' |
New page wikitext, after the edit (new_wikitext) | '{{infobox proglang
|name=Hanabi
|author=[[User:Ellie]]
|paradigms=imperative
|year=[[:Category:2018|2018]]
|majorimpl=[https://github.com/elyatai/hanabi Ruby]
|class=[[:Category:Turing complete|Turing complete]]
|files=<code>.hnb</code>
}}
'''Hanabi''' (pronounced /ˈha.na.bi/) is a stack-based esoteric language written by [[User:Ellie]], named after the Japanese word for firework, 花火 (hanabi). Each operation is decided by the amount of whitespace on all four sides of the instruction character, <code>.</code>
== Encoding instructions ==
The core of Hanabi is the method of encoding operations. To execute one instruction, the amount of whitespace on each side of the <code>.</code> is counted, and then is translated into an instruction, which is executed. For example:
<pre> #
# . #
#</pre>
In this example, there is no whitespace above the <code>.</code>, 1 to the left, 2 to the right, and 3 below.
<pre> ##
#..#
#
#</pre>
<code>.</code>s can use each other as non-whitespace characters.
If a <code>.</code> doesn't have a non-whitespace character in one of its directions, it is considered a syntax error.
<pre> #
#.
#</pre>
== Execution order ==
The <code>.</code>s are executed left-to-right then top-to-bottom.
<pre> # #
#. .#
#. .#
# #</pre>
In this example, the top-left <code>.</code> is executed first, followed by the top-right, bottom-left, and the bottom-right.
== Instructions ==
{| class="wikitable"
|-
! U !! D !! L !! R !! Instruction
|-
| 0 || <code>n</code> || 0 || 0 || push <code>n</code>
|-
| 0 || <code>n</code> || 0 || 1 || push ASCII codes for number <code>n</code>
|-
| 0 || 0 || 0 || 2 || input one byte
|-
| 0 || 0 || 0 || 3 || input one number
|-
| 0 || 0 || 0 || 4 || input one line
|-
| 0 || 1 || 1 || 0 || push stack length
|-
| 0 || 0 || 1 || 0 || swap top two
|-
| 0 || 0 || 1 || 1 || reverse entire stack
|-
| 0 || 0 || 1 || <code>n≥2</code> || reverse top <code>n</code> items
|-
| 0 || 0 || 2 || 0 || swap top two
|-
| 0 || 0 || 2 || 1 || rotate entire stack upwards
|-
| 0 || 0 || 2 || <code>n≥2</code> || rotate top <code>n</code> items upward
|-
| 0 || 1 || 2 || 0 || swap top two
|-
| 0 || 1 || 2 || 1 || rotate entire stack downwards
|-
| 0 || 1 || 2 || <code>n≥2</code> || rotate top <code>n</code> items downward
|-
| 1 || 0 || 0 || 0 || pop; print as ASCII
|-
| 1 || 1 || 0 || 0 || print entire stack as ASCII
|-
| 1 || <code>c≥2</code> || 0 || 0 || print top <code>c</code> items as ASCII
|-
| 1 || 0 || 0 || 1 || pop; print as number
|-
| 1 || 1 || 0 || 1 || print entire stack as numbers
|-
| 1 || <code>c≥2</code> || 0 || 1 || same as above; <code>c</code> times
|-
| 1 || 0 || 0 || 2 || print a newline
|-
| 1 || 0 || 1 || 0 || pop and throw away
|-
| 1 || 0 || 1 || <code>c</code> || pop and throw away <code>c</code> items
|-
| 1 || 0 || 2 || 0 || clear stack
|-
| 2 || 0 || 0 || 0 || duplicate top item
|-
| 2 || 0 || <code>c</code> || <code>n</code> || duplicate top <code>n</code> items <code>c</code> times
|-
| 2 || 1 || 0 || 0 || <code>==</code>
|-
| 2 || 1 || 1 || 1 || <code>!=</code>
|-
| 2 || 1 || 1 || 0 || <code><</code>
|-
| 2 || 1 || 2 || 0 || <code><=</code>
|-
| 2 || 1 || 0 || 1 || <code>></code>
|-
| 2 || 1 || 0 || 2 || <code>>=</code>
|-
| 2 || 2 || 0 || 0 || addition
|-
| 2 || 2 || 0 || 1 || subtraction
|-
| 2 || 2 || 1 || 0 || multiplication
|-
| 2 || 2 || 1 || 1 || division
|-
| 2 || 2 || 2 || 0 || exponentiation
|-
| 2 || 2 || 2 || 1 || logarithm
|-
| 2 || 2 || <code>n</code> || <code>m</code> || etc
|-
| 2 || 2 || 0 || 2 || modulo
|-
| 2 || 2 || 1 || 2 || integer division
|-
| 2 || 2 || 2 || 2 || divmod
|-
| 2 || 3 || 0 || 0 || pop n; push <code>1</code> if <code>n == 0</code> else <code>0</code> (not)
|-
| 3 || <code>n</code> || 0 || 0 || set label <code>n</code>
|-
| 3 || <code>n</code> || 0 || 1 || pop; go to label <code>n</code> if nonzero
|-
| 3 || <code>n</code> || 1 || 0 || pop; go to label <code>n</code> if zero
|-
| 3 || <code>n</code> || 1 || 1 || go to label <code>n</code>
|}
== Examples ==
=== Hello, world! ===
<pre> ## ## # # ## ## # ##
#..# # # # # #
## # # #
# .....# ... #.............##
# ## # ## #### ## #
#. # # # ##
##.# #. ##.#.# # # #..#
#..# # ...#.## ##. #
# ## #
#.# # ## # #
# # #..## # # #.#..#.#
# # # # # ##
# # ###
#. #.#. #.# #.# #....# # .#.#.#
# # # # #
#
# # # # ## #
# #
#
#</pre>
=== Fibonacci numbers ===
<pre> ## #
#..#
# #
# # # ## #
#.# . #
#.# # # . #. # #. #
# #.## . ##.# . #
# # #
#</pre>
=== Primality testing ===
<pre> ##
#..### # #
#
# # # #
# ...# ... #.. # # #
# #
# # # # #
#.#.# #. ###.# . ##..# . #.## #
# . # ### #
## # # ## # #
## # #. # . # # .# . #.. #
#.# . # . ##.# #.# # .#
# .##.# # # # . ##
# # ##. # # # #
# #</pre>
[[Category:Languages]]
[[Category:2018]]
[[Category:Implemented]]' |
Unified diff of changes made by edit (edit_diff) | '@@ -1,5 +1,5 @@
{{infobox proglang
|name=Hanabi
-|author=[[User:Elyatai]]
+|author=[[User:Ellie]]
|paradigms=imperative
|year=[[:Category:2018|2018]]
@@ -9,5 +9,5 @@
}}
-'''Hanabi''' (pronounced /ˈha.na.bi/) is a stack-based esoteric language written by [[User:Elyatai]], named after the Japanese word for firework, 花火 (hanabi). Each operation is decided by the amount of whitespace on all four sides of the instruction character, <code>.</code>
+'''Hanabi''' (pronounced /ˈha.na.bi/) is a stack-based esoteric language written by [[User:Ellie]], named after the Japanese word for firework, 花火 (hanabi). Each operation is decided by the amount of whitespace on all four sides of the instruction character, <code>.</code>
== Encoding instructions ==
' |
Lines added in edit (added_lines) | [
0 => '|author=[[User:Ellie]]',
1 => ''''Hanabi''' (pronounced /ˈha.na.bi/) is a stack-based esoteric language written by [[User:Ellie]], named after the Japanese word for firework, 花火 (hanabi). Each operation is decided by the amount of whitespace on all four sides of the instruction character, <code>.</code>'
] |