tipc
A TIP to LLVM compiler
Public Member Functions | Protected Member Functions | Friends | List of all members
ASTProgram Class Reference

Class for a program which is a name and a list of functions. More...

#include <ASTProgram.h>

Inheritance diagram for ASTProgram:
Inheritance graph
[legend]
Collaboration diagram for ASTProgram:
Collaboration graph
[legend]

Public Member Functions

std::vector< std::shared_ptr< ASTNode > > getChildren () override
 Return all of the children for the node. More...
 
 ASTProgram (std::vector< std::shared_ptr< ASTFunction >> FUNCTIONS)
 
void setName (std::string n)
 
std::string getName () const
 
std::vector< ASTFunction * > getFunctions () const
 
ASTFunctionfindFunctionByName (std::string)
 
void accept (ASTVisitor *visitor) override
 Visit the children of this node and apply the visitor. More...
 
std::shared_ptr< llvm::Module > codegen (SemanticAnalysis *st, const std::string &name)
 
- Public Member Functions inherited from ASTNode
virtual ~ASTNode ()=default
 
void setLocation (int l, int c)
 
int getLine ()
 
int getColumn ()
 

Protected Member Functions

std::ostream & print (std::ostream &out) const override
 

Friends

std::ostream & operator<< (std::ostream &os, const ASTProgram &obj)
 

Detailed Description

Class for a program which is a name and a list of functions.

Constructor & Destructor Documentation

◆ ASTProgram()

ASTProgram::ASTProgram ( std::vector< std::shared_ptr< ASTFunction >>  FUNCTIONS)

Member Function Documentation

◆ accept()

void ASTProgram::accept ( ASTVisitor visitor)
overridevirtual

Visit the children of this node and apply the visitor.

This virtual function is overridden by each ASTNode subtype in order to visit each of its child nodes, by calling their accept methods. The visitor parameter defines the operations that are applied to each node that is visited; a subtype of ASTVisitor defines those operations.

Parameters
visitorThe subtype of ASTVisitor that carries out per-ASTNode work.

Implements ASTNode.

◆ codegen()

std::shared_ptr< llvm::Module > ASTProgram::codegen ( SemanticAnalysis st,
const std::string &  name 
)

◆ findFunctionByName()

ASTFunction * ASTProgram::findFunctionByName ( std::string  name)

◆ getChildren()

std::vector< std::shared_ptr< ASTNode > > ASTProgram::getChildren ( )
overridevirtual

Return all of the children for the node.

This is not a pure virtual function so subclasses can selectively override it.

Returns
a collection of the nodes children.

Reimplemented from ASTNode.

◆ getFunctions()

std::vector< ASTFunction * > ASTProgram::getFunctions ( ) const

◆ getName()

std::string ASTProgram::getName ( ) const
inline

◆ print()

std::ostream & ASTProgram::print ( std::ostream &  out) const
overrideprotectedvirtual

Implements ASTNode.

◆ setName()

void ASTProgram::setName ( std::string  n)
inline

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const ASTProgram obj 
)
friend

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