#ifndef COMPILER_SYNTAX_GRAMMAR_H_ #define COMPILER_SYNTAX_GRAMMAR_H_ #include #include #include #include "tree_sitter/compiler.h" #include "compiler/rules/symbol.h" #include "compiler/variable.h" namespace tree_sitter { struct ProductionStep { ProductionStep(const rules::Symbol &, int, Associativity); ProductionStep(const rules::Symbol &, int, Associativity, int); bool operator==(const ProductionStep &) const; rules::Symbol symbol; int precedence; Associativity associativity; int rule_id; }; typedef std::vector Production; struct SyntaxVariable { SyntaxVariable(const std::string &, VariableType, const std::vector &); std::string name; std::vector productions; VariableType type; }; typedef std::set ConflictSet; struct SyntaxGrammar { const std::vector &productions(const rules::Symbol &) const; std::vector variables; std::set ubiquitous_tokens; std::set expected_conflicts; }; } // namespace tree_sitter #endif // COMPILER_SYNTAX_GRAMMAR_H_