raz / commit d4dcb2c2

commit
d4dcb2c2ebff22ed7b040bba4611383aef34058e
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
e45675ff
CLAUDE.md: how to build, check and work on jed, and where it stands

patch · log

1 file changed, +72 -0

CLAUDE.md added +72 -0

@@ -0,0 +1,72 @@
1+# Working on jed
2+
3+Read `PLAN.md` (the plan, ground rules, steps) and `doc/jed.md` (the
4+language report) first. The report defines the language; where the
5+plan disagrees, the report wins and the plan is fixed.
6+
7+## Setup and checks
8+
9+ apt-get install -y fp-compiler # Free Pascal 3.2.2, if fpc is missing
10+ make jed # the compiler, ./jed; its library is lib/
11+ make check # every example and test against its expected output
12+ make bench # must report at least 400,000 lines a second
13+ make loc # lines of the compiler; the code column is the budget
14+ make tests # the small Pascal tests of scan, x64, link and elf
15+
16+`make check` must pass before every commit. Tests: `test/run/X.jed`
17+with `X.expect` (stdout), optional `X.status` and `X.args`; modules they
18+import in `test/run/mods`. `test/err/X.jed` must fail to compile with
19+the text in `X.err`. Examples in `examples/` work the same way.
20+
21+## How we work
22+
23+- Work goes stage by stage. A stage starts only on the owner's explicit
24+ go-ahead; within it, one commit per step, pushed as it is done, then
25+ stop for review. Never start a stage, or change the report's
26+ language, without being asked.
27+- Language changes go into `doc/jed.md` first, for the owner to review,
28+ before any code.
29+- Commits: author `Luis <42945842+ldiaz94@users.noreply.github.com>`, unsigned
30+ (`--no-gpg-sign`), no attribution trailer. Push to `main`. No pull
31+ requests unless asked.
32+- Budget: about 5,000 lines of code (blank and comment lines not
33+ counted), within 10%; at least 400,000 lines of jed a second.
34+- Style: clarity over cleverness; each unit opens with what it is, what
35+ it depends on and what it leaves out; comments say why. Match the
36+ report's plain, short prose in documentation.
37+
38+## Where things stand
39+
40+Stages 1 and 2 are done (steps 1-10). Next is stage 3 (steps 11-14),
41+waiting for a go-ahead. Its first task is to write into the report, for
42+review: `F32` and untyped real literals, `extern var`, `link static`,
43+`Rt.exit` and `Rt.atExit`, and how to mix `Out` with C's `stdio` (flush
44+one before using the other). Unions are not added: the report shows
45+reading a C union as an array of words through pointer conversions.
46+
47+## Readings of the report already taken
48+
49+These are how the compiler behaves; keep them unless the owner says
50+otherwise.
51+
52+- A named and an anonymous type built alike are the same; `type A = B`
53+ is an alias. A hex literal above high(I64) is a `U64`.
54+- `p^.f` and `p^[i]` are explicit; `p[i]` on a pointer to an array is
55+ an error. A statement starts with a name, so `^T(x)^ := v` isn't one.
56+- No `BOOL` to integer conversion (left out until needed).
57+- `for`: the step is a constant; the loop never steps past the limit, so
58+ it can't wrap; afterwards the variable holds the last value it took;
59+ the body may assign it. Leave as is.
60+- Several results come back through a hidden pointer; a code procedure
61+ returns two in rax and rdx.
62+- `NEW(p, a)` requires `a: ^Mem.Allocator` and calls its `alloc` field:
63+ the one library type the compiler knows by name. `Rt.fail` and
64+ `Rt.eq` are found by name too.
65+- A set literal takes its type from its first name when nothing else
66+ gives it; `{}` needs a known type. String constants can be indexed
67+ and sliced.
68+- A deferred statement's frame slots stay reserved for the rest of its
69+ procedure.
70+- Every failed check says "index out of range"; some errors point at
71+ the symbol after the offending expression. Error messages are to be
72+ improved later, all together.