diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-13 13:45:03 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-13 13:45:03 +0000 |
| commit | 05cdcb6a1cc3d4de3a0b3d12d4babcd6438b4754 (patch) | |
| tree | d3e482d215d9d5feba8b40f9de15d6962f1e5bac /AGENTS | |
| parent | f5a2541ed3faf9a942b867e2d54577352153afce (diff) | |
Add record-derived classes with explicit field visibility
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
| -rw-r--r-- | AGENTS/ARCH.md | 2 | ||||
| -rw-r--r-- | AGENTS/PITFALLS.md | 10 | ||||
| -rw-r--r-- | AGENTS/SUBSYSTEMS.md | 9 |
3 files changed, 19 insertions, 2 deletions
diff --git a/AGENTS/ARCH.md b/AGENTS/ARCH.md index 247bce1..c837ea1 100644 --- a/AGENTS/ARCH.md +++ b/AGENTS/ARCH.md @@ -144,7 +144,7 @@ untested.) | `lib/Parser/Parser.cc` | Statements, expressions, designators, precedence table | | `lib/Parser/ParserFunction.cc` | FUNCTION/PROCEDURE/CALL/RETURN + parameter-list parsing | | `lib/Parser/ParserFile.cc` | OPENFILE/READFILE/WRITEFILE/CLOSEFILE parsing | -| `lib/Parser/ParserType.cc` | TYPE/ENDTYPE declarations, SET/DEFINE reserved stubs | +| `lib/Parser/ParserType.cc` | TYPE/ENDTYPE and CLASS/ENDCLASS declarations, shared field parsing, SET/DEFINE reserved stubs | | `lib/CodeGen/CodeGen.cc` | Hub: dispatch, coercion, control flow, INPUT/OUTPUT, main() | | `lib/CodeGen/Designator.cc` | CodeGen methods for the TYPE system: type pre-pass, `emitLValue`/`loadFromLValue`, `emitCoercedExpr` gate, user-kind binary-op interception | | `lib/CodeGen/*Handler.cc`, `FunctionGen.cc`, `RuntimeCheck.cc`, `TypeSystem.cc` | Helpers owned by CodeGen | diff --git a/AGENTS/PITFALLS.md b/AGENTS/PITFALLS.md index ea6a4d7..b70718c 100644 --- a/AGENTS/PITFALLS.md +++ b/AGENTS/PITFALLS.md @@ -71,11 +71,19 @@ test programs. followed by `.` is swallowed into a REAL literal, so `1.foo` mislexes (only already-invalid programs can hit it). +- **CLASS subset (§10).** `CLASS`/`ENDCLASS`/`PUBLIC`/`PRIVATE` are reserved. + CLASS is a top-level record-derived value type with mandatory per-field access + keywords (no DECLARE). Unlike the guide's default-public rule, omitting access + is an error. TYPE fields cannot specify access and remain public. Private fields + cannot be accessed externally; whole-value initialization/copying is allowed. + CLASS inherits record limitations, including no array fields or empty bodies. + ## Not implemented (9618 features) CASE OF, CONSTANT, SET types (`SET`/`DEFINE` are reserved with dedicated errors), random files (OPENFILE...FOR RANDOM/SEEK/GETRECORD/PUTRECORD — TYPE is done, so these are unblocked now; the RANDOM keyword is reserved and gives a dedicated parse error), DATE, INPUT into array elements, string escape sequences, -array-typed record fields, whole-array RETURN. No tests and no CI exist; verify +array-typed record fields, whole-array RETURN, class methods/constructors/destructors, +NEW and class inheritance. No compiler tests or CI exist; verify changes by compiling sample programs end-to-end (command sequence in `ARCH.md`). diff --git a/AGENTS/SUBSYSTEMS.md b/AGENTS/SUBSYSTEMS.md index ecdf3ff..0dafd12 100644 --- a/AGENTS/SUBSYSTEMS.md +++ b/AGENTS/SUBSYSTEMS.md @@ -52,6 +52,15 @@ FileHandler, is deliberately ignorant of user kinds). The enum range check after producer (constants, same-name copies, zero-init, memset-0 arrays) is valid by construction, which is why 0-based ordinals are load-bearing. +`ClassTypeDeclAST` inherits `RecordTypeDeclAST`: CLASS declarations use the same +two-pass registration, `TypeKind::Record`, `%record.NAME` layout and value semantics. +Shared body/field parsing lives in `ParserType.cc`. TYPE fields always have +`IsPublic = true`; CLASS fields require an explicit PUBLIC/PRIVATE keyword and +carry that flag through `defineRecord` into `RecordFieldInfo`. Both the static +designator type walk and `emitLValue` reject private field access, including +address-of, array elements and pointer dereferences. There is no class method +context or language-level inheritance yet. + **Runtime checks** (`RuntimeCheck`): array bounds, file misuse, enum ranges, null dereferences and array-parameter bounds contracts are checked at their emit sites. `ArithmeticHandler` calls `emitDivZeroCheck` before `/`, DIV and MOD; the check accepts |
