diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-16 09:41:13 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-16 09:41:13 +0000 |
| commit | db6ac29d0ac769ff780f3901ed987b97965f3f5e (patch) | |
| tree | c7d5f4b06712aefa2a885f338143aec9fe68e322 /AGENTS | |
| parent | 7ee2b877cf396e680582b4a2d6094d4f3ad89abb (diff) | |
refactor(parser): split expression and control flow parsing
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
| -rw-r--r-- | AGENTS/ARCH.md | 5 | ||||
| -rw-r--r-- | AGENTS/EXTENDING.md | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/AGENTS/ARCH.md b/AGENTS/ARCH.md index 216187f..1a3979c 100644 --- a/AGENTS/ARCH.md +++ b/AGENTS/ARCH.md @@ -260,10 +260,11 @@ do not modify the real release for local verification. |---|---| | `include/cps/` | All headers, included as `"cps/Foo.h"` | | `lib/Lexer/Lexer.cc` | Entire lexer: one function, `Lexer::gettok()` | -| `lib/Parser/Parser.cc` | Statements, expressions, designators, precedence table | +| `lib/Parser/Parser.cc` | Entry point, statement dispatch, assignment parsing and error recovery | +| `lib/Parser/ParserExpression.cc`, `ParserControlFlow.cc` | Expressions/designators and control-flow statement parsing | | `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 and CLASS/ENDCLASS declarations, shared field parsing, SET/DEFINE reserved stubs | +| `lib/Parser/ParserType.cc` | Type names, variable/array declarations, 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/CTypeGen.cc` | CodeGen methods for native C scalar conversions, casts, arithmetic and input/output | diff --git a/AGENTS/EXTENDING.md b/AGENTS/EXTENDING.md index a396867..b859c9d 100644 --- a/AGENTS/EXTENDING.md +++ b/AGENTS/EXTENDING.md @@ -6,8 +6,8 @@ below assumes those invariants. **New statement:** token in `Lexer.h` enum + keyword match in `Lexer.cc`'s if-chain → node class in `AST.h` or a feature header (`FunctionAST.h`/`FileAST.h` precedent; unique_ptr children, move ctor, raw-ptr getters) → `ParseXxx` in -`Parser.cc` + branch in `ParseStatementImpl` (block statements parse their body with -`ParseBlock({terminator tokens})`; comma-separated expression lists use +the matching `Parser*.cc` file + branch in `ParseStatementImpl` (block statements parse their body with +`ParseBlock({terminator tokens})`; control-flow parsers live in `ParserControlFlow.cc`; comma-separated expression lists use `ParseExprList(close, allowEmpty)`; add the new statement's leading keyword to `syncToStatementStart`) → `dynamic_cast` branch in `CodeGen::emitStmt`. Guard every fall-through branch in control-flow codegen with @@ -32,7 +32,7 @@ STRING operands by pseudocode type then call `StringHandler::emitCompare`. **New builtin type:** register in `TypeSystem::registerBuiltins` (sizes are derived — never hand-written) + `TypeKind` case in the **exhaustive, default-less switches**: `getZeroValue`, `coerceValueToType`, `emitOutputValue`, `TypeInfo::isOutputtable`, -the INPUT branch in CodeGen + lexer keyword + `ParseTypeName` case. The compiler +the INPUT branch in CodeGen + lexer keyword + `ParseTypeName` case in `ParserType.cc`. The compiler warns on a missing enumerator — that is the anti-silent-fall-through mechanism; never add a `default`. |
