Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parser
src
Teuchos_Grammar.hpp
1
#ifndef TEUCHOS_GRAMMAR_HPP
2
#define TEUCHOS_GRAMMAR_HPP
3
4
#include <string>
5
#include <vector>
6
7
#include <
Teuchos_RCP.hpp
>
8
9
namespace
Teuchos
{
10
11
/* convention: symbols are numbered with all
12
terminal symbols first, all non-terminal symbols after */
13
14
struct
Grammar {
15
typedef
std::vector<int> RHS;
16
struct
Production {
17
int
lhs;
18
RHS rhs;
19
};
20
typedef
std::vector<Production> Productions;
21
int
nsymbols;
22
int
nterminals;
23
Productions productions;
24
std::vector<std::string> symbol_names;
25
};
26
27
typedef
RCP<const Grammar>
GrammarPtr;
28
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);
39
40
std::ostream& operator<<(std::ostream& os, Grammar
const
& g);
41
42
}
43
44
#endif
Teuchos_RCP.hpp
Reference-counted pointer class and non-member templated function implementations.
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:429
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0