Om
translator.hpp
Go to the documentation of this file.
1 
15 #ifndef Om_Language_Translator_
16 
17  #define Om_Language_Translator_ \
18  Om::Language::Translator
19 
20  #include "om/code_point.hpp"
21 
22  #ifndef Om_Macro_Precompilation_
23 
24  #include <string>
25 
26  #endif
27 
28 namespace Om {
29 
31  namespace Source {
32 
33  template <typename ThisItem>
34  class Source;
35 
36  }
37 
38  namespace Sink {
39 
40  template <typename ThisItem>
41  class Sink;
42 
43  }
45 
46  namespace Language {
47 
49  class Consumer;
50 
51  class Evaluation;
52 
53  class Operator;
55 
56  // MARK: - Om::Language::Translator
57 
62  class Translator {
63 
64  public: // MARK: public (non-static)
65 
70  void Evaluate(
73  ) const;
74 
85  std::string Evaluate(
86  char const theCodeUnitIterator[]
87  ) const;
88 
89  virtual void GiveElements(Consumer &) const = 0;
90 
91  virtual bool IsEmpty() const = 0;
92 
99  virtual bool Translate(
100  Evaluation &,
101  Operator const &
102  ) const = 0;
103 
104  };
105 
106  }
107 
108 }
109 
110  #include "om/language/translator.cpp"
111 
112 #endif
An Element taker; takes at the back.
Definition: consumer.hpp:42
The current evaluation.
Definition: evaluation.hpp:42
The Operator implementation.
Definition: operator.hpp:60
An Operator lookup for use by an Evaluator.
Definition: translator.hpp:62
virtual void GiveElements(Consumer &) const =0
virtual bool Translate(Evaluation &, Operator const &) const =0
Translates the Operator to an object that is then given to the Evaluation.
virtual bool IsEmpty() const =0
std::string Evaluate(char const theCodeUnitIterator[]) const
A convenience overload that evaluates input from the string and returns the output string.
void Evaluate(Om::Source::Source< CodePoint const > &, Om::Sink::Sink< CodePoint const > &) const
Evaluates input from the CodePoint Source and pushes it to the CodePoint Sink.
Any object that items can be pushed to.
Definition: sink.hpp:31
Any object that items can be pulled from.
Definition: source.hpp:31
Om header file.
The Om library.
Definition: code_point.hpp:26
Om source file.