10 #ifndef TEUCHOS_GRAMMAR_HPP
11 #define TEUCHOS_GRAMMAR_HPP
24 typedef std::vector<int> RHS;
29 typedef std::vector<Production> Productions;
32 Productions productions;
33 std::vector<std::string> symbol_names;
36 typedef RCP<const Grammar> GrammarPtr;
38 int get_nnonterminals(Grammar
const& g);
39 bool is_terminal(Grammar
const& g,
int symbol);
40 bool is_nonterminal(Grammar
const& g,
int symbol);
41 int as_nonterminal(Grammar
const& g,
int symbol);
42 int find_goal_symbol(Grammar
const& g);
43 void add_end_terminal(Grammar& g);
44 int get_end_terminal(Grammar
const& g);
45 void add_accept_production(Grammar& g);
46 int get_accept_production(Grammar
const& g);
47 int get_accept_nonterminal(Grammar
const& g);
49 std::ostream& operator<<(std::ostream& os, Grammar
const& g);
Reference-counted pointer class and non-member templated function implementations.