diff --git a/docs/specs/pbs/3. Core Syntax Specification.md b/docs/specs/pbs/3. Core Syntax Specification.md index 01aad0e3..f27a105e 100644 --- a/docs/specs/pbs/3. Core Syntax Specification.md +++ b/docs/specs/pbs/3. Core Syntax Specification.md @@ -437,9 +437,12 @@ Rules: - Tuple types in PBS core are always named. - Single-slot tuple types are allowed only in type/signature surface, not as tuple literals. - General user-defined generics are not part of PBS core v1. +- `SimpleType` may denote either a visible nominal type identifier or one of the predeclared builtin simple types. +- The predeclared builtin simple types in v1 core are `int`, `float`, `bool`, and `str`. +- Builtin simple types are always available in type position and do not require import. - `optional T` is the canonical optional-type syntax in all type positions. - `optional void` and `optional ()` are invalid. -- `Self` is valid only inside struct method and `ctor` declarations and refers to the enclosing struct type. +- `Self` is valid only inside struct method declarations, service method declarations, and `ctor` declarations, and refers to the enclosing owner type. ## 9. Statements and blocks @@ -606,11 +609,10 @@ A conformant parser MUST: At minimum, deterministic diagnostics are required for: +Diagnostics that require name resolution, overload resolution, or type context are defined by the Static Semantics specification and are not duplicated here. + - missing `mod.barrel`, - duplicate barrel entries (including duplicate `fn` signatures), -- unresolved or ambiguous `fn` barrel signatures, -- unresolved host barrel entries, -- unresolved callback barrel entries, - invalid `error` declaration shape, - invalid `enum` declaration shape, - invalid `struct` declaration shape, @@ -627,7 +629,6 @@ At minimum, deterministic diagnostics are required for: - use of return-surface `result<...>` outside function return annotations, - invalid `handle` mapping clauses (syntax form), - invalid `some(...)` construction form, -- invalid `none` usage without optional type context, - invalid `ok(...)` construction form, - invalid `err(...)` construction form, - use of `ok(...)` or `err(...)` outside `return`, @@ -639,18 +640,12 @@ At minimum, deterministic diagnostics are required for: - invalid `new` construction form, - invalid enum case path, - invalid callback declaration shape, -- invalid `Self` type usage, -- invalid `this` usage, - invalid struct field access modifier surface, - invalid struct method declaration shape, - invalid service method declaration shape, - invalid `ctor` declaration shape, - duplicate enum case label, - duplicate enum case identifier, -- incompatible callback assignment target, -- ambiguous overloaded function assignment to callback, -- incompatible `bind(...)` target, -- ambiguous overloaded function target in `bind(...)`, - malformed `apply` clause, - attempted single-slot tuple literal, - positional tuple expression without expected named tuple shape, @@ -660,8 +655,6 @@ At minimum, deterministic diagnostics are required for: - invalid assignment targets (`LValue` violations), - top-level executable statements, - `const` used outside `declare const` or `let const`, -- non-constant `declare const` initializer, -- duplicate declaration names in the same namespace/scope (as defined by semantic phase), - use of reserved syntax words as active constructs. ## 13. `optional` diff --git a/docs/specs/pbs/4. Static Semantics Specification.md b/docs/specs/pbs/4. Static Semantics Specification.md index 6bce0cd8..78ad9bc0 100644 --- a/docs/specs/pbs/4. Static Semantics Specification.md +++ b/docs/specs/pbs/4. Static Semantics Specification.md @@ -47,6 +47,9 @@ Rules: - `bind(...)` is a callback-formation construct, not a general function-value construct. - `declare host` declarations are reserved to SDK/toolchain-controlled modules and are not formable in ordinary user-authored PBS source. - A host owner name is not an ordinary value expression in v1 core; it is used only as a qualified host-call owner. +- The builtin simple types `int`, `float`, `bool`, and `str` are always present in the type namespace. +- Builtin simple types are resolved without import or declaration. +- User-authored type declarations must not reuse builtin simple type names. ### 2.3 Attribute metadata @@ -196,7 +199,7 @@ Rules: - `if`, `switch`, `handle`, `else` extraction, or `!` result propagation, - method calls or member access except enum case paths. - The initializer type must be compatible with the declared `const` type. -- A `pub const` may be imported from another module only through ordinary module import rules. +- A `declare const` exported through `mod.barrel` may be imported from another module only through ordinary module import rules. - A `declare const` does not introduce mutable runtime storage; implementations may inline, fold, or materialize it as an immutable constant as long as observable semantics remain unchanged. ### 3.5 Enum declarations and values @@ -604,6 +607,7 @@ Rules: At minimum, deterministic static diagnostics are required for: - duplicate parameter names in `fn` declarations, +- duplicate declaration names in the same namespace/scope, - duplicate output labels in named tuple returns, - duplicate error case labels in `declare error`, - duplicate enum case labels in `declare enum`, @@ -666,6 +670,7 @@ At minimum, deterministic static diagnostics are required for: - invalid mixed `optional`/`result` return surface, - invalid payload-less `optional` type surface, - invalid `optional void` type surface, +- invalid reuse of a builtin simple type name for a user-authored type declaration, - missing explicit type annotation on `declare const`, - non-constant `declare const` initializer, - incompatible `declare const` initializer type, diff --git a/docs/specs/pbs/5. Manifest, Stdlib, and SDK Resolution Specification.md b/docs/specs/pbs/5. Manifest, Stdlib, and SDK Resolution Specification.md index 8151b622..22aefb07 100644 --- a/docs/specs/pbs/5. Manifest, Stdlib, and SDK Resolution Specification.md +++ b/docs/specs/pbs/5. Manifest, Stdlib, and SDK Resolution Specification.md @@ -22,7 +22,7 @@ This document is the authority for how the compiler discovers and loads: - and compile-time-only host-binding metadata attached to those reserved modules. This document does not define runtime load behavior. -PBX host-binding emission and loader-side syscall resolution are defined by the Host ABI Binding specifications. +PBX host-binding emission and loader-side syscall resolution are defined by the Host ABI Binding and Loader Resolution Specification. ## 2. Scope @@ -285,7 +285,7 @@ Rules: ### 9.2 Allowed role -An interface module exists to provide: +At minimum, an interface module may provide: - exported names, - types, @@ -294,6 +294,8 @@ An interface module exists to provide: - method signatures, - compile-time metadata such as canonical host-binding attributes. +This list fixes the currently required declarative role of interface modules, but does not by itself freeze the final complete declaration set allowed in interface-module mode. + An interface module is not runtime code. ### 9.3 Interface-module restrictions diff --git a/docs/specs/pbs/6. Host ABI Binding and Loader Resolution Specification.md b/docs/specs/pbs/6. Host ABI Binding and Loader Resolution Specification.md index 5fce7588..cfddf1e6 100644 --- a/docs/specs/pbs/6. Host ABI Binding and Loader Resolution Specification.md +++ b/docs/specs/pbs/6. Host ABI Binding and Loader Resolution Specification.md @@ -1,6 +1,6 @@ # Host ABI Binding and Loader Resolution Specification -Status: Draft v1 +Status: Draft v1 (Temporary) Applies to: PBX host-binding metadata, cartridge load, canonical syscall resolution, and loader-side capability gating ## 1. Purpose @@ -27,7 +27,7 @@ This document defines: - the minimum PBX metadata required for load-time host resolution, - the pre-load opcode form used for host-backed call sites, - the required loader algorithm, -- the required loader patching step from symbolic host calls to numeric syscalls, +- the required loader patching step from pre-load host callsites to numeric syscalls, - the division of responsibility between loader-side ABI checks and verifier-side stack checks, - capability checks required during load, - deterministic loader failures for malformed or unauthorized host usage, diff --git a/docs/specs/pbs/7. Cartridge Manifest and Runtime Capabilities Specification.md b/docs/specs/pbs/7. Cartridge Manifest and Runtime Capabilities Specification.md index b78e6e1d..94828328 100644 --- a/docs/specs/pbs/7. Cartridge Manifest and Runtime Capabilities Specification.md +++ b/docs/specs/pbs/7. Cartridge Manifest and Runtime Capabilities Specification.md @@ -192,7 +192,7 @@ Packer: Loader: - reads the manifest, -- derives granted capability flags, +- derives or receives granted capability flags, - validates those capabilities against PBX host requirements. ## 10. Validation Rules diff --git a/docs/specs/pbs/8. Stdlib Environment Packaging and Loading Specification.md b/docs/specs/pbs/8. Stdlib Environment Packaging and Loading Specification.md index 6fbe37ad..7cc51243 100644 --- a/docs/specs/pbs/8. Stdlib Environment Packaging and Loading Specification.md +++ b/docs/specs/pbs/8. Stdlib Environment Packaging and Loading Specification.md @@ -42,7 +42,7 @@ Rules: - the stdlib is selected by the root project's `stdlib` major, - each stdlib line defines one stdlib environment, -- a stdlib environment exposes reserved project spaces such as `sdk` and `core`, +- a stdlib environment exposes reserved project spaces such as `@sdk:*` and `@core:*`, - each reserved project space contains one or more modules, - each module is represented as PBS source plus `mod.barrel`.