Add first parser draft for temp prfiles.
This commit is contained in:
52
tprcc/include/lang/temp-lang-frontend.hpp
Normal file
52
tprcc/include/lang/temp-lang-frontend.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef _TEMP_LANG_FRONTEND_HPP_
|
||||
#define _TEMP_LANG_FRONTEND_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <istream>
|
||||
#include <streambuf>
|
||||
|
||||
class TempLangFrontend {
|
||||
public:
|
||||
enum class LogLevel {
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
};
|
||||
|
||||
|
||||
TempLangFrontend(const std::string &source_file)
|
||||
{
|
||||
m_source_file = source_file;
|
||||
}
|
||||
|
||||
int analyze();
|
||||
|
||||
const std::string &get_src_file()
|
||||
{
|
||||
return m_source_file;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string m_source_file;
|
||||
|
||||
void log(LogLevel lvl, const std::string &message) const
|
||||
{
|
||||
switch (lvl) {
|
||||
case LogLevel::ERROR:
|
||||
std::cerr << "[ERR]" << message << std::endl;
|
||||
break;
|
||||
case LogLevel::WARNING:
|
||||
std::cerr << "[WARN]" << message << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cout << message << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /* _TEMP_LANG_FRONTEND_HPP_ */
|
21
tprcc/include/tpr/tpr-frontend.hpp
Normal file
21
tprcc/include/tpr/tpr-frontend.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _TPR_FRONTEND_HPP_
|
||||
#define _TPR_FRONTEND_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <lang/temp-lang-frontend.hpp>
|
||||
#include <tpr/tpr-scanner.hpp>
|
||||
|
||||
namespace tpr {
|
||||
|
||||
class TprFrontend : public TempLangFrontend {
|
||||
private:
|
||||
public:
|
||||
TprFrontend(const std::string &source_file);
|
||||
|
||||
int analyze();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* _TPR_FRONTEND_HPP_ */
|
Reference in New Issue
Block a user