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