Implement instruction class

This commit is contained in:
Hans 2021-11-06 02:31:33 +01:00
parent 02afb71c84
commit fc035bd7a7
8 changed files with 92 additions and 52 deletions

View file

@ -1,10 +1,7 @@
#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <fstream>
#include <algorithm>
#include <exception>
#include "parse.hpp"
@ -31,12 +28,14 @@ int main(int argc, char * argv[])
{
std::ifstream infile = get_infile(argc, argv);
std::string word;
std::vector<Token> tokens;
while(infile >> word)
{
try
{
Symbol sym(word);
sym.print();
Token token(word);
tokens.push_back(token);
}
catch(MalformedIdentifierExcept& exc)
{
@ -50,12 +49,15 @@ int main(int argc, char * argv[])
<< "\nAborting..." << std::endl;
exit(EXIT_FAILURE);
}
catch(WrongSymbolExcept& exc)
catch(WrongTokenExcept& exc)
{
std::cout << "Wrong symbol type\n Aborting..." << std::endl;
exit(EXIT_FAILURE);
}
}
Instruction instr(tokens);
instr.print();
return 0;
}