Here are the syntax and language rules for the Pikachu programming language explained in the human language of English:
- There are only 3 syntax elements –
pi
,pika
andpikachu
. Repeating the same syntax element 3 times in a row is not allowed. - Pikachu makes use of 2 pikachus(stacks) – Pi Pikachu and Pika Pikachu.
If a line ends with pi pikachu
or pika pikachu
, perform operations on that specified pikachu based on the commands preceding it:
pi pika
Add the top element of the pikachu to the next top element, and push the result on to the pikachupika pi
Subtract the top element of the pikachu from the next top element, and push the result on to the pikachupi pikachu
Multiply the top element of the pikachu to the next top element, and push the result on to the pikachupikachu
Divide the second top element of the pikachu by the top element, and push the result on to the pikachupika pikachu
Pop the value on top of the pikachu and print it.pikachu pikachu
Pop the value on top of the pikachu and print its equivalent ASCII character.- *blank*
Pop the value on top of the pikachu. - *n number of terms*
Push the number of terms – n – on to the pikachu. Make sure that no syntax elementpi
,pika
orpikachu
is repeated 3 times in a row.
The following 4 commands operate on both the pi pikachu
and the pika pikachu
. Therefore, these lines also don’t need to end with the name of an individual pikachu:
pi pika
Copy the top ofpi pikachu
topika pikachu
.pika pi
Copy the top ofpika pikachu
topi pikachu
.pikachu pikachu
If the top ofpi pikachu
andpika pikachu
are equal, go to line number n, where n is the number of terms in the immediate next line.pika pika
If the top ofpi pikachu
andpika pikachu
are inequal, go to line number n, where n is the number of terms in the immediate next line.
Note : Inputs are initially added to pi pikachu
. To specify multiple inputs, separate them by spaces. The first input will be pushed on to pi pikachu
first, followed by the second, and so on.
Division and Subtraction seem to have the same commands. I have managed to do subtraction successfully and I suppose you can just subtract iteratively to emulate division but I can not get simple division to work. Has anyone had any luck with this?
That was a mistake. The division is actually “pikachu”. Thanks for pointing it out, it’s corrected now!