aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/StatementGen.cc
AgeCommit message (Collapse)Author
2026-10-27refactor(memory)!: move allocation functions into memory.cps_ov4
Route keyword NEW and DELETE through the same library runtime and retain allocation tracking, runtime diagnostics and exception behavior. BREAKING CHANGE: -no-std programs using NEW or DELETE must explicitly import memory.cps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22feat(input)!: validate INPUT and read whole lines into STRING_ov4
Scalar INPUT now reads one whitespace-delimited token through module-local IR helpers instead of scanf, then skips spaces and tabs and consumes one newline. INTEGER, REAL, BOOLEAN (TRUE or FALSE in any case) and CHAR are validated, and bad input or end of input is a runtime error. STRING INPUT reads the rest of the line. The unused scanf and REAL printf format globals are removed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-22refactor(codegen): split large emitStmtImpl arms into methods_ov4
Move the self-contained FunctionDef, INPUT, OUTPUT and READFILE branches of emitStmtImpl into private emitFunctionDefStmt, emitInputStmt, emitOutputStmt and emitReadFileStmt methods. The dispatch order and the branch bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22refactor(codegen): share writable variable lookup_ov4
emitLValue (variable and designator base) and plain assignment repeated the same lookup, enum-or-unknown diagnostic and requireWritable check. Move it into a private lookupWritableSymbol helper. READFILE keeps its own lookup, which has no enum diagnostic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22refactor(codegen): share file keyword filename operand emission_ov4
EOF, OPENFILE, READFILE and CLOSEFILE each rejected a whole-array filename and then emitted it as a C string. Route them through a private emitFileNameOperand helper; diagnostics are unchanged. WRITEFILE keeps its own combined check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22refactor(codegen): remove dead parameters, fields and branches_ov4
Drop the never-read StackObject::IsCopy flag and registerStackObject parameter, the unused NewExprAST forward declaration, the unused Ret parameter of FunctionGen::emitReturn and CG parameter of ArrayHandler::loadElement, unused <cstdio> includes, and the coerceValueToType early returns already covered by the exact LLVM type check (builtin kinds always map to double/i64/i1/i8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21feat(codegen): support explicit template arguments_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21feat(codegen): instantiate function templates by deduction_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21feat(parser): parse TEMPLATE declarations, template ids and parameter packs_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20refactor(strings): replace compiler builtins with the STRING library_ov4
Construct literals as STRING values and route string operations through ordinary library functions and operators. Preserve value ownership in records, arrays, constants and file I/O. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18feat(classes): add copy constructors and statement-scoped temporaries_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(codegen): declare and call EXTERN C functions_ov4
Variadic arguments must be C values and receive C default argument promotions; narrow integer parameters carry sign/zero extension. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(classes): overload methods and NEW constructors_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(codegen): overload global functions and procedures_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(codegen): FUNCTION MAIN entry point_ov4
Invoke the internal entry function through the generated exception handler and truncate its INTEGER result to the process exit status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(codegen): GLOBAL variables as LLVM globals_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(driver): compile multiple source files with INCLUDE visibility_ov4
Reject builds without an entry program and duplicate cross-file definitions. Preserve source order for each unit's own constants and import visible exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(parser): parse INCLUDE and GLOBAL blocks_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(classes): destroy stack objects at scope exit_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(classes): destroy and release heap objects with DELETE_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(classes): allocate objects with NEW and rebind named class variables_ov4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17feat(classes): warn when method declarations shadow fields_ov4
Retain parameter source lines for warnings and preserve field access prefix validation when distinguishing fields from methods. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-17feat(classes): support ordinary member methods and this references_ov4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-17feat(calls): support standalone calls and void pointer casts_ov4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-17feat(input): support array elements and member targets_ov4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-16fix(compiler): correct CIE semantics and diagnostic locations_ov4
Use standard WHILE headers and default-public class fields, resolve pseudocode identifiers without case sensitivity, and check signed i64 literal boundaries before conversion. Preserve source locations across recursive emission and function diagnostics. Add 22 regression cases and update compiler examples and documentation. Validated all 69 CTest entries with the original Linux Actions seed and verified the release package's embedded, native and IR output paths.
2026-10-16feat(constants): implement literal constants with lexical scope_ov4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-16feat(control-flow): implement ordered CASE OF matching_ov4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-16refactor(codegen): split emission by responsibility_ov4
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>