ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
ast.h
Go to the documentation of this file.
1 
4 #ifndef ILANG_ILA_AST_AST_H__
5 #define ILANG_ILA_AST_AST_H__
6 
7 #include <memory>
8 #include <string>
9 
10 #include <ilang/ila/object.h>
11 
13 namespace ilang {
14 
15 // Forward declaration for host.
16 class InstrLvlAbs;
17 
20 class Ast : public Object {
21 protected:
23  typedef std::shared_ptr<InstrLvlAbs> InstrLvlAbsPtr;
24 
25 public:
26  // ------------------------- CONSTRUCTOR/DESTRUCTOR ----------------------- //
28  Ast() {}
30  Ast(const std::string& name) : Object(name) {}
32  virtual ~Ast() {}
33 
34  // ------------------------- ACCESSORS/MUTATORS --------------------------- //
36  bool is_ast() const { return true; }
37 
39  virtual bool is_expr() const { return false; }
41  virtual bool is_func() const { return false; }
42 
44  inline InstrLvlAbsPtr host() const { return host_; }
46  void set_host(const InstrLvlAbsPtr& host) { host_ = host; }
47 
48  // ------------------------- METHODS -------------------------------------- //
49 
51  virtual std::ostream& Print(std::ostream& out) const = 0;
52 
53 private:
54  // ------------------------- MEMBERS -------------------------------------- //
56  InstrLvlAbsPtr host_ = nullptr;
57 
58 }; // class Ast
59 
60 } // namespace ilang
61 
62 #endif // ILANG_ILA_AST_AST_H__
virtual bool is_func() const
Is type Ast::Func.
Definition: ast.h:41
virtual std::ostream & Print(std::ostream &out) const =0
Output function.
Ast(const std::string &name)
Constructor with name.
Definition: ast.h:30
InstrLvlAbsPtr host() const
Return the hosting ILA.
Definition: ast.h:44
Ast()
Default constructor.
Definition: ast.h:28
virtual bool is_expr() const
Is type Ast::Expr.
Definition: ast.h:39
The class for the Abstract Syntax Tree. An Ast object can be an expression or function definition (in...
Definition: ast.h:20
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
The basest type in the ILA structure. It can be either Ast, Instr, or InstrLvlAbs.
Definition: object.h:17
bool is_ast() const
Is type Ast.
Definition: ast.h:36
std::shared_ptr< InstrLvlAbs > InstrLvlAbsPtr
Type for forward declaration of ILA.
Definition: ast.h:23
virtual ~Ast()
Default destructor.
Definition: ast.h:32
void set_host(const InstrLvlAbsPtr &host)
Set the hosting ILA.
Definition: ast.h:46
const Symbol & name() const
Get the symbol (name).