implements PR-19.1 normative spec propagation
This commit is contained in:
@@ -77,7 +77,7 @@ Active keywords in `.pbs`:
|
||||
|
||||
- `import`, `from`, `as`
|
||||
- `service`, `host`, `fn`, `apply`, `bind`, `new`, `implements`, `using`, `ctor`
|
||||
- `declare`, `struct`, `contract`, `error`, `enum`, `callback`, `Self`, `this`
|
||||
- `declare`, `struct`, `contract`, `error`, `enum`, `callback`, `global`, `Self`, `this`
|
||||
- `pub`, `mut`
|
||||
- `let`, `const`
|
||||
- `if`, `else`, `switch`, `default`, `for`, `from`, `until`, `step`, `while`, `break`, `continue`, `return`
|
||||
@@ -154,6 +154,7 @@ BarrelItem ::= BarrelFnItem
|
||||
| BarrelErrorItem
|
||||
| BarrelEnumItem
|
||||
| BarrelServiceItem
|
||||
| BarrelGlobalItem
|
||||
| BarrelConstItem
|
||||
| BarrelCallbackItem
|
||||
BarrelVisibility ::= 'mod' | 'pub'
|
||||
@@ -165,6 +166,7 @@ BarrelHostItem ::= BarrelVisibility 'host' Identifier ';'
|
||||
BarrelErrorItem ::= BarrelVisibility 'error' Identifier ';'
|
||||
BarrelEnumItem ::= BarrelVisibility 'enum' Identifier ';'
|
||||
BarrelServiceItem ::= BarrelVisibility 'service' Identifier ';'
|
||||
BarrelGlobalItem ::= BarrelVisibility 'global' Identifier ';'
|
||||
BarrelConstItem ::= BarrelVisibility 'const' Identifier ';'
|
||||
BarrelCallbackItem ::= BarrelVisibility 'callback' Identifier ';'
|
||||
```
|
||||
@@ -187,6 +189,7 @@ Rules:
|
||||
- A `struct` barrel entry governs the visibility of the struct declaration and of all methods declared directly in that struct body.
|
||||
- A `host` barrel entry governs the visibility of the host declaration and of all method signatures declared directly in that host body.
|
||||
- A `service` barrel entry governs the visibility of the service declaration, its canonical singleton value, and all methods declared directly in that service body.
|
||||
- A `global` barrel entry governs visibility of one top-level `declare global` declaration.
|
||||
- Methods declared inside a `struct`, `host`, or `service` are never exported independently through `mod.barrel`.
|
||||
|
||||
Example:
|
||||
@@ -199,6 +202,7 @@ pub contract TickLike;
|
||||
pub host Gfx;
|
||||
pub enum GameState;
|
||||
pub service Physics;
|
||||
pub global Palette;
|
||||
pub callback TickCb;
|
||||
```
|
||||
|
||||
@@ -245,7 +249,9 @@ Rules:
|
||||
- An attribute attaches syntactic metadata to the declaration surface that immediately follows it.
|
||||
- Attributes do not introduce values, types, callables, or modules by themselves.
|
||||
- In v1 core, ordinary user-authored modules MUST reject attributes unless another specification explicitly permits them.
|
||||
- Ordinary userland source MAY use `[Init]` and `[Frame]` only on top-level `fn` declarations.
|
||||
- Reserved stdlib/toolchain interface modules MAY use attributes where explicitly allowed by syntax and semantics.
|
||||
- Reserved stdlib/toolchain interface modules MAY additionally use `[InitAllowed]` only on `declare host` method signatures where another specification explicitly permits it.
|
||||
- Attribute interpretation is compile-time only unless another specification explicitly lowers its effect into runtime-facing metadata.
|
||||
- Reserved attribute names used by builtin-type and intrinsic shells do not become ordinary value-level syntax.
|
||||
- `Slot(...)` is not part of the v1 attribute surface; source that uses `Slot` must be rejected in syntax phase.
|
||||
@@ -253,7 +259,7 @@ Rules:
|
||||
### 6.2 Top-level declarations
|
||||
|
||||
```ebnf
|
||||
TopDecl ::= TypeDecl | CallbackDecl | FunctionDecl | ConstDecl | ImplDecl
|
||||
TopDecl ::= TypeDecl | CallbackDecl | FunctionDecl | GlobalDecl | ConstDecl | ImplDecl
|
||||
```
|
||||
|
||||
Top-level `let` forms and top-level executable statements are forbidden.
|
||||
@@ -294,6 +300,7 @@ EnumCaseDecl ::= Identifier ('=' IntLit)?
|
||||
ImplDecl ::= 'implements' Identifier 'for' Identifier 'using' Identifier ImplBody
|
||||
ImplBody ::= '{' ImplMethodDecl* '}'
|
||||
ImplMethodDecl ::= 'fn' Identifier ParamList ReturnAnn? Block
|
||||
GlobalDecl ::= 'declare' 'global' Identifier ':' TypeRef '=' Expr ';'
|
||||
```
|
||||
|
||||
Rules:
|
||||
@@ -329,6 +336,11 @@ Rules:
|
||||
- Builtin method signatures MAY carry reserved VM-owned metadata such as `IntrinsicCall(...)`.
|
||||
- `declare error` bodies contain only error case labels.
|
||||
- `declare enum` uses a parenthesized case list and ends with `;`.
|
||||
- `declare global Name: T = expr;` declares module-owned runtime storage.
|
||||
- `declare global` requires an explicit type annotation and an explicit initializer.
|
||||
- `declare global` is distinct from `declare const` and is not syntactic sugar for `const`.
|
||||
- `declare global` participates in `mod.barrel` visibility only through explicit `global` entries.
|
||||
- The admissible initializer slice for `declare global` is intentionally restricted by static semantics.
|
||||
- Error case labels in the same `declare error` body must be unique.
|
||||
- Enum case labels in the same `declare enum` must be unique.
|
||||
- If no enum case uses `=`, case identifiers default to ascending integer values starting at `0` in declaration order.
|
||||
@@ -416,6 +428,7 @@ Rules:
|
||||
- Methods declared inside a `declare host` body are signature-only host-backed call surfaces.
|
||||
- A host method signature in a reserved stdlib/interface module MAY carry attributes.
|
||||
- `[Host(module = "...", name = "...", version = N)]` is the canonical reserved attribute surface for host-binding metadata in v1 core.
|
||||
- `[InitAllowed]` is a reserved SDK-only attribute surface for host methods admitted during init.
|
||||
- Service-shaped wrappers over host calls MAY exist as SDK/stdlib design patterns, but they do not replace canonical `declare host` bindings.
|
||||
|
||||
### 7.6 Top-level constants
|
||||
|
||||
Reference in New Issue
Block a user