TorqueScript  0.2
Public Member Functions | Public Attributes | List of all members
TorqueScript::Compiler Class Reference

Primary compiler class. This class is an AST visitor that walks the AST tree generated by a AST::ASTBuilder instance to generate an InstructionSequence instance. More...

#include <compiler.hpp>

Inheritance diagram for TorqueScript::Compiler:
Inheritance graph
[legend]
Collaboration diagram for TorqueScript::Compiler:
Collaboration graph
[legend]

Public Member Functions

 Compiler (const InterpreterConfiguration &config)
 
CodeBlockcompileStream (std::istream &input, StringTable *stringTable)
 Ask the compiler to generate a codeblock from the provided stream. More...
 
CodeBlockcompileString (const std::string &input, StringTable *stringTable)
 Ask the compiler to generate a codeblock from the provided string. More...
 
CodeBlockcompileFile (const std::string &path, StringTable *stringTable)
 Ask the compiler to generate a codeblock from the provided file. More...
 
virtual antlrcpp::Any defaultResult () override
 
virtual antlrcpp::Any aggregateResult (antlrcpp::Any &aggregate, antlrcpp::Any &nextResult) override
 
- Public Member Functions inherited from TorqueScript::AST::ASTVisitor
virtual antlrcpp::Any visitProgramNode (AST::ProgramNode *program)
 
virtual antlrcpp::Any visitSubtractNode (AST::SubtractNode *expression)
 
virtual antlrcpp::Any visitDecrementNode (AST::DecrementNode *expression)
 
virtual antlrcpp::Any visitSwitchCaseNode (AST::SwitchCaseNode *node)
 
virtual antlrcpp::Any visitElseIfNode (AST::ElseIfNode *node)
 

Public Attributes

const InterpreterConfiguration mConfig
 

Detailed Description

Primary compiler class. This class is an AST visitor that walks the AST tree generated by a AST::ASTBuilder instance to generate an InstructionSequence instance.

Member Function Documentation

◆ compileFile()

CodeBlock* TorqueScript::Compiler::compileFile ( const std::string &  path,
StringTable stringTable 
)

Ask the compiler to generate a codeblock from the provided file.

Parameters
pathThe path to load from.

◆ compileStream()

CodeBlock* TorqueScript::Compiler::compileStream ( std::istream &  input,
StringTable stringTable 
)

Ask the compiler to generate a codeblock from the provided stream.

Parameters
inputThe input to generate from.
Returns
A CodeBlock representing the compiled output. If an error has occurred, nullptr is returned.

◆ compileString()

CodeBlock* TorqueScript::Compiler::compileString ( const std::string &  input,
StringTable stringTable 
)

Ask the compiler to generate a codeblock from the provided string.

Parameters
inputThe string to generate from.

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