diff --git a/alib2data/src/grammar/parsing/LRParserTypes.h b/alib2data/src/grammar/parsing/LRParserTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..c950aa1d354ebd6fc5e3cc713a4072fcddf05dd3 --- /dev/null +++ b/alib2data/src/grammar/parsing/LRParserTypes.h @@ -0,0 +1,37 @@ +/* + * LRParserTypes.h + * + * Created on: 10. 5. 2016 + * Author: Martin Kocicka + */ + +#ifndef LR_PARSER_TYPES_H_ +#define LR_PARSER_TYPES_H_ + +#include "../../alphabet/Symbol.h" +#include "../../automaton/common/State.h" + +#include <map> +#include <set> +#include <variant> +#include <vector> + +namespace grammar { + +namespace parsing { + +enum class LRAction { + Shift, + Reduce, + Accept +}; + +typedef std::map < alphabet::Symbol, std::set < std::pair < unsigned, std::vector < alphabet::Symbol > > > > LR0Items; +typedef std::map < std::pair < automaton::State, alphabet::Symbol >, std::pair < LRAction, std::variant < automaton::State, std::pair < alphabet::Symbol, std::vector < alphabet::Symbol > > > > > LRActionTable; +typedef std::map < std::pair < automaton::State, alphabet::Symbol >, automaton::State > LRGotoTable; + +} /* namespace parsing */ + +} /* namespace grammar */ + +#endif /* LR_PARSER_TYPES_H_ */