diff options
Diffstat (limited to 'src/generator.hpp')
-rw-r--r-- | src/generator.hpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/generator.hpp b/src/generator.hpp index b901785..955739f 100644 --- a/src/generator.hpp +++ b/src/generator.hpp @@ -36,26 +36,33 @@ namespace solar { class generator_t { private: - std::multimap<std::string, item_t> rules; + std::vector<item_t> rules; + std::map<item_t, size_t> rule_ids; + std::multimap<std::string, size_t> nonterms; + + std::set<symbol_t> terminals; + std::multimap<symbol_t, item_t> items; - std::map<std::set<item_t>, unsigned> itemsets; - std::map<std::pair<unsigned, symbol_t>, unsigned> transitions; + std::map<std::set<item_t>, size_t> itemsets; + + std::multimap<std::pair<unsigned, symbol_t>, std::pair<char, unsigned>> actions; + std::map<std::pair<unsigned, symbol_t>, unsigned> gotos; void close_set(std::set<item_t> *set); std::set<item_t> get_set(const std::string &nonterm); - std::pair<std::map<std::set<item_t>, unsigned>::iterator, bool> add_set(const std::set<item_t> &set) { + std::pair<std::map<std::set<item_t>, size_t>::iterator, bool> add_set(const std::set<item_t> &set) { return itemsets.emplace(set, itemsets.size()); } void generate_itemsets(); static void print_symbol(const symbol_t &sym); - static void print_item(const item_t &item); + static void print_item(const item_t &item, bool point); static void print_set(const std::set<item_t> &set); public: - generator_t(const std::set<item_t> &rules0); + generator_t(const std::vector<item_t> &rules0); }; } |