From 64aa538142148faf06b9a3c71907eacee04cd49d Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 09:16:22 +0000 Subject: feat(codegen): FUNCTION MAIN entry point 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 --- include/cps/FunctionAST.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/cps') diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h index 9b2d49b..4dfe908 100644 --- a/include/cps/FunctionAST.h +++ b/include/cps/FunctionAST.h @@ -1,5 +1,6 @@ #pragma once #include "cps/AST.h" +#include "cps/Identifier.h" #include #include #include @@ -46,7 +47,10 @@ public: bool isExternal() const { return IsExternal; } const std::string &getOwnerClass() const { return OwnerClass; } bool isPublic() const { return IsPublic; } - std::string getLinkName() const { return OwnerClass.empty() ? Name : OwnerClass + "." + Name; } + std::string getLinkName() const { + if (!OwnerClass.empty()) return OwnerClass + "." + Name; + return sameIdentifier(Name, "MAIN") ? "__cps_main" : Name; + } }; class FunctionDefAST : public StmtAST { -- cgit v1.3.1-4-g156e