| | @@ -5,177 +5,16 @@ |
| 5 | 5 | stopping for the owner's review. A finished milestone is cut from this |
| 6 | 6 | file: git keeps the history, and the report's section 12 the language's. |
| 7 | 7 | |
| 8 | | -## v0.5.0: the library, then the freeze |
| 9 | | - |
| 10 | | -**For:** a library with which raz can do most of what the programs in |
| 11 | | -`~/lib` do, concha included: files, processes and job control, |
| 12 | | -signals, time, sockets, and the few routines every program ends up |
| 13 | | -writing for itself. Then the language is frozen, softly, so that the |
| 14 | | -editors, rat and rlX11, and the book, have a fixed target. |
| 15 | | - |
| 16 | | -**Done when:** report 2026-10.9 is all in the library; `examples/Sh.raz`, |
| 17 | | -a small shell, runs its test; rat, rlX11, rmacs and ravite build with |
| 18 | | -it; the freeze is written down; `v0.5.0` is tagged. |
| 19 | | - |
| 20 | | -**Kept out, on purpose:** what `~/lib` keeps as libraries over the |
| 21 | | -system, written later in raz over `Sys`: DNS, TLS, time zones, JSON, |
| 22 | | -regular expressions, compression. Also `umask`, resource limits, user |
| 23 | | -ids, `exec` without a fork, `ioctl` and UDP sockets that aren't |
| 24 | | -connected: `SYSCALL` reaches them, and each comes in when a second |
| 25 | | -program needs it. The compiler doesn't change. |
| 26 | | - |
| 27 | | -Every `Sys` export is written twice, in `Sys.linux-x86_64.raz` and in |
| 28 | | -`Sys.raz` over the C library, and tested through both (`test/libc`). |
| 29 | | - |
| 30 | | -- [x] 1. The report, version 2026-10.9: every new and changed export of |
| 31 | | - `Sys`, `Str`, `Map`, `Sort`, `Math` and `Fmt` (section 11), for |
| 32 | | - review before any code. |
| 33 | | -- [x] 2. `Sys`, files: `open` with a set of `Access`, `seek`, `Info`'s |
| 34 | | - `mtime` and `mode`, `chmod`, `readLink`, `symlink`, `removeDir`, |
| 35 | | - `setWorkDir`. |
| 36 | | -- [x] 3. `Sys`, programs: `pipe`, `spawn` of a `Program`, `wait` of any |
| 37 | | - child with its `Status`, process groups and the terminal's |
| 38 | | - foreground, `pid`; signals caught on a file descriptor. Rat |
| 39 | | - breaks here: `spawn` changes. |
| 40 | | -- [x] 4. `Sys`, the rest: `clock`, `now`, `sleep`, `random`; |
| 41 | | - `connectTcp`, `connectUdp`, `listen`, `listenTcp`, `accept`. |
| 42 | | -- [x] 5. `Str.encode`, `Str.decode`, `Str.toInt`; `Map.remove` and |
| 43 | | - `Map.next`; `Sort`; `Math`; `Fmt.real`. Each module's `main` |
| 44 | | - tests it. |
| 45 | | -- [x] 5a. Asked for rloc, and every program after it: `Opt`, a |
| 46 | | - command line read through one table, after `~/lib/getopt`. |
| 47 | | - getopt(3)'s rules with GNU's long options (`-lw`, `-b dev`, |
| 48 | | - `--bar=dev`, `--`); the usage line and a sentence for every |
| 49 | | - mistake made from the table, so they can't drift from it; |
| 50 | | - `-h` and `--help` answered; no global state. `Files` moves from |
| 51 | | - `tools` to the library, and `Opt` reads its words with |
| 52 | | - `Files.arg`. The report first, for review; then the module, |
| 53 | | - its test in its `main`, and `Doc`, `Pretty` and `Mutate` on it. |
| 54 | | - Kept out: concha's completion from the table, until asked. |
| 55 | | -- [x] 6. `examples/Sh.raz`: pipelines, redirection, `cd`, `&`, `wait`, |
| 56 | | - and Ctrl-C to the job in the foreground, in a few hundred lines. |
| 57 | | - Its test runs scripts given with `-c`. |
| 58 | | -- [x] 7. rat, rlX11, rmacs and ravite on this raz, in their own |
| 59 | | - repositories: the four copies of UTF-8 encoding go to |
| 60 | | - `Str.encode`. |
| 61 | | -- [x] 8. The freeze, in CLAUDE.md and the report's first section: the |
| 62 | | - language changes only to mend a defect; the library grows only by |
| 63 | | - what breaks nothing; wishes go to a list for a later thaw. README, |
| 64 | | - `doc/compiler.md`'s table, the report's version and the |
| 65 | | - compiler's; tag `v0.5.0`. |
| 66 | | - |
| 67 | | -## v0.6.0: raz to be rebuilt by anyone |
| 68 | | - |
| 69 | | -Done, and tagged `v0.6.0`: report 2026-10.12, step 3 set aside. The |
| 70 | | -owner agreed steps 5 to 10 to be done without stopping, so they wait |
| 71 | | -for review together. The freeze didn't hold for this work, by the |
| 72 | | -owner's word. |
| 8 | +No milestone is under way. v0.6.0 is tagged; its steps 5 to 10 await |
| 9 | +the owner's review. |
| 73 | 10 | |
| 74 | | -**For:** a language a person alone can implement again, from the |
| 75 | | -report, on any machine, in weeks; programs that run on small machines |
| 76 | | -as well as large; code within reach of a simple optimising compiler, |
| 77 | | -without one. |
| 11 | +## Next, when the owner says |
| 78 | 12 | |
| 79 | | -**Done when:** the report alone is enough to rebuild raz, with a |
| 80 | | -conformance suite to say when a rebuild is done; the report has a |
| 81 | | -system integer and optional reals, and leaves separate compilation to |
| 82 | | -the implementation; it has array constants, joined string constants |
| 83 | | -and `match` on integers; the parser reaches the machine only through |
| 84 | | -`gen`, the boundary a port writes again, and the back end keeps its |
| 85 | | -values in registers as Wirth's compilers do; `make bench` still |
| 86 | | -passes; the compiler is within the new budget below; `v0.6.0` is |
| 87 | | -tagged. |
| 13 | +- The book, "Compiling Raz": its brief is `doc/book/PLAN.md`. |
| 14 | +- A port to aarch64, to measure one: a new `gen.pas`, an encoder and |
| 15 | + assembler for it, and its ELF. |
| 88 | 16 | |
| 89 | | -**Kept out:** a second back end (aarch64 is the milestone after, to |
| 90 | | -measure a port); an optimiser; separate compilation: object files, an |
| 91 | | -IR written down, and a tool to show them (the report leaves it to the |
| 92 | | -implementation, and a whole program compiles in well under a second); |
| 93 | | -the wishes below. |
| 94 | | - |
| 95 | | -- [x] 1. The report as it stands, made complete: the whole grammar; |
| 96 | | - the readings in CLAUDE.md moved into the report; what every |
| 97 | | - implementation must do set apart from what each may choose |
| 98 | | - (code procedures, `SYSCALL`, `extern`'s convention, how several |
| 99 | | - results come back, the text of messages); the core a port must |
| 100 | | - have (the language, `Rt` and `Out`, over writing, exiting and |
| 101 | | - getting memory) and what it may leave out. No language change. |
| 102 | | - For review before anything else. |
| 103 | | -- [x] 2. The report, the new language, for review before any code: the |
| 104 | | - system integers `INT` and `UINT`, the size of an address, which |
| 105 | | - `LEN`, indexes, sizes and `p - q` give, and through which |
| 106 | | - integers and pointers convert (the owner's choices), and how |
| 107 | | - they convert to and from `I64`; a module's own choice to leave |
| 108 | | - out its checks of indexes and slices; exported variables read only |
| 109 | | - outside their module; `CAS`, `XCHG` and `XADD` on words, not |
| 110 | | - only on 8 bytes; byte order, and what a packed record promises |
| 111 | | - on a machine that can't read a misaligned word; reals a |
| 112 | | - target may leave out; object files, a module's interface and its |
| 113 | | - IR, and a generic's instances in them, named by their arguments |
| 114 | | - and the fingerprints they were built from. |
| 115 | | -- [x] 3. The IR, in its own document, `doc/ir.md`, for review: proposed, a stack |
| 116 | | - code close to what the parser asks of `gen` today, with types |
| 117 | | - and places, so that a back end turns its stack into registers and |
| 118 | | - an interpreter of it stays small. Set aside by the owner: the |
| 119 | | - compiler compiles the whole program at once, so nothing needs |
| 120 | | - the IR written down; `doc/ir.md` is removed, and git keeps it. |
| 121 | | -- [x] 4. The tests split: a conformance suite any implementation |
| 122 | | - passes, apart from this compiler's own messages. |
| 123 | | -- [x] 5. The system integer. |
| 124 | | -- [x] 6. Optional reals: a target says whether it has them. |
| 125 | | -- [x] 6a. `+` joins string constants (report, section 4). |
| 126 | | -- [x] 6b. Array constants: `const P: [5]I64 = [...]`, in read-only |
| 127 | | - data, used as a variable that can't be changed (section 4). |
| 128 | | - Done so that a string constant is the same mechanism. |
| 129 | | -- [x] 6c. `match` on integers: constants and inclusive ranges as |
| 130 | | - labels, no value in two, `else` required (7.4); compares and |
| 131 | | - branches, no jump table. `examples/Sh.raz`'s chains of `elsif` |
| 132 | | - become `match`. |
| 133 | | -- [x] 7. The parser reaches the machine only through `gen`: calls of |
| 134 | | - a stack machine, with the kind of each value (a word, a 64-bit |
| 135 | | - integer, an `F32`, an `F64`) and the place in the source, and no |
| 136 | | - x86-64 in the parser; a port is a new `gen`. Every test gives |
| 137 | | - the same output as before. |
| 138 | | -- [x] 8. Wirth's register stack in the x86-64 `gen`: the value at |
| 139 | | - depth `d` is held in register `d`, not pushed. The registers in |
| 140 | | - use are saved around a call, and spilled to the frame when an |
| 141 | | - expression is deeper than the registers; the stack is empty when |
| 142 | | - deferred statements run, a `return`'s results kept in the frame |
| 143 | | - meanwhile; `rax`, `rdx` and `rcx`, which division and shifts |
| 144 | | - need, aren't in the stack. `make bench` still passes. |
| 145 | | -- [x] 9a. Failures caught by the code where the machine can't: a |
| 146 | | - `nil` test before a dereference or a call through a procedure |
| 147 | | - value, a stack limit at each procedure's start, a zero test |
| 148 | | - before a division; chosen per target. A `nil` test is left out |
| 149 | | - only where the offset falls in the unmapped page at address 0. |
| 150 | | - On x86-64 that means a field past 4,095 bytes still gets one. |
| 151 | | -- [x] 9b. Assembly procedures in place of byte procedures: the |
| 152 | | - target's own syntax (appendix A), for the instructions the |
| 153 | | - encoder knows and a few of the system's, bytes for the rest. |
| 154 | | -- [x] 9c. `raz -S`: each line of source with its instructions, named |
| 155 | | - by the encoder as it makes them, not by a disassembler. |
| 156 | | -- [x] 9d. The trap report: on a failed check or a trap, the calls |
| 157 | | - under way, each with its variables by name and value, from |
| 158 | | - tables the compiler writes; `Rt.trace` gives the same on |
| 159 | | - demand. |
| 160 | | -- [x] 9e. A profiler in `Rt`: a program run with `RAZ_PROFILE` set |
| 161 | | - samples where it is, and at its end says which procedures and |
| 162 | | - lines took the time. |
| 163 | | -- [x] 10. `doc/compiler.md`, README, the report's version and the |
| 164 | | - compiler's; tag `v0.6.0`. |
| 165 | | - |
| 166 | | -The budget, by the owner's word: a soft limit of 8,000 lines of code, |
| 167 | | -with the compiler documented and commented throughout, most of all |
| 168 | | -where it is obscure, not obvious, or needs a compiler writer's |
| 169 | | -knowledge. |
| 170 | | - |
| 171 | 17 | ## Wishes, for a later thaw |
| 172 | 18 | |
| 173 | 19 | What the language or the library might have, met while writing raz; |
| 174 | | -none is built while the freeze holds. |
| 175 | | - |
| 176 | | -Taken into v0.6.0: `match` on integers, array constants, joining |
| 177 | | -string constants. |
| 178 | | - |
| 179 | | -## After v0.5.0 |
| 180 | | - |
| 181 | | -The book, "Compiling Raz": its brief is `doc/book/PLAN.md`. |
| 20 | +none is built while the freeze holds. None waits now. |