MysoreScript
Public Member Functions | List of all members
AST::Statement Struct Referenceabstract

The abstract superclass for all statements. More...

#include <ast.hh>

Inheritance diagram for AST::Statement:
Inheritance graph
[legend]
Collaboration diagram for AST::Statement:
Collaboration graph
[legend]

Public Member Functions

virtual void interpret (Interpreter::Context &c)=0
 Execute this statement in the interpreter. More...
 
virtual void compile (Compiler::Context &c)
 Compile this statement to LLVM IR. More...
 
virtual void collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses)=0
 Recursively visit all of the children of this statement, collecting variables that are declared and used in it. More...
 

Detailed Description

The abstract superclass for all statements.

Definition at line 28 of file ast.hh.

Member Function Documentation

§ collectVarUses()

virtual void AST::Statement::collectVarUses ( std::unordered_set< std::string > &  decls,
std::unordered_set< std::string > &  uses 
)
pure virtual

Recursively visit all of the children of this statement, collecting variables that are declared and used in it.

This is used to allocate space for all declared variables and to bind variables to closures.

Implemented in AST::ClassDecl, AST::WhileLoop, AST::IfStatement, AST::Return, AST::Decl, AST::Call, AST::Assignment, AST::VarRef, AST::BinOpBase, AST::StringLiteral, and AST::Number.

§ compile()

virtual void AST::Statement::compile ( Compiler::Context c)
inlinevirtual

Compile this statement to LLVM IR.

Reimplemented in AST::WhileLoop, AST::IfStatement, AST::Return, AST::Decl, AST::Assignment, and AST::Expression.

Definition at line 37 of file ast.hh.

§ interpret()

virtual void AST::Statement::interpret ( Interpreter::Context c)
pure virtual

Execute this statement in the interpreter.

Implemented in AST::ClassDecl, AST::WhileLoop, AST::IfStatement, AST::Return, AST::Decl, AST::Assignment, and AST::Expression.


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