main soggy/cotton / docs / cot.5
COT(5) File Formats Manual COT(5)

cotthe cot programming language

cot is a small (both in size and features) general-purpose stack concatenative programming language

cot's development is being made side by side with cotton's development, as such, one keeps the other in mind

in cot, "words" are refered to as cogs - as such, there are two types of cogs:

Cogs
Hardcoded words into cot, so, words that already come with base cot
UCogs
Words that are defined by the user, so, words that do not come with cot by default and that the user must make themselves (as of cot 0.1 this isn't possible YET, however, it is smth i want to implement in the near future)

cot also has two types of keywords (or, keycogs): builtins and immediates

Builtins
Words that are executed at runtime that directly manipulate the data stack or the memory (such as +, -, dup, swap, ->, @, etc.)
Immediates
Words processed at compile time to handle control flow and the program's structure (such as if, else, end, etc.)

, -, *, /, %
Pops two values, performs arithmetic, and pushes the result
Comments out a line, currently there isn't any multiline support,, sowe,,
Duplicates the top value on the stack
Swaps the top two values on the stack
Discards/drops the top value on the stack
Pops three values, rotates them around, so, the top-most value goes to the bottom and the latter two go up
Pops a value and a slot index, then stores the value in that same variable slot
Pops a slot index and pushes the stored value back onto the stack
Prints a number
Prints a string
Meant to be used alongside .s, makes strings print in a new line
? if
Pops a value, if it's not zero, then it executes the block after it
Executes if the prior if evaluated to zero
Closes an if or else block
Starts a loop
Jumps back to it's correspondent loop statement while the condition is false, then it falls through once the condition is true

NOTE: some of the cogs above are subject to change given that cot(ton) has yet to reach it's first stable release - even then, any update to any command will be doccumented here and i will also do my best to not break the whole syntax every update ;w;

cotton(1)

September 2026 cotton 0.1