You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/SPECIFICATION.html
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,9 @@
94
94
95
95
AsymbolMAYbedeclaredwithoutavalueusing`TYPE name`.Suchadeclarationrecordsthesymbol's static type but does not create a readable runtime binding until an assignment occurs. The type and name MUST be separated by one or more space characters, and no other character MAY appear between them.
96
96
97
-
ThefirstassignmenttoasymbolMUSTuseatypedformsuchas`TYPE name = expression`,withoneormorespacesbetweenthetypeandnameandoptionalspacesaround`=`.SubsequentassignmentsMAYomitthetypeannotation,butthesymbol's type MUST remain unchanged for the lifetime of that name, including after deletion and re-assignment.
97
+
For`INT`and`FLT`types,adeclarationMAYnameaspecificnumericbasebywriting`TYPE{base} name`,where`base`isan`INT`literalintherange`2`through`64`.Anamed-basetypeisasubtypeofitsparentnumerictype: `INT{base}`valuesare`INT`sand`FLT{base}`valuesare`FLT`s,butanassignmenttoanamed-basebindingrequiresthevalue's base to match the declared base. The parent types `INT` and `FLT` (equivalent to `INT{0}` and `FLT{0}`) accept values of any valid numeric base.
98
+
99
+
ThefirstassignmenttoasymbolMUSTuseatypedformsuchas`TYPE name = expression`or`TYPE{base} name = expression`,withoneormorespacesbetweenthetypeannotationandthenameandoptionalspacesaround`=`.SubsequentassignmentsMAYomitthetypeannotation,butthesymbol's type MUST remain unchanged for the lifetime of that name, including after deletion and re-assignment.
Prefix MUST support eight types: `BOOL` (booleans), `STR` (strings), `INT` (integers), `FLT` (floating-point numbers), `TNS` (tensors), `MAP` (maps), `FUNC` (functions), and `THR` (threads). The type of a symbol is determined when it is first declared, and cannot be changed, even after deletion of the original symbol.
174
176
177
+
`INT` and `FLT` additionally support named-base variants written `INT{base}` and `FLT{base}`, where `base` is a numeric base in the range `2` through `64` or `0` to denote the parent type. A named-base type and its parent are the same runtime type, but static type checking treats mismatched bases as incompatible. `INT` and `FLT` (base `0`) accept any valid numeric base; `INT{base}` and `FLT{base}` only accept values whose stored base equals the declared base.
178
+
175
179
---
176
180
177
181
### 4.0 Booleans
@@ -432,6 +436,8 @@
432
436
433
437
A declaration MUST record the symbol's static type without necessarily creating a readable runtime value. A readable binding is created only when a value is first assigned. In all type annotations, the type and name MUST be separated by one or more space characters, and other characters MUST NOT appear between them.
434
438
439
+
`INT` and `FLT` type annotations MAY include a base specifier written immediately after the type name with no intervening whitespace, in the form `INT{base}` or `FLT{base}`. The `{base}` suffix is part of the type annotation and therefore MUST appear before the required space that separates the type from the declared name. For example, `INT{0d2}value` declares a binary integer, while `FLT{0x}value` declares a hexadecimal float. A base of `0` (typically written as the bare type name) denotes the parent type and accepts any valid numeric base.
440
+
435
441
Reading an undeclared symbol, a declared-but-never-assigned symbol, or a deleted symbol MUST raise a runtime error. Removing a binding MUST preserve its recorded static type, so any later re-assignment to the same name MUST still match the original type.
436
442
437
443
Re-assignment MUST preserve the declared type for the lifetime of the symbol, including after deletion and re-creation. Symbol existence, lifetime, and mutability MAY be inspected or modified only through the language's dedicated symbol-management facilities.
0 commit comments