raz / commit f8e1140a

commit
f8e1140ad8ac0dd12ced811eba5c6ac9a14484d3
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
40536519
raz(7), the tutorial and CLAUDE.md for report 2026-10.31

The small types widening to INT and what an operator made not, an
enumeration's name with its type, continue and the step before it; the
readings the milestone took.

patch · log

3 files changed, +103 -20

CLAUDE.md modified +14 -0

@@ -230,6 +230,20 @@
230230 installed without `SA_RESTART`, so a call it breaks into is -4, which
231231 `Out` and `Files` try again. Over C, `ready` and `readyFor` try `poll`
232232 again after EINTR only when no signal `handle` took broke in.
233+- `U8`, `I8` and `I16` widen to `INT`, `U8` and `U16` to `UINT`, one
234+ step only (a `U8` into an `I64` is written), and not in `return f(x)`
235+ (report 2026-10.31). An operator's result on them (`made`) doesn't
236+ widen; a conversion's does, `U8(a + b)` too.
237+- An enumeration's name shared in its scope with another enumeration's
238+ is written with its type; shared with anything else, the name alone is
239+ that other declaration. A `match` arm on an enumeration takes the
240+ type's names alone or with the type, which must be the matched one.
241+- `continue` is the last reserved word, so that the others keep the
242+ seed's numbers; the seed's dumpers intern it first
243+ (`src/test/seedcontinue.pas`).
244+- `Width` follows glibc's `wcwidth` but gives a control 0, and 0 to the
245+ format characters glibc counts as 1 (Egyptian hieroglyph controls,
246+ interlinear annotation), but for the prepended concatenation marks.
233247 - An `extern` module variable is read-only for an importer, as the
234248 report says of every exported variable (3).
235249 - Warnings come only for a module with no errors. A procedure naming

doc/raz-tutorial.7 (history) modified +45 -8

@@ -184,15 +184,32 @@
184184 Arithmetic wraps at the type's width, and never stops the program,
185185 except dividing by zero.
186186 .Pp
187-Two types never mix but for one:
187+Two types never mix but where nothing can be lost:
188188 .Cm INT
189-into
189+goes into
190190 .Cm I64 ,
191-which loses nothing, wherever the one meets the other, so with
191+wherever the one meets the other, so with
192192 .Cm "big: I64" ,
193193 .Cm "big + n"
194194 is an
195-.Cm I64 .
195+.Cm I64 ;
196+and
197+.Cm U8 , I8
198+and
199+.Cm I16 ,
200+which an
201+.Cm INT
202+holds on any machine, go into
203+.Cm INT ,
204+so a digit's value is
205+.Cm "n := n * 10 + s[i] - '0'" .
206+What an operator made in a small type doesn't, since it may have
207+wrapped there: with
208+.Cm "a, b: U8" ,
209+.Cm "n := a + b"
210+is an error, and
211+.Cm "INT(a) + b"
212+the sum.
196213 With
197214 .Cm "c: I32" ,
198215 .Cm "c < n"
@@ -398,6 +415,19 @@
398415 empty slice,
399416 .Cm "0 to LEN(s) - 1"
400417 doesn't run at all.
418+.Cm break
419+leaves a loop, and
420+.Cm continue
421+ends its round: a
422+.Cm for
423+steps, and a
424+.Cm while
425+tests again; so a
426+.Cm while
427+moves on, as
428+.Cm "i := i + n" ,
429+before it can
430+.Cm continue .
401431 .Sh 6. RECORDS AND POINTERS
402432 .Bd -literal -offset indent
403433 module Boxes;
@@ -853,9 +883,11 @@
853883 when the program leaves the statements the
854884 .Cm defer
855885 stands in: at their end, or by a
856-.Cm return
886+.Cm return ,
887+a
888+.Cm break
857889 or a
858-.Cm break .
890+.Cm continue .
859891 Deferred statements run the last first, and only those whose
860892 .Cm defer
861893 was reached.
@@ -980,7 +1012,11 @@
9801012 01
9811013 .Ed
9821014 .Pp
983-An enumeration is a list of names, in order; a
1015+An enumeration is a list of names, in order, each of which may be
1016+written with its type,
1017+.Cm Color.red ;
1018+two enumerations may share a name, which is then always written so.
1019+A
9841020 .Cm "set of"
9851021 it holds any choice of them, in the bits of a word, with
9861022 .Cm in ,
@@ -1219,7 +1255,8 @@
12191255 .It "if (c) {...}" Ta "if c then begin" Ta "if c then ... end;"
12201256 .It "for (i=0; i<n; i++)" Ta "for i := 0 to n-1 do" Ta "for i := 0 to n - 1 do"
12211257 .It "switch (c)" Ta "case c of" Ta "match c of | 1: ..."
1222-.It "continue, goto" Ta "goto" Ta "none: break only"
1258+.It "continue" Ta "continue" Ta "continue;"
1259+.It "goto" Ta "goto" Ta "none"
12231260 .It "union" Ta "variant record" Ta "variant"
12241261 .It "struct p {...}" Ta "record ... end" Ta "record ... end"
12251262 .It "&x" Ta "@x" Ta "ADR(x)"

doc/raz.7 (history) modified +44 -12

@@ -66,9 +66,9 @@
6666 The reserved words, all lowercase but
6767 .Cm VOLATILE :
6868 .Bd -literal -offset indent
69-and begin break by code const defer div do else elsif end
70-extern for forward if import in link match mod module not of
71-or packed proc record repeat return set shl shr then to try
69+and begin break by code const continue defer div do else elsif
70+end extern for forward if import in link match mod module not
71+of or packed proc record repeat return set shl shr then to try
7272 type until var variant VOLATILE while xor
7373 .Ed
7474 .Pp
@@ -113,7 +113,7 @@
113113 | "for" Name ":=" Expr "to" Expr [ "by" Expr ]
114114 "do" Stmts "end"
115115 | "match" Expr "of" { "|" Arm } "end"
116- | "return" [ Exprs ] | "break" | "defer" Stmt .
116+ | "return" [ Exprs ] | "break" | "continue" | "defer" Stmt .
117117 Arm = ( Case [ "(" Names ")" ] | Label { "," Label } | "else" )
118118 ":" Stmts .
119119 Stmts = { Stmt ";" } .
@@ -178,7 +178,7 @@
178178 .It Sy Type Ta Sy Size Ta Sy Values
179179 .It "I8 I16 I32 I64" Ta "1, 2, 4, 8" Ta "signed, two's complement"
180180 .It "U8 U16 U32 U64" Ta "1, 2, 4, 8" Ta "unsigned"
181-.It "INT, UINT" Ta "8" Ta "as big as an address"
181+.It "INT, UINT" Ta "8" Ta "as big as an address, 16 bits at least"
182182 .It "BOOL" Ta "1" Ta "false, true"
183183 .It "F32, F64" Ta "4, 8" Ta "IEEE 754"
184184 .It "ERROR" Ta "8" Ta "nil, or a constant's error"
@@ -188,6 +188,11 @@
188188 .It "(a, b, c)" Ta "1" Ta "an enumeration, 256 names at most"
189189 .It "set of E" Ta "1, 2, 4, 8" Ta "bit i for E's name i, 64 at most"
190190 .El
191+.Pp
192+An enumeration's name may be written with its type,
193+.Cm Color.red ,
194+and must be where another declaration of its scope has the name too
195+[5.7].
191196 .Bl -bullet
192197 .It
193198 A
@@ -246,7 +251,7 @@
246251 .Cm []U8 , ^U8
247252 (with a zero byte after it) or
248253 .Cm [n]U8 ,
249-a procedure into its type, and
254+a procedure into its type,
250255 .Cm INT
251256 into
252257 .Cm I64 ,
@@ -255,7 +260,24 @@
255260 .Cm U64 ,
256261 wherever it goes, results passed on whole and a
257262 .Cm for Ns 's
258-bounds too
263+bounds too, and
264+.Cm U8 , I8
265+and
266+.Cm I16
267+into
268+.Cm INT ,
269+.Cm U8
270+and
271+.Cm U16
272+into
273+.Cm UINT ,
274+in the same places but for results passed on whole, unless an
275+operator made them: with
276+.Cm "a, b: U8" ,
277+.Cm "n := a + b"
278+is an error, and
279+.Cm "n := INT(a) + b"
280+is the sum
259281 [5.10].
260282 Anything else is converted by name.
261283 .Sh OPERATORS
@@ -494,16 +516,26 @@
494516 .Cm while , repeat
495517 or
496518 .Cm for .
519+.It Cm continue
520+To the end of the innermost loop's round: a
521+.Cm while
522+or a
523+.Cm repeat
524+tests again, a
525+.Cm for
526+steps; so a
527+.Cm while Ns 's
528+step comes before it.
497529 There is no
498-.Cm goto
499-and no
500-.Cm continue .
530+.Cm goto .
501531 .It Cm defer
502532 Runs its statement when the statements it stands in end, by their end,
503533 a
504-.Cm return
534+.Cm return ,
535+a
536+.Cm break
505537 or a
506-.Cm break ;
538+.Cm continue ;
507539 the last first.
508540 .El
509541 .Pp