2010-06-28 14:48:19 +00:00
|
|
|
#include "output.hpp"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cassert>
|
2020-10-25 13:33:23 +00:00
|
|
|
#include <iterator>
|
2010-06-28 14:48:19 +00:00
|
|
|
|
|
|
|
#include "locals.hpp"
|
|
|
|
|
|
|
|
namespace Compiler
|
|
|
|
{
|
|
|
|
Output::Output(Locals& locals)
|
|
|
|
: mLocals(locals)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-01-10 03:10:18 +00:00
|
|
|
Interpreter::Program Output::getProgram() const
|
|
|
|
{
|
|
|
|
return Interpreter::Program{
|
|
|
|
.mInstructions = mCode,
|
|
|
|
.mIntegers = mLiterals.getIntegers(),
|
|
|
|
.mFloats = mLiterals.getFloats(),
|
|
|
|
.mStrings = mLiterals.getStrings(),
|
|
|
|
};
|
2010-06-28 14:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const Literals& Output::getLiterals() const
|
|
|
|
{
|
|
|
|
return mLiterals;
|
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
const std::vector<Interpreter::Type_Code>& Output::getCode() const
|
|
|
|
{
|
|
|
|
return mCode;
|
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
const Locals& Output::getLocals() const
|
|
|
|
{
|
|
|
|
return mLocals;
|
|
|
|
}
|
|
|
|
|
|
|
|
Literals& Output::getLiterals()
|
|
|
|
{
|
|
|
|
return mLiterals;
|
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
std::vector<Interpreter::Type_Code>& Output::getCode()
|
|
|
|
{
|
|
|
|
return mCode;
|
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
Locals& Output::getLocals()
|
|
|
|
{
|
|
|
|
return mLocals;
|
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2010-06-28 14:48:19 +00:00
|
|
|
void Output::clear()
|
|
|
|
{
|
|
|
|
mLiterals.clear();
|
|
|
|
mCode.clear();
|
|
|
|
mLocals.clear();
|
|
|
|
}
|
|
|
|
}
|