|
Nearly CC
An educational compiler skeleton
|
A Formatter turns Operand and Instruction objects into strings, which in turn allows high-level and low-level code to be printed. More...
#include "formatter.h"

Public Member Functions | |
| virtual std::string | format_operand (const Operand &operand) const |
| Convert an Operand to a formatted string. More... | |
| virtual std::string | format_instruction (const Instruction *ins) const =0 |
| Convert an Instruction to a formatted string. More... | |
A Formatter turns Operand and Instruction objects into strings, which in turn allows high-level and low-level code to be printed.
|
pure virtual |
Convert an Instruction to a formatted string.
| ins | the Instruction to format |
Implemented in LowLevelFormatter, and HighLevelFormatter.
|
virtual |
Convert an Operand to a formatted string.
The default implementation of format_operand is useful for immediate values and labels. Subclasses should override to implement more specific kinds of operands (registers, memory references, etc.)
| operand | the Operand to format |
Reimplemented in LowLevelFormatter, and HighLevelFormatter.