TorqueScript  0.2
codeblock.hpp
1 
15 #pragma once
16 
17 #include <map>
18 #include <string>
19 #include <vector>
20 #include <memory>
21 
22 #include <torquescript/stringtable.hpp>
23 #include <torquescript/instructionsequence.hpp>
24 
25 namespace TorqueScript
26 {
27  class InstructionSequence;
28  class StringTable;
29  class ExecutionState;
30  class Function;
31 
36  class CodeBlock
37  {
38  public:
39  CodeBlock(const InstructionSequence& instructions);
40 
44  void execute(std::shared_ptr<ExecutionState> state);
45 
49  std::vector<std::string> disassemble();
50 
51  private:
53  std::vector<std::shared_ptr<Function>> mFunctions;
54 
56  InstructionSequence mInstructions;
57  };
58 }
A CodeBlock defines a piece of executable code generated from a single input (Ie. a file)....
Definition: codeblock.hpp:37
std::vector< std::string > disassemble()
Produces a disassembly of the CodeBlock code.
void execute(std::shared_ptr< ExecutionState > state)
Executes all instructions contained in mInstructions within the provided context.
Storage class for a sequence of instructions to be executed. Also implements the primary execution co...
Definition: instructionsequence.hpp:39
Definition: ast.hpp:28