This is an interpreter for Pikachu for Python 2.7.x
The definition of the esoteric programming language named 'pikachu' can be found here. This is built as a cleaner version of https://github.com/joelsmithjohnson/pikachu-interpreter.
-
Run
$ pip install pikapy
-
Go to your Sublime Packages folder, which defaults to
~/Library/Application Support/Sublime Text 3/Packages
on Mac OSX and -
In the same Packages folder, find
Color Scheme - Default
, and copypikachu.sublime-color-scheme
there. -
In Sublime Text, go to Preferences → Color Scheme, and select Pikachu.
In the command line, go to the installation directory, and run:
$ pikachu <pikachu filename> [arguments*]
In Pikachu, you have two Pikachus (i.e. stacks): pi pikachu
and pika pikachu
. Upon starting a Pikachu script, the arguments are pushed into pi pikachu
in the order they're given.
pi pika <PIKACHU>
- add the top two values in the given Pikachu, and push the sum to the same Pikachupika pi <PIKACHU>
- subtract the top value in the Pikachu from the second top, then push the differencepi pikachu <PIKACHU>
- multiply the top two values in the Pikachu, and push the productpikachu <PIKACHU>
- divide the second-from-the-top value in the Pikachu by the top value, then push the product
pika pikachu <PIKACHU>
- pop the top value from the Pikachu, and print as a numberpikachu pikachu <PIKACHU>
- pop the top value from the Pikachu, and print as ASCII<PIKACHU>
- pop the top value from the Pikachu<n terms> <PIKACHU>
- pushn
into the PIkachu<pi pika>
- push the top value ofpika pikachu
intopi pikachu
<pika pi>
- push the top value ofpi pikachu
intopika pikachu
pikachu pikachu
- if the top values of both Pikachus are equal, goto linen
, wheren
is the number of terms in the following linepika pika
- if the top values of both Pikachus are not equal, goto linen
, wheren
is the number of terms in the following line
Note: Pikachus start counting lines from 1, not 0
pi pi
- push topika pikachu
a random number between1
andn
, wheren
is the top value inpika pikachu
chu
- anything that comes after achu
, is treated as a comment, and will be ignored by the interpreter. This includes any line beginning with the wordchu
.
Note: Things in this section are not part of the original definition of the language, rather features added for the convenience of the programming Pikachus