1 #ifndef TEUCHOS_GRAMMAR_HPP
2 #define TEUCHOS_GRAMMAR_HPP
15 typedef std::vector<int> RHS;
20 typedef std::vector<Production> Productions;
23 Productions productions;
24 std::vector<std::string> symbol_names;
27 typedef RCP<const Grammar> GrammarPtr;
29 int get_nnonterminals(Grammar
const& g);
30 bool is_terminal(Grammar
const& g,
int symbol);
31 bool is_nonterminal(Grammar
const& g,
int symbol);
32 int as_nonterminal(Grammar
const& g,
int symbol);
33 int find_goal_symbol(Grammar
const& g);
34 void add_end_terminal(Grammar& g);
35 int get_end_terminal(Grammar
const& g);
36 void add_accept_production(Grammar& g);
37 int get_accept_production(Grammar
const& g);
38 int get_accept_nonterminal(Grammar
const& g);
40 std::ostream& operator<<(std::ostream& os, Grammar
const& g);
Reference-counted pointer class and non-member templated function implementations.