LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
exp.hh
Go to the documentation of this file.
1 
91 #ifndef TRANSLATE_EXP_HH
92 # define TRANSLATE_EXP_HH
93 
94 # include <iosfwd>
95 # include <tree/all.hh>
96 # include <temp/fwd.hh>
97 # include <frame/frame.hh>
98 
99 
100 namespace translate
101 {
102 
103  /*------.
104  | Exp. |
105  `------*/
106 
108  class Exp
109  {
110  public:
111  virtual ~Exp() {}
112  virtual std::ostream& dump(std::ostream&) const = 0;
113 
115  virtual tree::rExp un_ex() = 0;
116 
118  virtual tree::rStm un_nx() = 0;
119 
123  virtual tree::rStm un_cx(const temp::Label& t, const temp::Label& f) = 0;
124  };
125 
128 
130  std::ostream& operator<< (std::ostream& ostr, const Exp& exp);
131 
132 
133  /*-----.
134  | Cx. |
135  `-----*/
136 
138  class Cx : public Exp
139  {
140  public:
142  const tree::rExp& left, const tree::rExp& right);
143 
145  virtual tree::rExp un_ex() override;
146  virtual tree::rStm un_nx() override;
147  virtual tree::rStm un_cx(const temp::Label& t,
148  const temp::Label& f) override;
149 
150  virtual std::ostream& dump(std::ostream& ostr) const override;
151 
152  private:
156  };
157 
160 
161 
162  /*-----.
163  | Ex. |
164  `-----*/
165 
167  class Ex : public Exp
168  {
169  public:
170  Ex(const tree::rExp& exp);
171 
172  virtual tree::rExp un_ex() override;
173  virtual tree::rStm un_nx() override;
174  virtual tree::rStm un_cx(const temp::Label& t,
175  const temp::Label& f) override;
176 
177  virtual std::ostream& dump(std::ostream& ostr) const override;
178 
179  private:
181  };
182 
185 
186 
187  /*-----.
188  | Nx. |
189  `-----*/
190 
192  class Nx : public Exp
193  {
194  public:
195  Nx(const tree::rStm& stm);
196 
197  virtual tree::rExp un_ex() override;
198  virtual tree::rStm un_nx() override;
199  virtual tree::rStm un_cx(const temp::Label&,
200  const temp::Label&) override;
201 
202  virtual std::ostream& dump(std::ostream& ostr) const override;
203 
204  private:
205  tree::rStm stm_;
206  };
207 
210 
211 
212  /*-----.
213  | Ix. |
214  `-----*/
215 
217  class Ix : public Exp
218  {
219  public:
220  Ix(rExp& cond, rExp& iftrue, rExp& iffalse);
221 
222  virtual tree::rExp un_ex() override;
223  virtual tree::rStm un_nx() override;
224  virtual tree::rStm un_cx(const temp::Label& t_outer,
225  const temp::Label& f_outer) override;
226 
227  virtual std::ostream& dump(std::ostream& ostr) const override;
228 
229  private:
233  };
234 
237 
238 }
239 
240 
241 # include <translate/exp.hxx>
242 
243 #endif // !TRANSLATE_EXP_HH