Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parser
src
Teuchos_Grammar.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_GRAMMAR_HPP
11
#define TEUCHOS_GRAMMAR_HPP
12
13
#include <string>
14
#include <vector>
15
16
#include <
Teuchos_RCP.hpp
>
17
18
namespace
Teuchos
{
19
20
/* convention: symbols are numbered with all
21
terminal symbols first, all non-terminal symbols after */
22
23
struct
Grammar {
24
typedef
std::vector<int> RHS;
25
struct
Production {
26
int
lhs;
27
RHS rhs;
28
};
29
typedef
std::vector<Production> Productions;
30
int
nsymbols;
31
int
nterminals;
32
Productions productions;
33
std::vector<std::string> symbol_names;
34
};
35
36
typedef
RCP<const Grammar>
GrammarPtr;
37
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);
48
49
std::ostream& operator<<(std::ostream& os, Grammar
const
& g);
50
51
}
52
53
#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:397
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0