I am making a shell, I understand the concepts of lexers, parsers, and ASTs, now I want to implement them. I am working with C++ and I have to define the keywords, for my shell. I am thinking of using macros for this. I want them to be accessible globally but I am struggling to get the macros right, I believe I am missing something.
class All_operators {
std::string name;
std::string value;
int presedence;
All_operators(std::string name, std::string value, int presedence);
};
Let us assume that this is the operator class and I make a macro
#define DECLARE_OPS(name, value, pres) All_operators name{name, value, presedence}
How do I make the objects of this class visible across the program?
What is the best way to approach this? If you have any good please refer them to me.
Thank you.