# qiunx

*This article is not detailed enough and needs to be expanded. Please help us by adding some more information.*

**Qiunx** (pronounced *chunks*, styled as **qiunx**) is a stack-based programming language created in 2024 by squandle. It was designed to be similar to assembly languages.

## Language Overview

qiunx operates on two different data structures: an infinitely long stack, which can hold only integer values; and 26 registers (ax through zx), which can hold string, boolean, and integer values. These registers can be accessed with the mfs (*move from stack*), mts (*move to stack*), and mov (*move*) opcodes, which are explained further in depth in the opcodes section.

## Opcodes

**! NOTE !** not all opcodes are implemented right now.

Opcode | Stack state | Description | Usage example |
---|---|---|---|

Arithmetic | |||

add | a b -- a + b | pops the top two values off the stack, adds them together, and pushes the result to the stack | :100 :4 add (* 104 *) |

sub | a b -- a - b | pops the top two values off the stack, subtracts the second value from the first, and pushes the result to the stack | :32 :12 sub (* 20 *) |

mul | a b -- a * b | pops the top two values off the stack, multiplies them together, and pushes the result to the stack | :10 :10 mul (* 100 *) |

div | a b -- a / b | pops the top two values off the stack, divides the first value by the second value, and pushes the result to the stack | :100 :20 div (* 5 *) |

Stack manipulation | |||

pop | a b -- a | removes the top value from the stack and prints it to STDOUT as an ascii character | :111 pop (* prints "e" *) |

dup | a b -- b b | duplicates the top value from the stack | :10 dup mul (* 100 *) |

:n | N/A | when n is a number, it is pushed to the stack |
:104 (* pushes 104 to the stack *) |

mts r | a b -- b c | pushes the value at register r to the stack |
mov 78 cx mts cx |

Register manipulation | |||

mov n r | a b -- a b | pushes n to register r |
mov 104 ax (* moves 104 to the ax register *) |

mfs r | a b -- a | moves the top value of the stack to register r |
:68 mfs gx (* pushes 68 to the stack, then moves it to the gx register *) |

## Example Programs

### Hello, world!

`:10 :33 :100 :108 :114 :111 :119 :32 :44 :111 :108 :108 :101 :72 pop pop pop pop pop pop pop pop pop pop pop pop pop pop`

as the language evolves, this will as well, but as of now strings and loops do not exist.