raz / commit 2028817d

commit
2028817dbae03b4a8a5e11d82042631edf403b3e
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
41d060be
Report 10.22.3: the readings the compiler took are in the report

patch · log

1 file changed, +19 -13

doc/raz.md (history) modified +19 -13

@@ -64,7 +64,8 @@
6464 while xor
6565 ```
6666
67-`static`, in `link static;` (section 3), isn't one.
67+`static`, in `link static;` (section 3), and `check` and `off`, in
68+`check off;` (section 3), aren't reserved.
6869
6970 **Predeclared names** are the basic types (section 5.1), `ERROR`,
7071 `true`, `false`, `nil` and the built-in procedures (section 6.8). They
@@ -276,8 +277,7 @@
276277 whatever memory it reaches, and what follows isn't defined. Every other
277278 check stays, and the module's callers keep theirs. An instance of a
278279 generic module follows the generic module's own `check` line, not that
279-of the module that made it. `check` and `off` aren't reserved words, as
280-`static` isn't.
280+of the module that made it.
281281
282282 ## 4. Declarations
283283
@@ -576,7 +576,9 @@
576576 between `F32` and `F64`, without a written conversion (section 6.7).
577577 Results passed on whole need the same types exactly: in `a, b :=
578578 f(x)` and in `return f(x)`, an `INT` result doesn't pass up as an
579-`I64`. Elsewhere, `return n, n` included, an `INT` widens as above.
579+`I64`. Elsewhere, `return n, n` included, an `INT` widens as above; the
580+bounds of a `for` and the step of `INC` and `DEC` take the type of the
581+variable they work on, and an `INT` is not widened to it.
580582
581583 ## 6. Expressions
582584
@@ -645,7 +647,8 @@
645647 for `x: U8`, `x shl 9` is `x shl 1`. `shr` brings in copies of the
646648 sign bit for signed types and zeros for unsigned ones. `n` may be of
647649 any integer type. The result has `x`'s type, cut to its width: in
648-`U8`, `0C0H shl 1` is `80H`.
650+`U8`, `0C0H shl 1` is `80H`. If `x` is an untyped constant, so is the
651+result, and it doesn't wrap: `1 shl 9` is 512, which doesn't fit a `U8`.
649652
650653 Relations compare as signed or unsigned according to the type.
651654
@@ -761,9 +764,10 @@
761764
762765 There are no others: no conversion between `BOOL` and integers, none
763766 between pointers and integers other than `INT` and `UINT`, and none to
764-or from records, arrays, slices, variants or `ERROR`. A
765-conversion of a constant is made by the compiler, by the same rules:
766-`U8(300)` is 44.
767+or from records, arrays, slices, variants or `ERROR`. An untyped integer constant converts to a pointer as an `INT` does, as
768+in `^VOLATILE U32(0FEE00000H)`; it isn't assigned to a pointer without
769+the conversion. A conversion of a constant is made by the compiler, by
770+the same rules: `U8(300)` is 44.
767771
768772 ### 6.8 Built-in procedures
769773
@@ -895,7 +899,8 @@
895899 end;
896900 ```
897901
898-`match` runs the arm of the case `s` holds. An arm may name the case's
902+`match` takes a variant, an enumeration or an integer type (a `U8`
903+included); other types are an error. It runs the arm of the case `s` holds. An arm may name the case's
899904 fields, in order, all of them; the names stand for those fields of `s`
900905 itself, so assigning to one changes `s`; if `s` isn't a variable, they
901906 stand for the fields of a copy. An arm may also leave the fields
@@ -929,8 +934,9 @@
929934 ```
930935
931936 A label is a constant, or `lo .. hi`, the constants from `lo` to `hi`,
932-both included (unlike a slice, which leaves `hi` out). Each must fit
933-the integer's type, and no value may be in two labels. An integer
937+both included (unlike a slice, which leaves `hi` out; `lo` may not be
938+above `hi`). Each must fit the integer's type, and no value may be in
939+two labels. An integer
934940 `match` must have an `| else:` arm, which may be empty. Whether an arm
935941 names a case or gives labels is set by the type matched: `| Max:` is a
936942 case of a variant or an enumeration, and a constant for an integer.
@@ -1004,8 +1010,8 @@
10041010 ```
10051011
10061012 `return e;` evaluates `e` before the deferred statements run. A
1007-deferred statement can't contain `return`, `break`, `defer` or `try`
1008-that would leave it. A failed check, `Rt.exit` and `Sys.exit` end the
1013+deferred statement can't contain `defer`, nor a `return`, `break` or
1014+`try` that would leave it. A failed check, `Rt.exit` and `Sys.exit` end the
10091015 program without running the deferred statements still pending.
10101016
10111017 ### 7.8 Try