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

AST node representing a block (declarations + compound statement). More...

#include <ast.hpp>

Inheritance diagram for pascal::BlockNode:

Public Member Functions

 BlockNode (std::vector< std::unique_ptr< ASTNode > > decls, std::unique_ptr< CompoundStmtNode > stmt)
 Construct a block node.
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::vector< std::unique_ptr< ASTNode > > declarations
 variable / type / const / procedure / function declarations
std::unique_ptr< CompoundStmtNodecompoundStatement
 the begin..end compound statement

Detailed Description

AST node representing a block (declarations + compound statement).

Definition at line 79 of file ast.hpp.

Constructor & Destructor Documentation

◆ BlockNode()

pascal::BlockNode::BlockNode ( std::vector< std::unique_ptr< ASTNode > > decls,
std::unique_ptr< CompoundStmtNode > stmt )

Construct a block node.

Parameters
declsList of declaration nodes
stmtThe compound statement body

Definition at line 11 of file ast.cpp.

References compoundStatement, and declarations.

Member Function Documentation

◆ accept()

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

Accept an ASTVisitor (double-dispatch).

Implements pascal::ASTNode.

Definition at line 39 of file ast.cpp.

References pascal::ASTVisitor::visit().

◆ toString()

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

Return a human-readable description of this node.

Implements pascal::ASTNode.

Definition at line 43 of file ast.cpp.

References declarations.

Member Data Documentation

◆ compoundStatement

std::unique_ptr<CompoundStmtNode> pascal::BlockNode::compoundStatement

the begin..end compound statement

Definition at line 82 of file ast.hpp.

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

◆ declarations

std::vector<std::unique_ptr<ASTNode> > pascal::BlockNode::declarations

variable / type / const / procedure / function declarations

Definition at line 81 of file ast.hpp.

Referenced by BlockNode(), toString(), and pascal::CodeGenVisitor::visit().


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