summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/ccplus.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-05 08:58:54 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-05 08:59:41 +0100
commit6b74d623cb97ef9e95def486d7e06fa0eb00ee81 (patch)
treeee3dcb742cef754b41f9dbf2dc89d53a5bff0183 /CompilerDriver/ccplus.cc
parent6cda526bd4efcee31b1ea7405dc46d7985ba64e6 (diff)
CompilerDriver\{cc, ccplus}: Adding support for struct and classes in
C++ CompilerDriver\cc: Also add TODO for keywords '.' and '->' Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerDriver/ccplus.cc')
-rw-r--r--CompilerDriver/ccplus.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/CompilerDriver/ccplus.cc b/CompilerDriver/ccplus.cc
index fc8ab3a..bf6df0b 100644
--- a/CompilerDriver/ccplus.cc
+++ b/CompilerDriver/ccplus.cc
@@ -49,13 +49,27 @@ namespace detail
struct CompilerRegisterMap
{
std::string fName;
- std::string fRegister;
+ std::string fReg;
+ };
+
+ // \brief Offset based struct/class
+ struct CompilerStructMap
+ {
+ std::string fName;
+ std::string fReg;
+
+ // offset counter
+ std::size_t fOffsetsCnt;
+
+ // offset array
+ std::vector<std::pair<Int32, std::string>> fOffsets;
};
struct CompilerState
{
std::vector<ParserKit::SyntaxLeafList> fSyntaxTreeList;
std::vector<CompilerRegisterMap> kStackFrame;
+ std::vector<CompilerStructMap> kStructMap;
ParserKit::SyntaxLeafList* fSyntaxTree{ nullptr };
std::unique_ptr<std::ofstream> fOutputAssembly;
std::string fLastFile;