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

Class representing a logical expression. More...

#include <expr.hpp>

Inheritance diagram for Logical:
Collaboration diagram for Logical:

Public Member Functions

 Logical (std::shared_ptr< Expr > left, Token op, std::shared_ptr< Expr > right)
 
std::any accept (ExprVisitor &visitor) override
 
std::shared_ptr< ExprgetLeft () const
 
std::shared_ptr< ExprgetRight () const
 
Token getOp () const
 

Private Attributes

const std::shared_ptr< Exprleft
 
const Token op
 
const std::shared_ptr< Exprright
 

Detailed Description

Class representing a logical expression.

This class represents a logical expression in the AST, which consists of a left operand, an operator, and a right operand. It inherits from the Expr class and implements the accept method for visitor pattern.

Definition at line 191 of file expr.hpp.

Constructor & Destructor Documentation

◆ Logical()

Logical::Logical ( std::shared_ptr< Expr left,
Token  op,
std::shared_ptr< Expr right 
)
inline

Definition at line 198 of file expr.hpp.

199 : left(std::move(left)), op(std::move(op)), right(std::move(right)) {}
const std::shared_ptr< Expr > right
Definition expr.hpp:195
const std::shared_ptr< Expr > left
Definition expr.hpp:193
const Token op
Definition expr.hpp:194

Member Function Documentation

◆ accept()

std::any Logical::accept ( ExprVisitor visitor)
inlineoverridevirtual

Implements Expr.

Definition at line 201 of file expr.hpp.

201 {
202 return visitor.visitLogicalExpr(shared_from_this());
203 }
virtual std::any visitLogicalExpr(std::shared_ptr< Logical > expr)=0

◆ getLeft()

std::shared_ptr< Expr > Logical::getLeft ( ) const
inline

Definition at line 205 of file expr.hpp.

205{ return left; }

◆ getOp()

Token Logical::getOp ( ) const
inline

Definition at line 209 of file expr.hpp.

209{ return op; }

◆ getRight()

std::shared_ptr< Expr > Logical::getRight ( ) const
inline

Definition at line 207 of file expr.hpp.

207{ return right; }

Member Data Documentation

◆ left

const std::shared_ptr<Expr> Logical::left
private

Definition at line 193 of file expr.hpp.

◆ op

const Token Logical::op
private

Definition at line 194 of file expr.hpp.

◆ right

const std::shared_ptr<Expr> Logical::right
private

Definition at line 195 of file expr.hpp.


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