Hydrogen/include/Tbs.h

91 lines
1.7 KiB
C++

# pragma once
#include "stdc++.h"
#include <unordered_map>
using std::unordered_map,std::string;
class Tbs {
public:
unordered_map<int,string> ConstTable;
unordered_map<int,string> IdTable;
std::unordered_map<int, std::string> KeyTable = {
{1, "var"},
{2, "i8"},
{3, "i16"},
{4, "i32"},
{5, "i64"},
{6, "u8"},
{7, "u16"},
{8, "u32"},
{9, "u64"},
{10, "float32"},
{11, "float64"},
{12, "char"},
{13, "for"},
{14, "if"},
{15, "else"},
{16, "bool"},
{17, "string"},
{18, "vector"},
{19, "array"},
{20, "struct"},
{21, "tuple"},
{22, "print"},
{23, "println"}
};
std::unordered_map<int, std::string> PunctTable = {
{1, "-"},
{2, "!"},
{3, "~"},
{4, "/"},
{5, "*"},
{6, "%"},
{7, "+"},
{8, "-"},
{9, "<<"},
{10, ">>"},
{11, ">"},
{12, ">="},
{13, "<"},
{14, "<="},
{15, "=="},
{16, "!="},
{17, "&"},
{18, "^"},
{19, "|"},
{20, "&&"},
{21, "||"},
{22, "="},
{23, "%="},
{24, "*="},
{25, "/="},
{26, "+="},
{27, "-="},
{28, "|="},
{29, "&="},
{30, "^="},
{31, "<<="},
{32, ">>="},
{33, "("},
{34, ")"},
{35, "<"},
{36, ">"},
{37, ","},
{38, "."},
{39, "["},
{40, "]"},
{41, "?"},
{42, ":"},
{43, "->"}
};
};
enum Table_Type {
CONST_TABLE,
ID_TABLE,
KEY_TABLE,
PUNCT_TABLE
};