Given an input of any valid Glypho program, output its "human-readable" counterpart.
Glypho is an interesting esolang idea:
The instruction reference is given here. For each instruction, the characters abcd represent the symbols composing each instruction. a refers to the first unique symbol, b refers to the second unique symbol, etc.
aaaa ..... n NOP - no operation; do nothing aaab ..... i Input - push input onto top of stack aaba ..... > Rot - pops top stack element and pushes to bottom of stack aabb ..... \ Swap - swaps top two stack elements aabc ..... 1 Push - pushes a 1 onto the top of stack (creates new element) abaa ..... < RRot - pops bottom element and pushes to top of stack abab ..... d Dup - Duplicates top stack element abac ..... + Add - pops top two elements and pushes their sum abba ..... [ L-brace - skip to matching ] if top stack element is 0 abbb ..... o Output - pops and outputs top stack element abbc ..... * Multiply - pops top two elements and pushes their product abca ..... e Execute - Pops four elements and interprets them as an instruction abcb ..... - Negate - pops value from stack, pushes -(value) abcc ..... ! Pop - pops and discards top stack element abcd ..... ] R-brace - skip back to matching [
(credit: Brian Thompson aka Wildhalcyon)
So, for example,
PPCG would represent the Push instruction—
The input will be a single string consisting of only printable ASCII characters. It will always have a length divisible by four (duh).
The output is each group of four characters in the input string replaced by which instruction they designate. Use the single-letter instruction names (the ones right after the five dots in the table quoted above).
Since this is code-golf, the shortest code in bytes will win.
In Out ------------------------------------------------ Programming Puzzles & Code Golof ]!]!]]]+ nananananananana batman! dddd]] ;;;;;;;:;;:;;;:: ni>\ llamas sleep 1-* 8488133190003453 <[oe <empty string> <empty string>