From c4ee39e3b9b5384af4cef65671bd682a39d77c19 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Tue, 13 Oct 2026 19:07:06 +0100 Subject: [PATCH] site: the compiler is in raz, builds itself; report 2026-10.21 Home page: ~10,500 lines, ~500K lines/s (self-built); public/ rebuilt. --- diff --git a/site/content/home.html b/site/content/home.html index f0d0104..d157459 100644 --- a/site/content/home.html +++ b/site/content/home.html @@ -15,13 +15,13 @@ 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.

-

The compiler is one Free Pascal program of about 9,100 lines. It makes +

The compiler is written in raz, about 10,500 lines, and builds itself. It makes x86-64 machine code and the ELF file itself, with no assembler or linker, in -one pass, at about 900,000 lines a second.

+one pass, at about 500,000 lines a second.

- ~9,100 lines of compiler - ~900K lines compiled a second + ~10,500 lines of compiler + ~500K lines compiled a second static executables, no run time to install 1 report, about 30 pages
diff --git a/site/public/advanced/listing.html b/site/public/advanced/listing.html index 57a3bae..ca7f6da 100644 --- a/site/public/advanced/listing.html +++ b/site/public/advanced/listing.html @@ -246,18 +246,18 @@
$ raz -o Dot Dot.raz
 $ objdump -d -M intel --no-show-raw-insn Dot | sed -n '/<Dot.dot>:/,/ret/p' | head -12
-0000000000403ac0 <Dot.dot>:
-  403ac0:	push   rbp
-  403ac1:	mov    rbp,rsp
-  403ac4:	sub    rsp,0x40
-  403acb:	mov    QWORD PTR [rbp-0x30],rbx
-  403acf:	xor    ebx,ebx
-  403ad1:	mov    QWORD PTR [rbp-0x28],r12
-  403ad5:	xor    r12d,r12d
-  403ad8:	mov    QWORD PTR [rbp-0x20],rdx
-  403adc:	mov    QWORD PTR [rbp-0x18],rcx
-  403ae0:	xor    ebx,ebx
-  403ae2:	mov    r8,rsi
+0000000000403b40 <Dot.dot>: + 403b40: push rbp + 403b41: mov rbp,rsp + 403b44: sub rsp,0x40 + 403b4b: mov QWORD PTR [rbp-0x30],rbx + 403b4f: xor ebx,ebx + 403b51: mov QWORD PTR [rbp-0x28],r12 + 403b55: xor r12d,r12d + 403b58: mov QWORD PTR [rbp-0x20],rdx + 403b5c: mov QWORD PTR [rbp-0x18],rcx + 403b60: xor ebx,ebx + 403b62: mov r8,rsi

The listing is what the encoder meant; objdump is what the processor will read. They tell the same story.

Save a program under its module’s name and run it with raz run Name.raz.

← System callsContents
diff --git a/site/public/advanced/static.html b/site/public/advanced/static.html index c4325cf..5b9a1ae 100644 --- a/site/public/advanced/static.html +++ b/site/public/advanced/static.html @@ -65,7 +65,7 @@ $ ldd Bare not a dynamic executable $ ls -l Bare | awk '{print $5, "bytes"}' -26184 bytes +26280 bytes

It is statically linked: no interpreter, no shared libraries, no libc. ldd says so.

What it does when it runs

strace lists every system call a program makes. This is the whole of it:

@@ -134,15 +134,15 @@
$ raz Lean.raz
 $ raz Heavy.raz
 $ ls -l Lean Heavy | awk '{print $9, $5}'
-Heavy 28392
-Lean 28384
+Heavy 28496 +Lean 28480

The sizes differ by a few bytes, not by the hundreds of kilobytes that the table and the procedure would take: they are not in the executable at all. You can link in a library module without worrying what else it offers.

Stripping

-s leaves out what is there for finding faults: the symbols and line numbers, the places a failure is told by, and the profiler. It is for the final build of a size-conscious program; the default keeps them so that gdb and failure messages work.

$ raz -s -o Lean-stripped Lean.raz
 $ ls -l Lean Lean-stripped | awk '{print $9, $5}'
-Lean 28384
-Lean-stripped 6720
+Lean 28480
+Lean-stripped 6848
 $ ./Lean-stripped
 same program

raz -S Lean.raz is the other direction: it prints the machine code the compiler made, one source line at a time. The next two parts of the tour use it.

Save a program under its module’s name and run it with raz run Name.raz.

← Writing an allocatorContents
diff --git a/site/public/index.html b/site/public/index.html index fa50002..5e4e0bb 100644 --- a/site/public/index.html +++ b/site/public/index.html @@ -35,13 +35,13 @@ 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.

-

The compiler is one Free Pascal program of about 9,100 lines. It makes +

The compiler is written in raz, about 10,500 lines, and builds itself. It makes x86-64 machine code and the ELF file itself, with no assembler or linker, in -one pass, at about 900,000 lines a second.

+one pass, at about 500,000 lines a second.

- ~9,100 lines of compiler - ~900K lines compiled a second + ~10,500 lines of compiler + ~500K lines compiled a second static executables, no run time to install 1 report, about 30 pages
diff --git a/site/public/spec.html b/site/public/spec.html index c460eaf..357d946 100644 --- a/site/public/spec.html +++ b/site/public/spec.html @@ -36,7 +36,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 report defines the language. It is short on purpose. Whatever it doesn’t allow, raz doesn’t have.

-

This is version 2026-10.20 of the report; section 12 says what each version changed. 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.

+

This is version 2026-10.21 of the report; section 12 says what each version changed. 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.

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;
@@ -494,7 +494,13 @@
 | dot:        area := 0.0;
 end;

match runs the arm of the case s holds. An arm may name the case’s fields, in order, all of them; the names stand for those fields of s itself, so assigning to one changes s; if s isn’t a variable, they stand for the fields of a copy. An arm may also leave the fields unnamed. Every case must have an arm, and only one, unless there is an | else: arm, which must come last.

-

match on an enumeration works the same way: each arm names one of the enumeration’s names.

+

match on an enumeration works the same way: each arm names one of the enumeration’s names, or several, separated by commas, for the arm to run when the value is any of them:

+
match op of
+| sPlus, sMinus: kind := additive;
+| sTimes:        kind := multiplicative;
+| else:
+end;
+

Every name must have an arm, and only one, unless there is an | else: arm. A variant’s arm names one case: the fields it may name belong to that case alone.

match on an integer runs the arm whose labels hold its value:

match ch of
 | ' ', '\t':      skip := true;
@@ -1096,6 +1102,7 @@
 
  • 2026-10.18. A code procedure takes and returns slices (section 8).
  • 2026-10.19. The library gains Bytes (section 11).
  • 2026-10.20. try: a call of a procedure whose last result is an ERROR, which makes the procedure it stands in return that error when it isn’t nil (sections 2, 5.8, 6, 7.8 and appendix B). try becomes a reserved word, which breaks a program with a name try.
  • +
  • 2026-10.21. An arm of a match on an enumeration may name several of its names (section 7.4).
  • Appendix A. What an implementation chooses

    Everything in this report binds every implementation of raz, except what follows, which each chooses for itself and documents. This compiler’s choices are in doc/compiler.md, under “This compiler’s choices”. The programs in conform/ are how an implementation shows that it follows this report: it passes them all, its reals aside where its target has none; conform/check.sh runs them.

    diff --git a/site/public/tour/hello.html b/site/public/tour/hello.html index 6c85aac..ff01fe0 100644 --- a/site/public/tour/hello.html +++ b/site/public/tour/hello.html @@ -70,7 +70,7 @@ $ raz run Quiet.raz hello, again $ ls -l Quiet | awk '{print $5, "bytes"}' -28392 bytes
    +28488 bytes

    The program is a static executable with no run time besides the code it uses, so it is a few kilobytes, and runs without any library installed.

    What Out can write

    Out is the library's buffered output. It writes strings, single characters, numbers in decimal or hexadecimal, and a line feed. A string is written as it is, with \n for a line feed, \t for a tab, \" and \\.