Yerbacon/src/headers/SemanticAnalysis.hpp
Username404-59 d4df3aa4ea
Add boilerplate for semantic analysis
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2024-08-07 03:05:55 +02:00

30 lines
731 B
C++

#ifndef YERBACON_SEMANTICANALYSIS_HPP
#define YERBACON_SEMANTICANALYSIS_HPP
#include "parsing/ParseComponents.hpp"
#include "Tasking.hpp"
#define make_task(T, C, F) make_task_base_R(T, C, F)
struct SemanticAnalyser final: public Tasking {
const auto& analyseTree(const ParseTree& tree) {
const auto& task_map = getTaskMapInstance();
for (unsigned int i = 0; i < tree.size(); ++i) {
try {
task_map.at(tree[i]->getId())(tree, i);
} catch (const out_of_range&) {}
}
return tree;
}
private:
unordered_task_map getTaskMapInstance() final {
return {
};
};
};
#undef make_task
#endif //YERBACON_SEMANTICANALYSIS_HPP