CSSC

Control Specified Source Compiling


The IDE

CSSC makes you say where every value lives and when it dies. That is the deal the language offers, and it only pays off if you can see what you said. So that is what the editor is for.

It opens with cssc workspace. It is 3,459 lines of CSSC, which also makes it the first thing I break whenever I get the language wrong.

The CSSC IDE on startup: menu bar, a file tree on the left, and an empty editor pane.

Ownership, both ends at once

Put the cursor anywhere in an allocation's life and both ends light up: the line that made it and the line that frees it. Take the free away and the allocation turns orange. Same file, two states.

A CSSC file where line 5, an auto string allocation named tmp, and line 39, the matching delete, are both highlighted purple.
tmp is made on line 5 and freed on line 39. Both ends marked, thirty-four lines apart.
The same file with the delete for tmp removed. Line 5 is highlighted orange instead of purple.
The same file with that free removed. Line 5 goes orange. No dialog, no list to open.

Autocleanup

F10 reads the file, works out what you allocated and never freed, and writes the frees in for you. Then it tells you exactly what it added.

Four delete and free statements inserted at the end of a CSSC file, highlighted green.
Terminal output reading: autoclean run_all.cssc, inserted 4 frees, listing lines 38 to 41, prevented about 0.01 MB of leaks.
It names every line it touched and what kind of thing it released. The whole window.

The analyzer

F1 puts the analyzer's findings inline and F2 clears them again. It reads ownership, not just syntax, so it catches the things the language actually punishes you for. Here it is telling me that a select cursor is borrowed, that keeping it will leave a stale reference once the loop ends, and what to write instead.

A CSSC function in the IDE with an inline analyzer warning reading: select cursor is borrowed not copied and dies after the block, pass ampersand cursor to keep it.
The rule from the docs, enforced in the editor before anything runs. Click for the whole window.

Watching it run

F5 runs the file on the interpreter. While it runs, the editor marks where the interpreter is: red for the line it is on, blue for what it has already been through.

A running CSSC file where line 9 is highlighted red as the current line and lines 7 and 8 are blue as already executed.

F4 tracks a single variable and logs every value it takes, each with the line that changed it. F3 does it on demand: hover a variable while the program runs and you get its value right now.

Tracking output showing tmp taking the values s, sy, syn and synt, each labelled with line 14.
A string growing one character at a time, with the line responsible for each step.

The language server

Hovering a slot gives you the type and the capacity in bits, which in CSSC is the part you actually need, along with what it was initialized to.

A hover box in the CSSC IDE reading: slot mutier_h, string, 256 bits, init open bracket mutier close bracket.

Completions know the cssc:: builtins and whatever module you loaded. Argument hints show the signature while you are still inside the parentheses.

A completion list after typing cssc colon colon, offering outln, out, alloc, free, peek8, peek16, peek32 and peek64.
An argument hint showing print_str taking an int text and an int owner.

Comments you can color

Comments and block comments take \r()g()b() and the editor renders them live, so a long file can carry structure you can see instead of structure you have to remember. Docstrings work the same way: a //d line under a #define() belongs to the function, the way Python taught me it should.

A CSSC source file where section comments reading VARIABLES, FUNCTIONS and PUBLIC EXPORT are rendered in cyan and DEFINITIONS in magenta.
Section markers in a real file of mine. It sounds like a small thing. It is the reason I stopped losing my place in my own code.

The keys

keywhat it does
F1show the analyzer's hints inline
F2hide every hint, from F1 and F10 both
F3hover a variable for its value at runtime
F4track one variable and log every value it takes
F5run on the interpreter
F6compile
F9introspect a module
F10autocleanup, insert the frees you forgot
F11fullscreen
Ctrl+Rpaste several #req[] into a scope at once
Ctrl+Dthe same for #delete[]

There is a terminal in the window too, which takes CSSC commands like build and run as well as ordinary shell ones.