added static initializers and now it builds and links!

This commit is contained in:
Samuel D. Crow
2021-03-19 19:26:10 -05:00
parent 68c4806a3d
commit e5d08cc31b
5 changed files with 102 additions and 115 deletions

View File

@@ -8,6 +8,10 @@
*/
#include "yab2cpp.h"
unordered_map<string, shared_ptr<variable> >globals;
unordered_map<string, shared_ptr<variable> >locals;
unordered_map<string, shared_ptr<variable> >statics;
/* These correspond to the enum COMPILE_ERRORS. */
const char *COMPILE_ERROR_NAMES[]={
"no error",
@@ -200,19 +204,17 @@ void logger(string s)
void shutDown()
{
if (errorLevel != E_OK) cerr << "\nERROR: " << COMPILE_ERROR_NAMES[errorLevel] << "\n\n" << endl;
if (fn::isCallStackEmpty())
logger("Dumping stack.");
if (mode & DUMP && (logfile))
{
logger("Stack was empty");
fn::dumpCallStack();
}
else
varNames << "Global Variables\n";
for(auto iter=globals.begin(); iter!=globals.end(); ++iter)
{
logger("Dumping stack.");
if (mode & DUMP && (logfile))
{
fn::dumpCallStack();
}
varNames << "variable " << iter->first << " has ID " << iter->second << "\n";
}
operands::dumpVars();
varNames << endl;
label::dumpLabels();
output_cpp << "}\n}return state;\n}"<< endl;
}