MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
pascal::WhileStmtNode Class Reference

AST node for a while loop (while cond do stmt). More...

#include <ast.hpp>

Inheritance diagram for pascal::WhileStmtNode:

Public Member Functions

 WhileStmtNode (std::unique_ptr< ASTNode > cond, std::unique_ptr< ASTNode > stmt)
void accept (ASTVisitor &visitor) override
 Accept an ASTVisitor (double-dispatch).
std::string toString () const override
 Return a human-readable description of this node.
Public Member Functions inherited from pascal::ASTNode
virtual ~ASTNode ()=default
virtual void print (std::ostream &out, int indent=0) const
 Pretty-print this node to a stream with indentation.
void setLineNumber (int line)
 Set the originating source line number.
int getLineNumber () const
 Get the originating source line number.

Public Attributes

std::unique_ptr< ASTNodecondition
 loop condition
std::unique_ptr< ASTNodestatement
 loop body

Detailed Description

AST node for a while loop (while cond do stmt).

Definition at line 366 of file ast.hpp.

Constructor & Destructor Documentation

◆ WhileStmtNode()

pascal::WhileStmtNode::WhileStmtNode ( std::unique_ptr< ASTNode > cond,
std::unique_ptr< ASTNode > stmt )
inline

Definition at line 371 of file ast.hpp.

References condition, and statement.

Member Function Documentation

◆ accept()

void pascal::WhileStmtNode::accept ( ASTVisitor & visitor)
overridevirtual

Accept an ASTVisitor (double-dispatch).

Implements pascal::ASTNode.

Definition at line 137 of file ast.cpp.

References pascal::ASTVisitor::visit().

◆ toString()

std::string pascal::WhileStmtNode::toString ( ) const
overridevirtual

Return a human-readable description of this node.

Implements pascal::ASTNode.

Definition at line 141 of file ast.cpp.

Member Data Documentation

◆ condition

std::unique_ptr<ASTNode> pascal::WhileStmtNode::condition

loop condition

Definition at line 368 of file ast.hpp.

Referenced by WhileStmtNode(), and pascal::CodeGenVisitor::visit().

◆ statement

std::unique_ptr<ASTNode> pascal::WhileStmtNode::statement

loop body

Definition at line 369 of file ast.hpp.

Referenced by WhileStmtNode(), and pascal::CodeGenVisitor::visit().


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