nsbaci 1.0
Loading...
Searching...
No Matches
compilerService.h
Go to the documentation of this file.
1
18
19#ifndef NSBACI_COMPILERSERVICE_H
20#define NSBACI_COMPILERSERVICE_H
21
22#include <memory>
23#include <vector>
24
25#include "compiler.h"
26#include "error.h"
27#include "fileTypes.h"
28#include "nsbaciCompiler.h"
29
34namespace nsbaci::services {
35
62 public:
73 CompilerService(std::unique_ptr<nsbaci::compiler::Compiler> c =
74 std::make_unique<nsbaci::compiler::NsbaciCompiler>());
75
79 ~CompilerService() = default;
80
81 CompilerService(const CompilerService&) = delete;
82 CompilerService& operator=(const CompilerService&) = delete;
83
85 CompilerService& operator=(CompilerService&&) = default;
86
99
109 bool hasProgramReady() const;
110
121
132
133 private:
134 std::unique_ptr<nsbaci::compiler::Compiler>
135 compiler;
137 lastCompiledInstructions;
139 lastCompiledSymbols;
140 bool programReady = false;
141};
142
143} // namespace nsbaci::services
144
145#endif // NSBACI_COMPILERSERVICE_H
CompilerService(std::unique_ptr< nsbaci::compiler::Compiler > c=std::make_unique< nsbaci::compiler::NsbaciCompiler >())
Constructs the CompilerService with a compiler implementation.
Definition compilerService.cpp:17
nsbaci::types::SymbolTable takeSymbols()
Retrieves and releases ownership of the symbol table.
Definition compilerService.cpp:55
nsbaci::compiler::InstructionStream takeInstructions()
Retrieves and releases ownership of the compiled instructions.
Definition compilerService.cpp:50
~CompilerService()=default
Default destructor.
bool hasProgramReady() const
Checks if a compiled program is available for execution.
Definition compilerService.cpp:48
nsbaci::compiler::CompilerResult compile(nsbaci::types::Text raw)
Compiles nsbaci source code into p-code instructions.
Definition compilerService.cpp:20
Abstract Compiler class declaration for nsbaci.
Error class declaration for nsbaci.
Type definitions for file-related operations.
std::vector< Instruction > InstructionStream
Vector of instructions representing a compiled program.
Definition instruction.h:210
Services namespace containing all backend service implementations.
Definition compilerService.cpp:15
std::string Text
Alias for text content (file contents, source code, etc.).
Definition fileTypes.h:30
std::unordered_map< VarName, SymbolInfo > SymbolTable
Lookup table mapping variable names to their symbol info.
Definition compilerTypes.h:42
NsbaciCompiler class declaration for nsbaci.
Result of a compilation operation.
Definition compiler.h:47