LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fragment.hh
Go to the documentation of this file.
1 
9 #ifndef TREE_FRAGMENT_HH
10 # define TREE_FRAGMENT_HH
11 
12 # include <iosfwd>
13 
14 # include <misc/symbol.hh>
15 # include <frame/frame.hh>
16 # include <temp/temp.hh>
17 # include <tree/fwd.hh>
18 # include <tree/visitor.hh>
19 # include <temp/label.hh>
20 # include <temp/temp.hh>
21 
22 namespace tree
23 {
24 
25  /*-----------.
26  | Fragment. |
27  `-----------*/
28 
41  class Fragment
42  {
43  public:
44  virtual std::ostream& dump (std::ostream& o) const = 0;
45 
46  virtual ~Fragment ();
47 
50  public:
52  virtual void accept (Visitor& v) = 0;
53  virtual void accept (ConstVisitor& v) const = 0;
55  };
56 
57  std::ostream& operator<< (std::ostream& o, const Fragment& f);
58 
59 
60  /*--------------------.
61  | DataFrag: strings. |
62  `--------------------*/
63 
65  class DataFrag : public Fragment
66  {
67  public:
68  DataFrag (const temp::Label& label, const std::string& data);
69 
70  virtual std::ostream& dump (std::ostream& o) const override;
71 
74 
75  temp::Label label_get () const;
76 
78  const std::string& data_get () const;
83  public:
85  virtual void accept (Visitor& v) override;
86  virtual void accept (ConstVisitor& v) const override;
89  protected:
91  std::string data_;
92  };
93 
94 
95  /*-----------------------.
96  | ProcFrag: procedures. |
97  `-----------------------*/
98 
105  class ProcFrag : public Fragment
106  {
107  public:
110  ProcFrag (const temp::Label& label,
111  const misc::symbol& name,
112  const rStm& body,
113  const frame::Frame* frame);
114 
115  ~ProcFrag ();
120 
121  temp::Label label_get () const;
122 
124  const misc::symbol& name_get () const;
125 
127  rStm body_get () const;
128  void body_set (const rStm& body);
129 
131  const frame::Frame& frame_get () const;
134 
135  virtual std::ostream& dump (std::ostream& o) const override;
136 
139  public:
141  virtual void accept (Visitor& v) override;
142  virtual void accept (ConstVisitor& v) const override;
145  private:
151  rStm body_;
156  };
157 
158 
159 } // namespace tree
160 
161 # include <tree/fragment.hxx>
162 
163 #endif // !TREE_FRAGMENT_HH