From efc86b5c7625cf4c7074319f42f68807a25bde9d Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 12:04:56 +0000 Subject: refactor: single builtin registry, retire keyword route for builtins All 11 builtins now live in one static {Name, Arity, ReturnTypeName} table in CodeGen.cc: emitExpr checks arity against it (uniform "Error: X expects N args" diagnostics) and getExprTypeInfo reads return types from it, removing the duplicated hard-coded table. LENGTH/MID/RIGHT/LEFT/LCASE/UCASE lose their lexer tokens and ParseStringBuiltin; they parse as ordinary identifier calls exactly like ASC/CHR/IS_NUM/NUM_TO_STR/STR_TO_NUM already did. Behavior note: these six names are no longer reserved words. AGENTS docs updated for the new builtin story and the batch-1 error contract (exit codes, verifyModule, fixed descending FOR). Co-Authored-By: Claude Fable 5 --- lib/Lexer/Lexer.cc | 7 ------- 1 file changed, 7 deletions(-) (limited to 'lib/Lexer/Lexer.cc') diff --git a/lib/Lexer/Lexer.cc b/lib/Lexer/Lexer.cc index d678097..a8af837 100644 --- a/lib/Lexer/Lexer.cc +++ b/lib/Lexer/Lexer.cc @@ -110,13 +110,6 @@ int Lexer::gettok() { if (IdentifierStr == "OR") return tok_or; if (IdentifierStr == "NOT") return tok_not; - if (IdentifierStr == "LENGTH") return tok_length; - if (IdentifierStr == "MID") return tok_mid; - if (IdentifierStr == "RIGHT") return tok_right; - if (IdentifierStr == "LEFT") return tok_left; - if (IdentifierStr == "LCASE") return tok_lcase; - if (IdentifierStr == "UCASE") return tok_ucase; - if (IdentifierStr == "FUNCTION") return tok_function; if (IdentifierStr == "ENDFUNCTION") return tok_endfunction; if (IdentifierStr == "PROCEDURE") return tok_procedure; -- cgit v1.3.1-4-g156e