Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- enum class LexemType {
- num, chr, str, id, lpar, rpar, lbrace, rbrace, lbracket, rbracket,
- semicolon, comma, colon, opassign, opplus, opminus, opmult, opinc, opeq, opne, oplt,
- opgt, ople, opnot, opor, opand, kwint, kwchar, kwif, kwelse, kwswitch, kwcase, kwwhile,
- kwfor, kwreturn, kwin, kwout, eof, error
- };
- class Token {
- private:
- LexemType _type;
- int _value;
- string _str;
- public:
- // Setters
- Token(LexemType type) : _type(type) {};
- Token(int value) : _value(value) {};
- Token(LexemType type, const string &str) : _type(type), _str(str) {};
- Token(char c) : _value(c) {};
- // Getters
- int value() { return _value; };
- string str() { return _str; };
- LexemType type() {};
- // Other
- void print(ostream &stream) {};
- string LexemTypeToStr(LexemType type) {
- switch (type) {
- case LexemType::num:
- return "num";
- }
- case
- };
- };
- int main() {
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement