Vcsn  2.2a
Be Rational
driver.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/core/rat/fwd.hh>
4 #include <vcsn/dyn/expression.hh>
6 #include <vcsn/misc/export.hh>
7 
8 #include <lib/vcsn/rat/fwd.hh>
9 #include <lib/vcsn/rat/parse.hh>
10 
11 namespace vcsn
12 {
13  namespace rat
14  {
15 
18  {
19  public:
21  ~driver();
22 
24  void context(const dyn::context& ctx);
25 
27  void context(const std::string& ctx);
28 
31  dyn::context context() const;
32 
35 
37  void tape_push();
38 
40  void tape_pop();
41 
43  void tape_inc(const location& l);
44 
46  dyn::expression parse(std::istream& is, const location& l = location{});
47 
49  void error(const location& l, const std::string& m);
51  void invalid(const location& l, const std::string& s);
52 
54  std::string errors;
56  std::unique_ptr<yyFlexLexer> scanner_;
57 
59  dyn::label make_label(const location& loc, const std::string& s,
60  const dyn::context& ctx);
61 
63  dyn::expression make_atom(const location& loc, const std::string& s);
64 
67  const class_t& c, bool accept);
68 
70  dyn::weight make_weight(const location& loc, const std::string& s);
71 
72  private:
73  friend class parser;
74 
89  std::vector<unsigned> tapes_ = {0};
91  std::vector<dyn::context> tape_ctx_ = {};
92  };
93  }
94 }
std::istringstream is
The input stream: the specification to translate.
Definition: translate.cc:380
#define LIBVCSN_API
Definition: export.hh:8
std::unique_ptr< yyFlexLexer > scanner_
The scanner.
Definition: driver.hh:56
rat::identities identities(const expression &exp)
Bridge.
Definition: identities.hh:19
Define the vcsn::rat::location class.
label make_label(const LabelSet &ls, const typename LabelSet::value_t &l)
Definition: label.hh:80
Abstract a location.
Definition: location.hh:47
expression make_expression(const ExpSet &rs, const typename ExpSet::value_t &r)
Definition: expression.hh:97
State and public interface for rational expression parsing.
Definition: driver.hh:17
Define the vcsn::rat::parser class.
std::shared_ptr< const detail::context_base > context
A dyn::context.
Definition: fwd.hh:26
std::shared_ptr< const detail::weight_base > weight
Definition: fwd.hh:71
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
Definition: fwd.hh:12
dyn::context ctx_
The context used to read the expression.
Definition: driver.hh:78
A Bison parser.
Definition: parse.hh:299
weight make_weight(const WeightSet &ws, const typename WeightSet::value_t &w)
Definition: weight.hh:79
std::shared_ptr< const detail::label_base > label
Definition: fwd.hh:44
dyn::expression result_
The parsed expression.
Definition: driver.hh:82
static identities ids(const driver &d)
Get the identities of the driver.
Definition: parse.cc:89
static dyn::context ctx(const driver &d)
Get the context of the driver.
Definition: parse.cc:82
std::string errors
The error messages.
Definition: driver.hh:54
rat::identities ids_
The identities to apply.
Definition: driver.hh:80
location location_
The inital location.
Definition: driver.hh:76
std::shared_ptr< detail::expression_base > expression
Definition: expression.hh:92
An expressionset can implement several different sets of identities on expressions.
Definition: identities.hh:21
Definition: a-star.hh:8