From f9a0c7e9687bc3e113f4c8f44861533c9ca48b3a Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 03:23:52 +0000 Subject: feat: compile source files with configurable IR output Co-Authored-By: Claude Fable 5.1 --- include/cps/CodeGen.h | 2 +- include/cps/Lexer.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'include/cps') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 97765f0..ae2f015 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -95,7 +95,7 @@ public: CodeGen(); ~CodeGen(); void compile(const std::vector> &Statements); - void print(); + void print(llvm::raw_ostream &Output); bool hadError() const { return HadError; } void reportError(const char *Fmt, ...); static bool isBuiltinName(const std::string &Name); diff --git a/include/cps/Lexer.h b/include/cps/Lexer.h index 2af0260..d83e808 100644 --- a/include/cps/Lexer.h +++ b/include/cps/Lexer.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include @@ -87,9 +88,13 @@ enum Token { }; class Lexer { + std::istream &Input; + int LastChar = ' '; int CurrentLine = 1; bool HadError = false; public: + explicit Lexer(std::istream &Input) : Input(Input) {} + std::string IdentifierStr; std::string StringVal; int64_t NumVal; -- cgit v1.3.1-4-g156e