diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-13 03:23:52 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-13 03:23:52 +0000 |
| commit | f9a0c7e9687bc3e113f4c8f44861533c9ca48b3a (patch) | |
| tree | 5d51c5a403dd096b0c3748118409be20eb3e1900 /include | |
| parent | 3818460a473bd3ffcd35f09eb6429e1b0f00bc07 (diff) | |
feat: compile source files with configurable IR output
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/cps/CodeGen.h | 2 | ||||
| -rw-r--r-- | include/cps/Lexer.h | 5 |
2 files changed, 6 insertions, 1 deletions
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<std::unique_ptr<StmtAST>> &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 <istream> #include <string> #include <cstdint> @@ -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; |
