| COT(5) | File Formats Manual | COT(5) |
NAME
cot — the cot
programming language
DESCRIPTION
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 - that is, words that already come with base cot
- UCogs
- Words that are defined by the user - that is, words that do not come with
cot by default and that the user must make/define 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 "keycogs" (keywords): builtins and immediates
- Builtins
- Cogs that are executed at runtime and that directly manipulate the data stack or the memory (like +, -, dup, swap, ->, @, etc.)
- Immediates
- Cogs that are processed at compile time to handle the control flow and the program's structure (like if, else, end, etc.)
COGS
+,-,*,/, %- Pops two values, does arithmetic, and pushes the result
--- Comments out a line, currently there isn't any multiline support,, sowwe,, >.<
dup- Duplicates the top value on the stack
swap- Swaps the top two values on the stack
drop- Discards/drops the top value on the stack
rot- 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
.n- Prints a number
.s- Prints a string
nl- Meant to be used alongside .n and .s, makes numbers and strings print in a new line
- ?
if - Pops a value, if it's not zero, then it executes the block after it
else- Runs if the prior if statement evaluated to zero
end- Closes an if / else block
loop- Starts a loop
until- Jumps back to the loop statement that called it so long as 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;
SEE ALSO
| September 2026 | cotton 0.1 |