| | @@ -9,8 +9,8 @@ |
| 9 | 9 | This report defines the language. It is short on purpose. Whatever it |
| 10 | 10 | doesn't allow, raz doesn't have. |
| 11 | 11 | |
| 12 | | -This is version 2026-10.21 of the report; section 12 says what each |
| 13 | | -version changed. 2026-10.11 and 2026-10.12 are a thaw the owner chose, |
| 12 | +This is version 2026-10.21 of the report; section 12 says where each |
| 13 | +version's changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose, |
| 14 | 14 | for a language anyone can build again. They break programs written |
| 15 | 15 | for 2026-10.10 and before: for 2026-10.9, say, the report of compiler |
| 16 | 16 | 0.5.0, the last release before them; and 2026-10.12 breaks code |
| | @@ -1289,11 +1289,6 @@ |
| 1289 | 1289 | `Rt.trace` says on standard error the calls under way, from the one |
| 1290 | 1290 | that calls it out, each with its variables, as a program that stops |
| 1291 | 1291 | does. |
| 1292 | | - |
| 1293 | | -Only what can be reached from `main` and the module bodies goes into |
| 1294 | | -the executable: unused procedures, variables and strings are left out. |
| 1295 | | -The executable names its procedures and carries line numbers, so that |
| 1296 | | -gdb can stop at a line of the source and show where it is. |
| 1297 | 1292 | |
| 1298 | 1293 | **Defined behaviour.** Every variable starts at zero, integers wrap, |
| 1299 | 1294 | and indexing arrays and slices is checked, so a program's behaviour is |
| | @@ -1315,11 +1310,9 @@ |
| 1315 | 1310 | |
| 1316 | 1311 | **Separate compilation.** An importer depends only on a module's |
| 1317 | 1312 | interface: what it exports, as an importer sees it, never its source |
| 1318 | | -or its code. So a module can be compiled on its own, and a program |
| 1319 | | -made from modules compiled at different times. Whether an |
| 1320 | | -implementation does so, and into what, is its own choice (appendix |
| 1321 | | -A); one that does makes the same program as if every module were |
| 1322 | | -compiled together, and keeps one copy of each instance. |
| 1313 | +or its code. An implementation that compiles modules on its own makes |
| 1314 | +the same program as if every module were compiled together (appendix |
| 1315 | +A). |
| 1323 | 1316 | |
| 1324 | 1317 | **Errors.** A program that breaks a rule of this report that says it |
| 1325 | 1318 | is an error isn't a raz program, and an implementation must reject it: |
| | @@ -1411,9 +1404,8 @@ |
| 1411 | 1404 | proc done*(ar: ^Arena); (* its memory given back *) |
| 1412 | 1405 | ``` |
| 1413 | 1406 | |
| 1414 | | -`NEW(p, a)` calls `a^.alloc`. `Heap` keeps blocks of nine sizes, from |
| 1415 | | -16 to 4096 bytes with their header, each with a list of the free ones; |
| 1416 | | -a bigger block gets pages of its own. An arena hands out memory from |
| 1407 | +`NEW(p, a)` calls `a^.alloc`. `Heap` is the general |
| 1408 | +allocator. An arena hands out memory from |
| 1417 | 1409 | one block: its `free` does nothing, and `reset` forgets everything. |
| 1418 | 1410 | |
| 1419 | 1411 | ``` |
| | @@ -1591,9 +1583,8 @@ |
| 1591 | 1583 | |
| 1592 | 1584 | `nextEntry` gives every name in the directory except `.` and `..`, in |
| 1593 | 1585 | no particular order. `rawMode` turns off what the terminal does with |
| 1594 | | -keys before the program reads them: echo, waiting for a whole line, |
| 1595 | | -Ctrl-C and Ctrl-Z as signals, Ctrl-S and Ctrl-Q as flow control, and |
| 1596 | | -CR to NL; and with output, NL to CR NL. A program that turns it on |
| 1586 | +keys before the program reads them (echo, line editing, signals, flow |
| 1587 | +control), and NL to CR NL on output. A program that turns it on |
| 1597 | 1588 | restores it before it ends: `Rt.atExit` is the place. |
| 1598 | 1589 | |
| 1599 | 1590 | **Files.** `open` gives a file for what `how` asks: `reading`, |
| | @@ -1955,111 +1946,8 @@ |
| 1955 | 1946 | count: `2026-10.0`, then `2026-10.1` for the next change that month. |
| 1956 | 1947 | `raz --version` says which version the compiler follows. |
| 1957 | 1948 | |
| 1958 | | -- **2026-10.0.** The first numbered version: the language of compiler |
| 1959 | | - 0.3.0. |
| 1960 | | -- **2026-10.1.** Messages: every error in a run, warnings of what is |
| 1961 | | - never used and `-Werror` (section 10); failed checks say what failed, |
| 1962 | | - and signals say where (sections 6.5 and 10). |
| 1963 | | -- **2026-10.2.** `Sys` gains files and directories, the terminal, and |
| 1964 | | - the environment (section 11). |
| 1965 | | -- **2026-10.3.** `return f(x);` passes on the several results of `f` |
| 1966 | | - (sections 7.3 and 8). `and`, `or` and `not` are for `BOOL`s, and |
| 1967 | | - bind below the relations; `&`, `|` and `~` are the operators on bits, |
| 1968 | | - and `xor` is for integers only (sections 2 and 6). Arrays and slices |
| 1969 | | - of integers, `BOOL`s, enumerations, sets and pointers compare with |
| 1970 | | - `=`, by code where the comparison stands, not by a call into `Rt` |
| 1971 | | - (section 6.5). A generic module's instance is made where it is first |
| 1972 | | - used, so its arguments may name types declared after the imports |
| 1973 | | - (section 3). |
| 1974 | | -- **2026-10.4.** `Sys` gains a connection to a Unix socket, waiting on |
| 1975 | | - several files at once, pseudo-terminals, and starting, waiting for |
| 1976 | | - and stopping programs (section 11). |
| 1977 | | -- **2026-10.5.** A module with files in more than one of the |
| 1978 | | - directories searched is an error, unless the first is a link to one |
| 1979 | | - of the others (section 3). |
| 1980 | | -- **2026-10.6.** `Sys.Info` says whether the path is a regular file, |
| 1981 | | - and whether it is a symbolic link (section 11). |
| 1982 | | -- **2026-10.7.** `Sys.send` writes to a socket without SIGPIPE |
| 1983 | | - (section 11). |
| 1984 | | -- **2026-10.8.** `Sys.workDir` returns the directory, with no `var` |
| 1985 | | - parameter (section 11). |
| 1986 | | -- **2026-10.9.** The language is frozen (the start of the report). |
| 1987 | | - `Sys` gains opening a file for any use, seeking, |
| 1988 | | - links, permissions and times; pipes, process groups and the |
| 1989 | | - terminal's foreground; signals caught on a file descriptor; clocks, |
| 1990 | | - sleeping and random bytes; and network sockets. `Sys.spawn` takes a |
| 1991 | | - `Program`, and `Sys.wait` says which program changed and how. `Str` |
| 1992 | | - gains UTF-8 and reading a number, `Map` removing and walking, `Fmt` |
| 1993 | | - reals; `Sort`, `Math`, `Files` and `Opt` are new (section 11). |
| 1994 | | -- **2026-10.10.** Said at last: what the compiler did and the report |
| 1995 | | - didn't say, all through; what an implementation chooses, and the |
| 1996 | | - core every target has (appendix A); the whole grammar (appendix B); |
| 1997 | | - the library's module names are kept for it (section 3); a record, |
| 1998 | | - variant or enumeration is a type of its own wherever it is written |
| 1999 | | - (section 5.10); a `nil` pointer, a division by zero and a stack |
| 2000 | | - overflow stop the program on every target (section 10); byte order |
| 2001 | | - is the target's, and `Str` reads and writes a fixed one (sections |
| 2002 | | - 5.5 and 11); `Out`'s buffer is `Sys.outSize` bytes (section 11). |
| 2003 | | - Changed: a field of a packed record that may be misaligned has no |
| 2004 | | - address and no volatile access (section 5.5). Mended: |
| 2005 | | - arithmetic on untyped constants that overflows is an error (section |
| 2006 | | - 2); a slice of a pointer can't run backwards (section 6.4). Ordinary |
| 2007 | | - accesses are no longer promised to be made exactly as written, only |
| 2008 | | - volatile and atomic ones (section 7.6). |
| 2009 | | -- **2026-10.11.** `INT` and `UINT`, as big as an |
| 2010 | | - address, are the integers of lengths, slices, pointer differences, |
| 2011 | | - pointer conversions, `SYSCALL` and `ARGC`; `SIZE` and a constant |
| 2012 | | - `LEN` are untyped; `INT` widens silently to `I64` and `UINT` to |
| 2013 | | - `U64`, but neither mixes with them in an expression or a `for` |
| 2014 | | - (sections 5, 6.1 and 7.2); `Mem.Allocator` takes `INT` sizes. |
| 2015 | | - Pointers, procedures, `ERROR`s, slices and variants' tags are sized |
| 2016 | | - by the address, and basic types aligned as the target's C aligns |
| 2017 | | - them (section 5). Reals are a target's to have or not (section |
| 2018 | | - 5.1). An exported variable can't be changed, passed by `var` or |
| 2019 | | - addressed outside its module, nor an array in it sliced (section 3). `check off;` |
| 2020 | | - leaves a module's index and slice checks out (sections 3, 6.4 and |
| 2021 | | - 6.5). An index of any integer type is checked by its value (6.5). A |
| 2022 | | - shift counts modulo its operand's width, and the smallest value of |
| 2023 | | - every signed type divided by -1 stops the program (6.1). Writing a |
| 2024 | | - string's bytes isn't defined (5.10). The atomic built-ins work on |
| 2025 | | - `INT`, `UINT` and pointers (6.8). An integer constant past an |
| 2026 | | - extern's parameters goes as an `INT` (9). An importer depends only |
| 2027 | | - on a module's interface, so a module can be compiled on its own; |
| 2028 | | - whether it is, and into what, is the implementation's (sections 3 |
| 2029 | | - and 10; appendix A). The library takes and gives |
| 2030 | | - `INT` for lengths, counts, descriptors, process ids and statuses, |
| 2031 | | - `main`'s and `Rt.exit`'s among them, and `I32` for a character; |
| 2032 | | - `I64` stays for what may pass an `INT` on a small target: a file's |
| 2033 | | - size and position, times, and numbers read from text (section |
| 2034 | | - 11). An array constant has a type and is used as a variable that |
| 2035 | | - can't be changed; `+` joins string constants (section 4). `match` |
| 2036 | | - takes an integer, with constants and ranges as labels (7.4). |
| 2037 | | -- **2026-10.12.** A code procedure is written in the target's assembly |
| 2038 | | - language, not as bytes (section 8; appendix A). A program that stops |
| 2039 | | - says the calls under way and their variables, and `Rt.trace` says |
| 2040 | | - them on demand (sections 10 and 11). |
| 2041 | | -- **2026-10.13.** `Sys` gains writing without waiting, and waiting for |
| 2042 | | - room to write (section 11). |
| 2043 | | -- **2026-10.14.** The blank, `_`, drops a value or one of several |
| 2044 | | - results (section 7.1); a call that drops a result is a lint |
| 2045 | | - (section 10). |
| 2046 | | -- **2026-10.15.** `Math` gains `pow`, `ceil`, `round`, `log2`, |
| 2047 | | - `log10`, `tan`, `asin`, `acos` and `atan`; `Sys` gains `space` |
| 2048 | | - (section 11). |
| 2049 | | -- **2026-10.16.** Record constants, and array and record constants of |
| 2050 | | - records, strings, procedures and more (section 4); `Str` gains |
| 2051 | | - `copy` (section 11). |
| 2052 | | -- **2026-10.17.** `COPY` copies the elements of one array or slice to |
| 2053 | | - another as a block (section 6.8). |
| 2054 | | -- **2026-10.18.** A code procedure takes and returns slices (section |
| 2055 | | - 8). |
| 2056 | | -- **2026-10.19.** The library gains `Bytes` (section 11). |
| 2057 | | -- **2026-10.20.** `try`: a call of a procedure whose last result is an |
| 2058 | | - `ERROR`, which makes the procedure it stands in return that error |
| 2059 | | - when it isn't `nil` (sections 2, 5.8, 6, 7.8 and appendix B). `try` |
| 2060 | | - becomes a reserved word, which breaks a program with a name `try`. |
| 2061 | | -- **2026-10.21.** An arm of a `match` on an enumeration may name |
| 2062 | | - several of its names (section 7.4). |
| 1949 | +The history of the versions, what each changed, is in |
| 1950 | +`doc/report-history.md`. |
| 2063 | 1951 | |
| 2064 | 1952 | ## Appendix A. What an implementation chooses |
| 2065 | 1953 | |
| | @@ -2094,11 +1982,8 @@ |
| 2094 | 1982 | value's bytes is the target's (little-endian on x86-64). |
| 2095 | 1983 | - **The assembly language.** How a code procedure's instructions are |
| 2096 | 1984 | written (section 8). On x86-64 it is Intel's syntax, as NASM writes |
| 2097 | | - it: the destination first; registers by name (`rax`, `eax`, `al`, |
| 2098 | | - `xmm0`); memory as `[base + index * scale + disp]`, with `byte`, |
| 2099 | | - `word`, `dword` or `qword` before it where no register says the |
| 2100 | | - size; `lock` before an instruction. Which instructions it knows is |
| 2101 | | - the implementation's; `db` gives any others. |
| 1985 | + it, destination first. Which instructions it knows is the |
| 1986 | + implementation's; `db` gives any others. |
| 2102 | 1987 | - **Sizes in the library.** How many bytes `Out` keeps before it |
| 2103 | 1988 | writes them, `Sys.outSize` (section 11): 4 KB on Linux, fewer on a |
| 2104 | 1989 | small machine. |