commit bdb8ffd

0uppy  ·  2026-09-10 18:09:58 +0000 UTC
parent f580ee4
docs - updated the docs to be up-to-date with cotton's new direction :P
2 files changed,  +44, -60
+38, -39
 1@@ -1,52 +1,51 @@
 2-.Dd July 2026
 3+.Dd September 2026
 4 .Dt COT 5
 5-.Os cotton 0.2
 6+.Os cotton 0.1
 7 .Sh NAME
 8 .Nm cot
 9 .Nd the cot programming language
10 
11 .Sh DESCRIPTION
12 
13-cot is a small (both in size and features) interpreted programming language made
14-to be simple, easily readable, approachable and to be used FOR cotton(1).
15-
16-cot's development is being made side by side with cotton's development, as such,
17-both are built with eachother in mind.
18-
19-cotton's keywords are called "commands" , below is a reference list of every command
20-in cot (as of cotton 0.2) and how to use it properly.
21-
22-.Sh COMMANDS
23-.Bl -tag -width "pixel Ar (x) (y) (color)"
24-.It Ic print Ar (text)
25-Prints text to the screen.
26-.It Ic wait Ar (seconds)
27-Waits for an x ammount of seconds.
28-.It Ic kill
29-Kills the ongoing cotton process.
30-.It Ic color Ar (color)
31-Colors text (there are 7 options, which can be seen in cotton.h!! i'd list them here but blehhh).
32-.It Ic var Ar (name) (value)
33-Assigns a value to a variable.
34-.It Ic add Ar (var) (value)
35-Adds a value to a variable.
36-.It Ic sub Ar (var) (value)
37-Subtracts a value from a variable.
38-.It Ic mult Ar (var) (value)
39-Multiplies a variable by a value.
40-.It Ic div Ar (var) (value)
41-Divides a variable by a value.
42-.It Ic pixel Ar (x) (y) (color)
43-Draws a pixel at the specified coordinates (this will be probably be a bit adjusted in the future).
44-.It Ic clear
45-Clears whatever is currently on the screen.
46-.It Ic input Ar (var)
47-Waits for user input and stores it in a variable.
48+cot is a small (both in size and features) general-purpose stack concatenative 
49+programming language 
50+
51+cot's development is being made side by side with cotton's development, as such, one keeps
52+the other in mind
53+
54+cotton has two types of keywords: builtins and immediates
55+
56+.Bl -tag -width "Immediates"
57+.It Builtins
58+Words that are executed at runtime that directly manipulate the data stack or the memory (such as +, -, dup, swap, ->, @, etc.).
59+.It Immediates
60+Words processed at compile time to handle control flow and the program's structure (such as if, else, end, etc.).
61+.El
62+
63+.Sh WORDS
64+.Bl -tag -width "-> (slot)"
65+.It Ic + , - , * , /
66+Pops two values, performs arithmetic, and pushes the result.
67+.It Ic dup
68+Duplicates the top value on the stack.
69+.It Ic swap
70+Swaps the top two values on the stack.
71+.It Ic drop
72+Discards/drops the top value on the stack.
73+.It Ic ->
74+Pops a value and a slot index, then stores the value in that same variable slot.
75+.It Ic @
76+Pops a slot index and pushes the stored value back onto the stack.
77+.It Ic ? if
78+Pops a value, if it's not zero, then it executes the block after it.
79+.It Ic else
80+Executes if the prior if evaluated to zero.
81+.It Ic end
82+Closes an if or else block.
83 .El
84 
85 NOTE: some of the commands 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;
86 
87 .Sh SEE ALSO
88-.Xr cotton 1 ,
89-.Xr eiki 5
90+.Xr cotton 1
91 
+6, -21
 1@@ -1,36 +1,21 @@
 2-.Dd July 2026
 3+.Dd September 2026
 4 .Dt COTTON 1
 5 .Os cotton 0.2
 6 .Sh NAME
 7 .Nm cotton
 8-.Nd a tiny virtual computer that lives in your windows
 9+.Nd a tiny stack machine for the cot programming language 
10 
11 .Sh SYNOPSIS
12 .Nm
13-.Op Fl s Ar scale
14 .Ar file.cot
15 
16 .Sh DESCRIPTION
17 
18-cotton is a tiny virtual computer that lives in a window. It has 64 KiB of memory
19-and runs programs written in the cot(5) programming language.
20+cotton is a small stack machine for the cot(5) programming language (inspired by Lua, Forth and Uxntal) written in C99
21 
22-cotton was originally based on a CHIP-8 emulator, but has since evolved into its
23-own thing inspired by uxn (go check it out, its an amazing project!!) and the concept of
24-a small, easy-to-understand virtual computer.
25-
26-cotton is a passion pet project and while i do get alot of suggestions via my friends,
27-i am the only and main developer of it, so, don't expect anything grandiouse or of perfect quality,
28-at the end of the day this is all a big learning project that im taking at my own pace!! xP
29-
30-.Sh OPTIONS
31-.Bl -tag -width "-s Ar scale"
32-.It Fl s Ar (scale)
33-changes the size multiplier of the cotton window (as of cotton 0.2 there is only 2 or 4).
34-.El
35+as of now it only compiles cot programs, but, i do intend to add the option to compile cot programs to uxntal in the future :P
36 
37 .Sh SEE ALSO
38-.Xr cot 5 ,
39-.Xr eiki 5 ,
40-.Xr eikimaker 1
41+.Xr cot 5
42+
43