Packages
@strict-script/self
The strict-script compiler, written in strict-script.
File of src/ | What it holds |
|---|---|
lexer.sts, parser.sts, ast.sts | A text read into a tree |
types.sts | The types, and when one fits where another is asked for |
prelude.sts | What comes with the language: the methods of arrays, texts, maps, and the functions of the platform |
check/ | The rules: typing, match, errors, mut and ownership, resources, extern |
borrow.sts | Which functions only read a parameter, found from their bodies: what lets a value be lent to be read |
checked.sts | What the checker says of a file, and what is read to write its JavaScript |
emit.sts, emit/ | The JavaScript, the declarations and the source map that are written |
compile.sts | Several files, in the order of their imports |
diagnostic.sts, keys.sts, text.sts | A refusal as a line of text; the key of a node; texts as JavaScript writes them |
The checker, in check/:
| File | What it holds |
|---|---|
check.sts | One file: what it declares, in the order that lets each thing name the others, then the bodies |
state.sts | What the checker knows while it goes through a file, and the names in scope |
shapes.sts | Questions about a type that need nothing of the file |
resolve.sts | A type as it is written, to the type the kernel knows |
infer.sts | What the type parameters of a call stand for |
fitting.sts | Whether a value may stand where it is written |
names.sts | What a name stands for, and what is done with a value that can be changed |
offer.sts | What may be written at one place, for an editor to offer: said by the checker when it gets there |
patterns.sts | What a pattern takes, declares and leaves |
exprs.sts, calls.sts, statements.sts | Expressions, calls and statements, which check each other in a circle |
lib/ is what the compiler wrote for src/. It is kept in the repository, and it is what compiles src/ the
next time: the compiler has no other form. After a change to src/:
pnpm self && pnpm build && pnpm self && pnpm build && pnpm test
A test fails when lib/ is not what the compiler writes for src/ today. Never delete lib/: without it nothing
builds, and it comes back only from the repository (git checkout HEAD -- packages/self/lib). A change to src/
that the compiler in lib/ refuses, or that makes a compiler that does not work, is undone the same way.