GSC Interpreter
A Turing-complete interpreter developed for a compiler course
Loading...
Searching...
No Matches
While Class Reference

#include <stmt.hpp>

Inheritance diagram for While:
Collaboration diagram for While:

Public Member Functions

 While (const std::shared_ptr< Expr > &condition, const std::shared_ptr< Stmt > &body)
 
std::any accept (StmtVisitor &visitor) override
 
std::shared_ptr< ExprgetCondition () const
 
std::shared_ptr< StmtgetBody () const
 

Private Attributes

const std::shared_ptr< Exprcondition
 
const std::shared_ptr< Stmtbody
 

Detailed Description

Definition at line 160 of file stmt.hpp.

Constructor & Destructor Documentation

◆ While()

While::While ( const std::shared_ptr< Expr > &  condition,
const std::shared_ptr< Stmt > &  body 
)
inline

Definition at line 166 of file stmt.hpp.

168 : condition(std::move(condition)), body(std::move(body)) {}
const std::shared_ptr< Stmt > body
Definition stmt.hpp:163
const std::shared_ptr< Expr > condition
Definition stmt.hpp:162

Member Function Documentation

◆ accept()

std::any While::accept ( StmtVisitor visitor)
inlineoverridevirtual

Implements Stmt.

Definition at line 170 of file stmt.hpp.

170 {
171 return visitor.visitWhileStmt(shared_from_this());
172 }
virtual std::any visitWhileStmt(std::shared_ptr< While > stmt)=0

◆ getBody()

std::shared_ptr< Stmt > While::getBody ( ) const
inline

Definition at line 176 of file stmt.hpp.

176{ return body; }

◆ getCondition()

std::shared_ptr< Expr > While::getCondition ( ) const
inline

Definition at line 174 of file stmt.hpp.

174{ return condition; }

Member Data Documentation

◆ body

const std::shared_ptr<Stmt> While::body
private

Definition at line 163 of file stmt.hpp.

◆ condition

const std::shared_ptr<Expr> While::condition
private

Definition at line 162 of file stmt.hpp.


The documentation for this class was generated from the following file: