aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-07-26 12:04:56 +0000
committer_ov4 <ov4@ov4.org>2026-07-26 12:04:56 +0000
commitefc86b5c7625cf4c7074319f42f68807a25bde9d (patch)
tree0e2e1b5d9d336b1744602b3e47817f8a6b9c15f2 /include
parent4df7c22b99349dcf2175d69679eafa175d49aa9f (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'include')
-rw-r--r--include/cps/Lexer.h6
-rw-r--r--include/cps/Parser.h2
2 files changed, 0 insertions, 8 deletions
diff --git a/include/cps/Lexer.h b/include/cps/Lexer.h
index f1def3e..8984398 100644
--- a/include/cps/Lexer.h
+++ b/include/cps/Lexer.h
@@ -42,13 +42,7 @@ enum Token {
tok_not = -27,
tok_string_kw = -30,
- tok_length = -31,
- tok_mid = -32,
- tok_right = -33,
- tok_lcase = -34,
- tok_ucase = -35,
tok_string_literal = -36,
- tok_left = -37,
tok_char_kw = -38,
tok_char_literal = -39,
diff --git a/include/cps/Parser.h b/include/cps/Parser.h
index 87d1dee..c83be8b 100644
--- a/include/cps/Parser.h
+++ b/include/cps/Parser.h
@@ -29,8 +29,6 @@ class Parser {
std::unique_ptr<ExprAST> ParseIdentifierExpr();
std::unique_ptr<ExprAST> ParseParenExpr();
std::string ParseTypeName(bool AllowVoid = false);
-
- std::unique_ptr<ExprAST> ParseStringBuiltin(const std::string &FuncName);
std::unique_ptr<StmtAST> ParseStatement();
std::unique_ptr<StmtAST> ParseStatementImpl();