From b2a08a71ee16bd7d5178cce0c8126fe7fa9e9e9b Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Mon, 26 Oct 2026 18:31:29 +0000 Subject: [PATCH] site: v0.25.0 --- diff --git a/site/public/_redirects b/site/public/_redirects index 6ccb2fc..0379e49 100644 --- a/site/public/_redirects +++ b/site/public/_redirects @@ -1 +1 @@ -/download/latest /download/raz-0.24.0-linux-x86_64.tar.gz 302 +/download/latest /download/raz-0.25.0-linux-x86_64.tar.gz 302 diff --git a/site/public/download/raz-0.25.0-linux-x86_64.tar.gz b/site/public/download/raz-0.25.0-linux-x86_64.tar.gz new file mode 100644 index 0000000..bf0c0d1 Binary files /dev/null and b/site/public/download/raz-0.25.0-linux-x86_64.tar.gz differ diff --git a/site/public/download/raz-0.25.0-linux-x86_64.tar.gz.sha256 b/site/public/download/raz-0.25.0-linux-x86_64.tar.gz.sha256 new file mode 100644 index 0000000..f55694d --- /dev/null +++ b/site/public/download/raz-0.25.0-linux-x86_64.tar.gz.sha256 @@ -0,0 +1 @@ +b0aea003ca12bb6a580e96d6ab8fe293b48f3886c2acca5a43f9dc535109188b raz-0.25.0-linux-x86_64.tar.gz diff --git a/site/public/index.html b/site/public/index.html index 3c58c12..30392c8 100644 --- a/site/public/index.html +++ b/site/public/index.html @@ -43,7 +43,7 @@
~10,700 lines of compiler ~500K lines compiled a second - 1 report, 35 pages + 1 report, 36 pages static executables, no run time to install
@@ -110,28 +110,28 @@

The language is defined by the report, which is short on purpose: whatever it doesn’t allow, raz doesn’t have. Its second volume describes the library. Both are on one page, and each is -a PDF: the language (35 pages) and +a PDF: the language (36 pages) and the library.

Download

-

raz 0.24.0 is a tarball for x86-64 Linux with the compiler, raz, +

raz 0.25.0 is a tarball for x86-64 Linux with the compiler, raz, its library, lib/, which it finds beside itself, the formatter and the documentation tool as sources in tools/, and the manual pages. It needs nothing else installed.

- Download raz 0.24.0 - SHA-256 + Download raz 0.25.0 + SHA-256
-
$ tar xzf raz-0.24.0-linux-x86_64.tar.gz
-$ ln -s $PWD/raz-0.24.0-linux-x86_64/raz ~/.local/bin/raz
+
$ tar xzf raz-0.25.0-linux-x86_64.tar.gz
+$ ln -s $PWD/raz-0.25.0-linux-x86_64/raz ~/.local/bin/raz
 $ raz run Hello.raz

The link works since raz finds lib/ beside its real path. The manual pages are in man/: man ./man/raz-tutorial.7. The address download/latest always leads to the newest release, -and download/raz-0.24.0-linux-x86_64.tar.gz to this one, for -good. Earlier releases: 0.23.0, 0.22.0, 0.21.0, 0.20.0, 0.19.0, 0.18.1, 0.18.0, 0.17.2, 0.17.1, 0.17.0, 0.16.0, 0.15.0, 0.14.0, 0.13.0, 0.12.0, 0.11.1, 0.11.0, 0.10.1, 0.10.0, 0.9.1, 0.9.0, 0.8.0, 0.7.1; each has its SHA-256 beside it, with +and download/raz-0.25.0-linux-x86_64.tar.gz to this one, for +good. Earlier releases: 0.24.0, 0.23.0, 0.22.0, 0.21.0, 0.20.0, 0.19.0, 0.18.1, 0.18.0, 0.17.2, 0.17.1, 0.17.0, 0.16.0, 0.15.0, 0.14.0, 0.13.0, 0.12.0, 0.11.1, 0.11.0, 0.10.1, 0.10.0, 0.9.1, 0.9.0, 0.8.0, 0.7.1; each has its SHA-256 beside it, with .sha256 added to its name.

-

SHA-256 3c6cac9b9ce8acc2a5284c426000440cb05a8d322cc693bfd552b9b520d935ec

+

SHA-256 b0aea003ca12bb6a580e96d6ab8fe293b48f3886c2acca5a43f9dc535109188b

Release pages give each version's commit, notes, compiler and source archives, with checksums. Browse the source and history, or clone: diff --git a/site/public/raz-lib.pdf b/site/public/raz-lib.pdf index b3ca764..29f193f 100644 Binary files a/site/public/raz-lib.pdf and b/site/public/raz-lib.pdf differ diff --git a/site/public/raz.pdf b/site/public/raz.pdf index dce13f6..7851e89 100644 Binary files a/site/public/raz.pdf and b/site/public/raz.pdf differ diff --git a/site/public/spec.html b/site/public/spec.html index a74aeb2..2573a31 100644 --- a/site/public/spec.html +++ b/site/public/spec.html @@ -38,7 +38,7 @@

raz is a small systems language, first made for x86-64 Linux. A raz program can lay a record over a device’s registers, read and write a device’s memory exactly as written, take part in lock-free algorithms, make system calls and call C libraries. It has no garbage collector and no hidden run time: what the program does is what its text says.

This is the first volume of the report: the language, what an implementation chooses, and the grammar. The second, doc/raz-lib.md, is the library, which sections 3 and 10 and appendix A name.

This report defines the language. It is short on purpose. Whatever it doesn’t allow, raz doesn’t have.

-

This is version 2026-10.37 of the report; section 11 says where each version’s changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose, for a language anyone can build again. They break programs written for 2026-10.10 and before: for 2026-10.9, say, the report of compiler 0.5.0, the last release before them; and 2026-10.12 breaks code procedures written for 2026-10.11. 2026-10.20 is a third, for try (section 7.8); it breaks a program that has a name try. 2026-10.25 is a fourth, for strings: raw strings, which may run over lines and may be indented with the code around them (section 2), and match on a string (section 7.4); it breaks no program. 2026-10.26 is a fifth: an INT widens to an I64 wherever it goes to one, in an expression too (sections 5.10 and 6.1); and a view, v.(T), reads and writes the bytes of a variable as a T (section 6.9); it breaks no program. 2026-10.27 mends a defect: returning a slice of the procedure’s own frame is an error (section 7.3), which breaks only a program that read memory already gone. 2026-10.28 mends another: an array a call returns lives to the end of its statement, and a slice of it kept past that is undefined (sections 8 and 10). 2026-10.29 is a sixth thaw: an array constant typed []T takes its length from its literal (section 4); it breaks no program. 2026-10.30 mends a defect: [] used as a slice is the empty slice, which may be returned (sections 6.5 and 7.3); it breaks no program. 2026-10.31 is a seventh thaw: INT is at least 16 bits, and U8, I8 and I16 widen to it (sections 5.1, 5.10 and 6.1); an enumeration’s name may be written with its type, and must be where another declaration shares it (section 5.7); and continue (section 7.2), which breaks a program that has a name continue. 2026-10.32 is an eighth thaw: a constant typed []T may be [], the empty slice (section 4); it breaks no program. 2026-10.33 is a ninth: a const parameter, the caller’s variable read in place (section 8), and a variant in a constant (section 4), which break no program; and the library’s procedures that took a pointer to what they work on take a var parameter, a const one or a value instead (the library volume), which breaks a program that calls them with ADR. 2026-10.34 is a tenth: PTR(s), the address a slice starts at, even an empty one (section 6.8); it breaks no program. 2026-10.35 is an eleventh: ROL(x, n) and ROR(x, n), a word rotated (sections 6.1 and 6.8); it breaks no program. 2026-10.36 is a twelfth: MIN(T) and MAX(T), the limits of an integer type, and CLZ, CTZ and POPCOUNT, which count bits (sections 6.1 and 6.8); ABS(x), a number without its sign (sections 6.1 and 6.8); INT(b), a BOOL as an integer (section 6.7); OFFSET(T, f) and SIZE(T.f), where a field lies and how big it is; BYTES(x), the bytes of a variable or a slice (sections 4 and 6.8); FILL(d, x), an array or a slice set to one value (section 6.8); a qualified case in a match arm (section 7.4); a slice part written as a literal, and an ERROR constant named by another (sections 4 and 5.8); and a const parameter’s slice returned (section 7.3); and a procedure type’s parameter or result may name a type declared later in its type section (sections 4 and 5.9); it breaks no program. 2026-10.37 is a thirteenth thaw, for safety. It mends a defect: an array a call returns, or a record or variant holding one, lives to the end of the procedure the call is in, so a slice of it may be kept (section 8). CAS, XCHG and XADD take the variable they work on (section 6.8). []const T is a slice whose elements can’t be written through it, which a string literal, a slice of a constant, MSG and a slice of a const parameter’s array are (sections 4, 5.3, 5.10, 6.8 and 8). And import SYSTEM is what a module says to reach memory other than through its variables: SYSTEM.ADR, SYSTEM.PTR, SYSTEM.SYSCALL and SYSTEM.ARGV, a pointer’s arithmetic and conversions, C, code procedures and check off; (section 3); section 10 says what is left undefined outside such modules. It breaks a program that gives an atomic a pointer, writes through a string or a constant, or does what SYSTEM holds without importing it; raz 0.23 still took them, as before; raz 0.24 doesn’t.

+

This is version 2026-10.38 of the report; section 11 says where each version’s changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose, for a language anyone can build again. They break programs written for 2026-10.10 and before: for 2026-10.9, say, the report of compiler 0.5.0, the last release before them; and 2026-10.12 breaks code procedures written for 2026-10.11. 2026-10.20 is a third, for try (section 7.8); it breaks a program that has a name try. 2026-10.25 is a fourth, for strings: raw strings, which may run over lines and may be indented with the code around them (section 2), and match on a string (section 7.4); it breaks no program. 2026-10.26 is a fifth: an INT widens to an I64 wherever it goes to one, in an expression too (sections 5.10 and 6.1); and a view, v.(T), reads and writes the bytes of a variable as a T (section 6.9); it breaks no program. 2026-10.27 mends a defect: returning a slice of the procedure’s own frame is an error (section 7.3), which breaks only a program that read memory already gone. 2026-10.28 mends another: an array a call returns lives to the end of its statement, and a slice of it kept past that is undefined (sections 8 and 10). 2026-10.29 is a sixth thaw: an array constant typed []T takes its length from its literal (section 4); it breaks no program. 2026-10.30 mends a defect: [] used as a slice is the empty slice, which may be returned (sections 6.5 and 7.3); it breaks no program. 2026-10.31 is a seventh thaw: INT is at least 16 bits, and U8, I8 and I16 widen to it (sections 5.1, 5.10 and 6.1); an enumeration’s name may be written with its type, and must be where another declaration shares it (section 5.7); and continue (section 7.2), which breaks a program that has a name continue. 2026-10.32 is an eighth thaw: a constant typed []T may be [], the empty slice (section 4); it breaks no program. 2026-10.33 is a ninth: a const parameter, the caller’s variable read in place (section 8), and a variant in a constant (section 4), which break no program; and the library’s procedures that took a pointer to what they work on take a var parameter, a const one or a value instead (the library volume), which breaks a program that calls them with ADR. 2026-10.34 is a tenth: PTR(s), the address a slice starts at, even an empty one (section 6.8); it breaks no program. 2026-10.35 is an eleventh: ROL(x, n) and ROR(x, n), a word rotated (sections 6.1 and 6.8); it breaks no program. 2026-10.36 is a twelfth: MIN(T) and MAX(T), the limits of an integer type, and CLZ, CTZ and POPCOUNT, which count bits (sections 6.1 and 6.8); ABS(x), a number without its sign (sections 6.1 and 6.8); INT(b), a BOOL as an integer (section 6.7); OFFSET(T, f) and SIZE(T.f), where a field lies and how big it is; BYTES(x), the bytes of a variable or a slice (sections 4 and 6.8); FILL(d, x), an array or a slice set to one value (section 6.8); a qualified case in a match arm (section 7.4); a slice part written as a literal, and an ERROR constant named by another (sections 4 and 5.8); and a const parameter’s slice returned (section 7.3); and a procedure type’s parameter or result may name a type declared later in its type section (sections 4 and 5.9); it breaks no program. 2026-10.37 is a thirteenth thaw, for safety. It mends a defect: an array a call returns, or a record or variant holding one, lives to the end of the procedure the call is in, so a slice of it may be kept (section 8). CAS, XCHG and XADD take the variable they work on (section 6.8). []const T is a slice whose elements can’t be written through it, which a string literal, a slice of a constant, MSG and a slice of a const parameter’s array are (sections 4, 5.3, 5.10, 6.8 and 8). And import SYSTEM is what a module says to reach memory other than through its variables: SYSTEM.ADR, SYSTEM.PTR, SYSTEM.SYSCALL and SYSTEM.ARGV, a pointer’s arithmetic and conversions, C, code procedures and check off; (section 3); section 10 says what is left undefined outside such modules. It breaks a program that gives an atomic a pointer, writes through a string or a constant, or does what SYSTEM holds without importing it; raz 0.23 still took them, as before; raz 0.24 doesn’t. 2026-10.38, the last change before the language is frozen for good, is for a program on the bare machine: a code procedure names a procedure or a global variable in three operands (section 8), and section 10 gives the least an implementation accepts, and what it does past its own limits; it breaks no program.

The language is frozen, softly, from this version on: it changes only to mend a defect, and its library grows only by what breaks no program written for it. What anyone wishes it had waits on a list, for a later thaw.

1. A first look

module Hello;
@@ -803,7 +803,7 @@
     or rax, rdx;
     ret;
 end rdtsc;
-

A label, name:, names the place of the instruction after it, within the procedure. A constant of the module may stand wherever a number does. Any bytes may be written with db, as in db 0FH, 31H;, for an instruction the assembler doesn’t know.

+

A label, name:, names the place of the instruction after it, within the procedure. A constant of the module may stand wherever a number does. A procedure or a global variable of the module, or one an imported module exports, by its qualified name, stands for its address in three places only: call p; and jmp p;, which reach it from where they are, and lea r, [v];, which puts its address in a register. A label of the procedure is found first. Nothing of its type is checked, and no other operand takes one. What is named is part of the program, as a procedure that is called is. Any bytes may be written with db, as in db 0FH, 31H;, for an instruction the assembler doesn’t know.

It is called like any procedure, with the System V convention: integer and pointer arguments, and the addresses of var and const ones, arrive in rdi, rsi, rdx, rcx, r8 and r9, F32 and F64 ones in xmm0 to xmm7, and the result goes in rax (and rdx for a second) or xmm0. Its parameters and results are therefore of the types C can take (section 9), or slices, at most six integer and eight real parameters, and at most two results. A slice is two integers, as System V passes a struct of them: as a parameter its address arrives in one register and its length in the next, the two counting among the six; as the result its address goes in rax and its length in rdx, and it is the only result. The instructions are the whole procedure, ret included; they must keep rbx, rbp, rsp and r12 to r15 as they found them. The compiler doesn’t look past what they say.

9. Calling C

ExternDeclaration = "extern" ( "proc" IdentDef Signature
@@ -834,6 +834,7 @@
 

Defined behaviour. Every variable starts at zero, integers wrap, and indexing arrays and slices is checked, so a program’s behaviour is defined by this report, with one exception: memory reached other than through a checked variable. In any module, three things reach it: a pointer used after the memory it points at was given back (by Heap’s free or an arena’s reset, say), a slice kept after the call whose frame holds what it points at (section 7.3), and a race on a variable that holds a pointer, a slice or a variant (section 7.6). In a module that imports SYSTEM, so does what that module does there (section 3): a made-up pointer, indexing through a pointer, an index out of range under check off;, writing a string’s bytes through a ^U8, a code procedure that breaks its rules, and C code. Each can read or write any memory, and what follows isn’t defined. Dereferencing nil, dividing by zero, calling a nil procedure and running out of stack stop the program, on every target, with status 2, as a failed check does. Before it stops, the program prints to standard error where it was, as file, line and column, and why, as far as it can tell: a nil pointer, a nil procedure, a stack overflow, a bad address or a division fault; then the calls under way, each with its variables of a basic, enumeration, set or pointer type. Whether the machine catches these or the compiled code checks for them is the implementation’s choice (appendix A); that they stop the program isn’t.

Separate compilation. An importer depends only on a module’s interface: what it exports, as an importer sees it, never its source or its code. An implementation that compiles modules on its own makes the same program as if every module were compiled together (appendix A).

Errors. A program that breaks a rule of this report that says it is an error isn’t a raz program, and an implementation must reject it: say what is wrong and make no executable. Such a rule is one whose breach would leave the program with no meaning this report can give: a mistake of types, a name that isn’t declared or is declared twice, an assignment to what is read-only, a call with the wrong number of arguments, a type name or a procedure with no result used as a value, type arguments given to a module that isn’t generic, or too many, an import that can’t be found, a procedure declared forward and never defined, a module that imports itself. A fault that is only a lint isn’t an error: a name declared and never used, or a result that a call standing on its own drops (Sys.write(fd, s);, where _ := Sys.write(fd, s); says it is meant). A program with one is valid, and an implementation may warn of it. The text of its messages, how many it reports and which warnings it gives are its own (appendix A).

+

Limits. An implementation accepts at least: 63 levels of parentheses and calls nested in one expression; 63 levels of statements nested in one procedure; a chain of 15 modules, each importing the next; 31 names declared together (a, b: INT) and 15 variables assigned together (a, b := f()); 1023 elements in one array literal; 255 labels in one match; 31 deferred statements in force in one procedure; and 8 type arguments to a generic module. It may accept more, and its own limits are its own (appendix A); past one, it rejects the program with an error that names the limit, as for any other error, and never fails in another way.

11. Versions

A version of this report is named by the month it was made in and a count: 2026-10.0, then 2026-10.1 for the next change that month. raz --version says which version the compiler follows.

The history of the versions, what each changed, is in doc/report-history.md.

@@ -849,6 +850,7 @@
  • Sizes in the library. How many bytes Out keeps before it writes them, Sys.outSize (the library volume): 4 KB on Linux, fewer on a small machine.
  • The executable. Its format, and the names and line numbers it carries for a debugger (section 10).
  • How a failure is caught. A nil pointer, a division by zero or a stack overflow may be caught by the machine or by checks in the compiled code; either way the program stops with its message (section 10).
  • +
  • Limits. How far past the least of section 10 it goes, and how much stack and memory a compile of a given program needs.
  • Messages and warnings. The text of the compiler’s messages, how many errors it reports before it stops, and which warnings it gives, -Werror included (section 10). That a program that is an error in this report is rejected isn’t free; the words that say so are. So is what a program that fails says on standard error: conformance is judged by a program’s standard output and exit status, never by its standard error.
  • Copies. A procedure’s frame may hold copies of its variables that the program can’t name: registers saved to it, temporaries of its statements, its value parameters, and arrays its calls return. An implementation may leave them where they are when the procedure returns, until the stack is used again. A wipe (section 7.6) reaches only the variables it is given. A secret is best kept in one variable, passed by var or const or by pointer, never by value, and wiped there.
  • The command line. How the compiler is run, its options, and where its library lives (sections 1 and 3).
  • @@ -1556,6 +1558,7 @@

    Sort.sort puts s in the order less gives, in place, without memory of its own, in time n log n at most; two elements equal by less may change places. Math’s procedures are as C’s math.h has them, to within the last bit or so; roundEven is IEEE 754’s default rounding, as Pascal’s Round, where round is C’s. Fmt.real(x, places) writes x with places digits after the point, at most 9, rounded to the nearest; from 1E15 on, with an exponent, as 1.50E17; and nan, inf and -inf as themselves. Fmt.short(x, out) writes x into out, from 0, and gives those bytes: the fewest significant digits that Math.toReal reads back as the same F64, and of two such the nearer x: 0.1, not 0.10000000000000001; 42, with no point; 0.0001; and below 1E-4 or from 1E15 on with an exponent, as 1.5E17 or 5E-324. Zero keeps its sign, 0 or -0, and nan and inf are as real writes them. The longest is Fmt.ShortMost bytes, so a call is var d: [Fmt.ShortMost]U8; Fmt.print("{}", [Fmt.str(Fmt.short(x, d))]);, and a width goes with str. The bytes are out’s: a second call with the same out overwrites them. hex writes capitals and lowHex lower case, neither with a 0x. A width between the braces pads an argument to that many bytes: {2} with spaces on the left, {02} with zeros on the left, after a sign ({04} of -7 is -007), {-10} with spaces on the right. A longer argument is written whole. A { followed by anything but } or a width is dropped, as before. Fmt.print("{2}:{02} U+{04}", [Fmt.int(3), Fmt.int(7), Fmt.hex(0E9H)]) writes 3:07 U+00E9. Fmt.into formats into a slice the caller gives, with no memory of its own, for a library that has no heap: it gives the bytes written, and false if the slice was too short and the text is cut there.

    Files and Opt are what most programs need of their command line. Files.writeAll writes again after a short write or a signal, as a pipe or a socket needs, and write is made over it. realPath adds to b the absolute path of what path names, with no ., .. or symbolic link in it, and leaves the working directory alone: -2 (ENOENT) if a part isn’t there, -20 (ENOTDIR) if a file is used as a directory, and -40 (ELOOP) after 40 links. b is left as it was on an error. removeTree removes a file, or a directory with all it holds; a symbolic link is removed itself and never followed.

    module Files;
    +proc argCount*: INT;                                (* how many arguments there are, the program's name included *)
     proc arg*(i: INT): []const U8;                     (* argument i; 0 is the program's name; "" if there is none *)
     proc read*(path: []const U8; var b: Buf.Buf): BOOL;   (* the whole file added to b *)
     proc load*(path: []const U8; var b: Buf.Buf): INT;    (* as read: 0, or minus the errno that stopped it *)