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

Represents an expression statement. More...

#include <stmt.hpp>

Inheritance diagram for Expression:
Collaboration diagram for Expression:

Public Member Functions

 Expression (const std::shared_ptr< Expr > &expression)
 
std::any accept (StmtVisitor &visitor) override
 
std::shared_ptr< ExprgetExpression () const
 

Private Attributes

std::shared_ptr< Exprexpression
 

Detailed Description

Represents an expression statement.

Note
This class holds a single expression and allows visiting it.

Definition at line 70 of file stmt.hpp.

Constructor & Destructor Documentation

◆ Expression()

Expression::Expression ( const std::shared_ptr< Expr > &  expression)
inline

Definition at line 76 of file stmt.hpp.

77 : expression(std::move(expression)) {}
std::shared_ptr< Expr > expression
Definition stmt.hpp:73

Member Function Documentation

◆ accept()

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

Implements Stmt.

Definition at line 79 of file stmt.hpp.

79 {
80 return visitor.visitExpressionStmt(shared_from_this());
81 }
virtual std::any visitExpressionStmt(std::shared_ptr< Expression > expr)=0

◆ getExpression()

std::shared_ptr< Expr > Expression::getExpression ( ) const
inline

Definition at line 83 of file stmt.hpp.

83{ return expression; }

Member Data Documentation

◆ expression

std::shared_ptr<Expr> Expression::expression
private

Definition at line 73 of file stmt.hpp.


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