| Age | Commit message (Collapse) | Author |
|
Integer/Real/Boolean/CharHandler carried only five one-line LLVM API
wrappers (now inlined at their call sites in CodeGen.cc) plus dead
emitDeclare methods that violated the documented two-table lock-step
invariant. StringHandler::emitDeclare (also dead) and its NamedValues
reference go too.
With the dead writers gone, NamedValues held no information not already
in Symbols[].Storage, so the parallel map is removed: getNamedValue
reads Symbols, ArrayHandler/FunctionGen take one table, and function
bodies save/restore a single map. Behavior unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
CodeGen declares its own MallocFunc in SetupExternalFunctions and uses
it for char->STRING coercion and INPUT STRING buffers, removing two bare
getFunction("malloc") calls that null-deref'd if no handler happened to
declare malloc first. The CHR branch reuses the char->STRING coercion
path instead of a second hand-rolled heap wrapper.
String concatenation moves from ArithmeticHandler (which re-declared
four externs per '&' and was the LLVM 19 build-pin root cause) to
StringHandler::emitConcat; ArithmeticHandler no longer touches the
Module. Dead FreeFunc declarations removed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
emitPrototype now records each FUNCTION/PROCEDURE's pseudocode signature
(FuncSig: return type + per-param type/BYREF flag). CodeGen::
marshalCallArgs replaces the two verbatim-duplicated marshalling blocks
and dispatches on the declared signature instead of inferring BYREF from
pointer-typed LLVM params: BYVAL STRING params now receive the string
data pointer (no more runtime garbage), and BYVAL args are coerced to
the declared type (INTEGER->REAL args no longer emit invalid IR).
Top-level prototypes are pre-registered in compile(), so calls may
precede definitions; GenerateCall no longer fabricates i64 externs for
unknown names - an unregistered callee is a compile error. OUTPUT
reports an error when it cannot infer the expression type instead of
printing with the INTEGER format.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
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>
|
|
- MID/RIGHT/LEFT integer args now coerced at call sites (RIGHT(s, n/2)
no longer emits invalid IR); drop emitLeft's private conversion
- FOR loop direction decided at run time via select on STEP sign;
descending FOR works, STEP evaluated once per iteration
- ArrayHandler: extract emitCheckedIndices/loadElement; index count is
validated before emission, fixing a compiler-crash (vector OOB UB) on
OUTPUT with too many indices
- Error contract: Lexer/Parser/CodeGen track errors; all silent failure
paths now print Error: diagnostics with line numbers; unterminated
char literal no longer truncates the rest of the program; module is
verified with verifyModule; driver exits non-zero on any error
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|