diff --git a/simulator_SIC_XE/devices/FA.dev b/simulator_SIC_XE/devices/FA.dev new file mode 100644 index 0000000..cb6e5ed --- /dev/null +++ b/simulator_SIC_XE/devices/FA.dev @@ -0,0 +1,2 @@ +5 +0 diff --git a/simulator_SIC_XE/include/code.h b/simulator_SIC_XE/include/code.h new file mode 100644 index 0000000..6a0c9b7 --- /dev/null +++ b/simulator_SIC_XE/include/code.h @@ -0,0 +1,26 @@ +#ifndef CODE_H +#define CODE_H + +#include +#include + +#include "node.h" + +class Code { + +public: + Code() = default; + + void addLine(const std::shared_ptr& line); + + const std::vector>& getLines() const; + + const string toString() const; + +private: + std::vector> _lines; +}; + + + +#endif // CODE_H \ No newline at end of file diff --git a/simulator_SIC_XE/include/mnemonic.h b/simulator_SIC_XE/include/mnemonic.h new file mode 100644 index 0000000..b144dfb --- /dev/null +++ b/simulator_SIC_XE/include/mnemonic.h @@ -0,0 +1,16 @@ +#ifndef MNEMONIC_H +#define MNEMONIC_H + +#include + +using std::string; + +class Mnemonic { +public: + string toString() const; +}; + + + + +#endif // MNEMONIC_H \ No newline at end of file diff --git a/simulator_SIC_XE/include/node.h b/simulator_SIC_XE/include/node.h new file mode 100644 index 0000000..2152f97 --- /dev/null +++ b/simulator_SIC_XE/include/node.h @@ -0,0 +1,31 @@ +#ifndef NODE_H +#define NODE_H + +#include +#include + +#include "mnemonic.h" + +using std::string; + +class Node { +public: + + string getLabel() const; + + string getComment() const; + + std::shared_ptr getMnemonic() const; + + string toString() const; + + + +protected: + string _label; + std::shared_ptr _mnemonic; + string _comment; +}; + + +#endif // NODE_H \ No newline at end of file diff --git a/simulator_SIC_XE/src/code.cpp b/simulator_SIC_XE/src/code.cpp new file mode 100644 index 0000000..0db062a --- /dev/null +++ b/simulator_SIC_XE/src/code.cpp @@ -0,0 +1,20 @@ +#include "code.h" + +void Code::addLine(const std::shared_ptr &line) +{ + _lines.emplace_back(line); +} + +const std::vector> &Code::getLines() const +{ + return _lines; +} + +const string Code::toString() const +{ + string result; + for (const auto& line : _lines) { + result += line->toString() + "\n"; + } + return result; +} diff --git a/simulator_SIC_XE/src/mnemonic.cpp b/simulator_SIC_XE/src/mnemonic.cpp new file mode 100644 index 0000000..4944082 --- /dev/null +++ b/simulator_SIC_XE/src/mnemonic.cpp @@ -0,0 +1,6 @@ +#include "mnemonic.h" + +string Mnemonic::toString() const +{ + return string(); +} \ No newline at end of file diff --git a/simulator_SIC_XE/src/node.cpp b/simulator_SIC_XE/src/node.cpp new file mode 100644 index 0000000..f0fccdb --- /dev/null +++ b/simulator_SIC_XE/src/node.cpp @@ -0,0 +1,22 @@ +#include "node.h" + +string Node::getLabel() const +{ + return _label; +} + +string Node::getComment() const +{ + return _comment; +} + +std::shared_ptr Node::getMnemonic() const +{ + return _mnemonic; +} + +string Node::toString() const +{ + return (_label.length() > 0 ? _label + " " : "") + (_mnemonic ? _mnemonic->toString() + " ": "") + "." + _comment; +} + \ No newline at end of file