Zalgo
Zalgo is a stack-based, esoteric programming language developed by User:Short c1rcuit. The language operates on clusters of combining diacritical marks. The language is named after Zalgo text.
Description
A Zalgo program is made of clusters of characters. A cluster consists of 3 parts:
The centre character
The centre character is the character that the diacritics are put on. The centre characters have no instructions which means that they can be any character not in the Combining Diacritical Marks unicode block. Note: whitespace characters are stripped in parsing so any diacritics placed on them will be treated as part of the previous cluster. If there is no previous cluster then they will be ignored. A centre character with no diacritics is ignored.
The top diacritics
The top diacritics are any character in the Combining Diacritical Marks unicode block that appears above the base character. An important thing to consider when writing Zalgo code is that the top diacritics are added from the inside out. However, the interpreter reads the diacritics from top to bottom. Therefore, all of the top diacritics must be added in reverse order of execution.
The bottom diacritics
The bottom diacritics are any character in the Combining Diacritical Marks unicode block that appears below the base character.
Instructions
Top side instructions
Character | Unicode Number | Description |
---|---|---|
◌̀ - ◌̏ |
U+0300 - U+030F |
Represents the hex digits `0 - F`. |
◌͆ |
U+0346 |
Represents the negative symbol. |
◌̐ |
U+0310 |
Pushes the hex value to the stack. If no hex value is given, it will push 0. |
◌̑ |
U+0311 |
Pops the top value off the stack. |
The interpreter treats hex digits that are next to each other as one single hex number.
Bottom side instructions
Character | Unicode Number | Description |
---|---|---|
◌̥ |
U+0325 |
Pops a value off the stack, if it's 0, skip the next cluster. |
◌͍ |
U+034D |
Pops a value off the stack and jumps by that many clusters (positive forward, negative backward). |
This will immediately cause the program to jump and thus any remaining instructions in the cluster will be ignored.
Character | Unicode Number | Description |
---|---|---|
◌̝ |
U+031D |
Pops a value off the stack and prints its Unicode value. |
◌̞ |
U+031E |
Takes the first character from the input buffer and pushes it to the stack |
Input works with a buffer. If the buffer is empty, the user is prompted to input something to set the buffer to before the process continues. All inputs have a null byte added to the end.
Character | Unicode Number | Description |
---|---|---|
◌̟ |
U+031F |
Pops a value off the stack X and another Y, push X+Y. |
◌̠ |
U+0320 |
Pops a value off the stack X and another Y, push Y-X. |
◌͓ |
U+0353 |
Pops a value off the stack X and another Y, push X*Y. |
◌̡ |
U+0321 |
Pops a value off the stack X and another Y, push Y/X (rounded down). |
◌̢ |
U+0322 |
Pops a value off the stack X and another Y, push Y%X. |
Character | Unicode Number | Description |
---|---|---|
◌̭ |
U+032D |
Pops a value off the stack X and another Y, push X∧Y. |
◌̬ |
U+032C |
Pops a value off the stack X and another Y, push X∨Y. |
◌͉ |
U+0349 |
Pops a value off the stack X and inverts the significant bits (throws an error on negatives). |
◌̜ |
U+031C |
Pops a value off the stack X and another Y, push Y << X. |
◌̹ |
U+0339 |
Pops a value off the stack X and another Y, push Y >> X. |
Character | Unicode Number | Description |
---|---|---|
◌̳ |
U+0333 |
Pops a value off the stack X and another Y. Push 1 if X == Y or 0 otherwise. |
◌͕ |
U+0355 |
Pops a value off the stack X and another Y. Push 1 if Y > X or 0 otherwise. |
◌͔ |
U+0354 |
Pops a value off the stack X and another Y. Push 1 if Y < X or 0 otherwise. |
Character | Unicode Number | Description |
---|---|---|
◌͈ |
U+0348 |
Duplicates the top value of the stack. |
◌̙ |
U+0319 |
Pops a value off the stack X and another Y. Cycle the top Y elements of the stack by X (Positive means cycle up, negative means cycle down) |
Examples
Hello, world!
A̝̝̝̝̝̝̝̝̝̝̝̝̝̐̈̄̐̅̆̐̌̆̐̌̆̐̏̆̐̌̂̐̀̂̐̇̇̐̏̆̐̂̇̐̌̆̐̄̆̐́̂
Actually visible version
Top set: ◌̐◌̈◌̄◌̐◌̅◌̆◌̐◌̌◌̆◌̐◌̌◌̆◌̐◌̏◌̆◌̐◌̌◌̂◌̐◌̀◌̂◌̐◌̇◌̇◌̐◌̏◌̆◌̐◌̂◌̇◌̐◌̌◌̆◌̐◌̄◌̆◌̐◌́◌̂ Bottom set: ◌̝◌̝◌̝◌̝◌̝◌̝◌̝◌̝◌̝◌̝◌̝◌̝◌̝
Pushes the characters onto the stack in reverse order then prints them all.
Cat
C̞͈̥a͍̐̂t͍̐̃P̝t͍̐̄͆
Equivalent to:
input, duplicate, if 2, push, jump 3, push, jump print -4, push, jump
String to Number
S̐t̞͈̥r͍̐̂T͍̐̅o̠̐̀̃N̙̐́̐̂u͓̟̐̊m͍̐̆͆#̝̑
Takes in a string representation of a number and outputs it's unicode representation.
Equivalent to:
push input, duplicate, if 2, push, jump 5, push, jump 48, push, sub 2, push, 1, push, cycle 10, push, multiply, add -6, push, jump pop, print
Number to String
#̞̐́N͈u̢̐̊m̟̐̀̃b̙̐́̐̃e̡͈̥̐̊r͍̐̂T͍̐̅o̙̐́̐̂S̟̐́t̙̐́̐̂r͍̐̊͆ȋn̙̐́̐̂g̝#̠͈̥̐́#͍̐̃͆
Takes a character as an input and outputs the unicode number of the character
Equivalent to:
1, push, input dup 10, push, mod 48, push, add 3, push, 1, push, cycle 10, push, div, dup, if 2, push, jump 5, push, jump 2, push, 1, push, cycle 1, push, add 2, push, 1, push, cycle -10, push, jump pop 2, push, 1, push, cycle print 1, push, sub, dup, if 13, push, jump