Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parser
src
Teuchos_make_lalr1_parser.hpp
1
#ifndef TEUCHOS_BUILD_PARSER_HPP
2
#define TEUCHOS_BUILD_PARSER_HPP
3
4
#include <set>
5
#include <memory>
6
7
#include <
Teuchos_Parser.hpp
>
8
#include <Teuchos_Graph.hpp>
9
#include <
Teuchos_RCP.hpp
>
10
11
namespace
Teuchos
{
12
13
struct
Config {
14
int
production;
15
int
dot;
16
Config(
int
p,
int
d);
17
};
18
19
typedef
std::vector<Config> Configs;
20
21
typedef
std::set<int> Context;
22
23
/* nonterminal transitions will be stored as SHIFT
24
actions while in progress */
25
struct
ActionInProgress {
26
Action action;
27
Context context;
28
};
29
30
struct
StateInProgress {
31
std::vector<int> configs;
32
typedef
std::vector<ActionInProgress> Actions;
33
Actions actions;
34
};
35
36
void
swap(StateInProgress& a, StateInProgress& b);
37
38
typedef
RCP<StateInProgress>
StateInProgressPtr;
39
40
typedef
std::vector<StateInProgressPtr> StatesInProgress;
41
42
struct
StateConfig {
43
int
state;
44
int
config_in_state;
45
StateConfig(
int
s,
int
cis);
46
};
47
48
typedef
std::vector<StateConfig> StateConfigs;
49
50
struct
ParserInProgress {
51
StatesInProgress states;
52
Configs configs;
53
StateConfigs state_configs;
54
Graph states2state_configs;
55
GrammarPtr grammar;
56
};
57
58
StateConfigs form_state_configs(StatesInProgress
const
& states);
59
Graph form_states_to_state_configs(StateConfigs
const
& scs,
60
StatesInProgress
const
& states);
61
62
void
print_graphviz(
63
std::string
const
& filepath,
64
ParserInProgress
const
& pip,
65
bool
verbose,
66
std::ostream& os
67
);
68
69
ParserInProgress draft_lalr1_parser(GrammarPtr grammar,
bool
verbose =
false
);
70
71
Parser accept_parser(ParserInProgress
const
& pip);
72
73
class
ParserBuildFail:
public
std::invalid_argument {
74
public
:
75
ParserBuildFail(
const
std::string& msg);
76
};
77
78
}
79
80
#endif
Teuchos_Parser.hpp
Declares Teuchos::Parser, ParserFail and make_lalr1_parser.
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