commit cdc2654

soggy  ·  2026-10-11 22:25:56 +0000 UTC
parent 3fd2d11
cotton & docs - changed the name of a few files (again) and also updated the docs a little bit
8 files changed,  +33, -33
+11, -11
 1@@ -17,25 +17,25 @@ in cot, "words" are refered to as cogs - as such, there are two types of cogs:
 2 
 3 .Bl -tag -width "Cogs" 
 4 .It Cogs
 5-Hardcoded words into cot, so, words that already come with base cot
 6+Hardcoded words into cot - that is, words that already come with base cot
 7 .It UCogs 
 8-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)
 9+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)
10 
11-cot also has two types of keywords (or, keycogs): builtins and immediates
12+cot also has two types of "keycogs" (keywords): builtins and immediates
13 
14 .Bl -tag -width "Immediates"
15 .It Builtins
16-Words that are executed at runtime that directly manipulate the data stack or the memory (such as +, -, dup, swap, ->, @, etc.)
17+Cogs that are executed at runtime and that directly manipulate the data stack or the memory (like +, -, dup, swap, ->, @, etc.)
18 .It Immediates
19-Words processed at compile time to handle control flow and the program's structure (such as if, else, end, etc.)
20+Cogs that are processed at compile time to handle the control flow and the program's structure (like if, else, end, etc.)
21 .El
22 
23 .Sh COGS
24 .Bl -tag -width "-> (slot)"
25 .It Ic + , - , * , /, %
26-Pops two values, performs arithmetic, and pushes the result
27+Pops two values, does arithmetic, and pushes the result
28 .It Ic --
29-Comments out a line, currently there isn't any multiline support,, sowe,,
30+Comments out a line, currently there isn't any multiline support,, sowwe,, >.<
31 .It Ic dup
32 Duplicates the top value on the stack
33 .It Ic swap
34@@ -53,17 +53,17 @@ Prints a number
35 .It Ic .s
36 Prints a string 
37 .It Ic nl
38-Meant to be used alongside .s, makes strings print in a new line 
39+Meant to be used alongside .n and .s, makes numbers and strings print in a new line 
40 .It Ic ? if
41 Pops a value, if it's not zero, then it executes the block after it
42 .It Ic else
43-Executes if the prior if evaluated to zero
44+Runs if the prior if statement evaluated to zero
45 .It Ic end
46-Closes an if or else block
47+Closes an if / else block
48 .It Ic loop
49 Starts a loop
50 .It Ic until
51-Jumps back to it's correspondent loop statement while the condition is false, then it falls through once the condition is true
52+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
53 .El
54 
55 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;
+12, -12
 1@@ -18,22 +18,22 @@ cotton's internals consist of 7 files (as of cotton 0.1) which are:
 2 .Ss src/
 3 .Bl -tag -width "main.c"
 4 .It main.c
 5-This file reads each .cot file line by line and then hands each read line to the loom, then, it returns the results
 6+Reads each .cot file from head to toe and then hands each read line to the loom, then, it returns the results
 7 .It Ic cotton.c
 8-This file handles the core operations of cotton: initializing state, and, pushing and popping the stack
 9+Handles the core operations of cotton: initializing the state, and, pushing and popping the stack
10 .It Ic cotton.h 
11-This file has the Cotton struct, contains the cog types, opcode definitions and the specs for Cotton
12-.It Ic weave.c
13-This file has the cogs, so, the builtin and runtime keycogs
14-.It Ic weave.h 
15-This file declares the keycogs so they can be used elsewhere inside of Cotton
16-.It Ic loom.c
17-This file is for the compiler and the runtime for Cotton
18-.It Ic loom.h
19-This file is where cotton_compile and cotton_run are declared to be used in loom.c
20+Has the Cotton struct, contains the cog types, opcode definitions and the specs for Cotton
21+.It Ic cogs.c
22+Has the builtin and runtime keycogs
23+.It Ic cogs.h 
24+Declares the keycogs so they can be used elsewhere inside of Cotton
25+.It Ic interpreter.c
26+For the compiler and the runtime for Cotton
27+.It Ic interpreter.h
28+Where cotton_compile and cotton_run are declared to be used in loom.c
29 .El
30 
31-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
32+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 (IF i ever figure that out and IF i still have that goal by then) :P
33 
34 .Sh SEE ALSO
35 .Xr cot 5
+2, -2
 1@@ -5,8 +5,8 @@ project('cotton', 'c',
 2 src_files = [
 3   'src/main.c',
 4   'src/cotton.c',
 5-  'src/loom.c',
 6-  'src/weave.c',
 7+  'src/interpreter.c',
 8+  'src/cogs.c',
 9 ]
10 
11 executable('cotton', src_files)
R src/weave.c => src/cogs.c
+1, -1
1@@ -1,4 +1,4 @@
2-#include "weave.h"
3+#include "interpreter.h"
4 #include "cotton.h"
5 #include <stdio.h>
6 
R src/weave.h => src/cogs.h
+2, -2
1@@ -1,5 +1,5 @@
2-#ifndef WEAVE_H
3-#define WEAVE_H
4+#ifndef COGS_H
5+#define COGS_H
6 
7 #include "cotton.h"
8 
R src/loom.c => src/interpreter.c
+2, -2
 1@@ -4,8 +4,8 @@ ooooo get off your ass dani ooooo go work ooooo dani you're a bum oooooo oooooo
 2 // FUTURE DANI HERE !!! I DID IT !!! I GOT OFF MY LAZY ASS !!! RAGHHHHHHHHHHHHHH
 3 
 4 #include "cotton.h"
 5-#include "loom.h"
 6-#include "weave.h"
 7+#include "interpreter.h"
 8+#include "cogs.h"
 9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
R src/loom.h => src/interpreter.h
+2, -2
1@@ -1,5 +1,5 @@
2-#ifndef LOOM_H
3-#define LOOM_H
4+#ifndef INTERPRETER_H
5+#define INTERPRETER_H
6 
7 #include "cotton.h"
8 
+1, -1
1@@ -1,5 +1,5 @@
2 #include "cotton.h"
3-#include "loom.h"
4+#include "interpreter.h"
5 #include <stdio.h>
6 
7 int main