OpenASIP
2.0
|
#include <AssemblerParser.hh>
Classes | |
struct | definition |
Public Member Functions | |
AssemblerParser (TPEF::Binary &aBin, const TTAMachine::Machine &aMach, AssemblyParserDiagnostic *parserDiagnostic, bool codeLinesOnly=false) | |
AssemblerParser. More... | |
bool | compile (const std::string &asmCode) const |
void | finalize (bool littleEndian) const |
void | cleanup () |
UValue | errorLine () |
bool | codeLinesOnly () const |
Private Attributes | |
TPEF::Binary & | bin_ |
TPEF where to program is compiled. More... | |
MachineResourceManager | resourceManager_ |
Generates string, resource, null and address space sections. More... | |
DataSectionCreator | dataSectionCreator_ |
Creates data sections. More... | |
CodeSectionCreator | codeSectionCreator_ |
Creates code section. More... | |
LabelManager | labelManager_ |
Creates symbol and relocation sections. More... | |
ParserTemp | parserTemp_ |
Temp-structure containing most recent parsed tokens. More... | |
bool | codeLinesOnly_ = false |
Controls start symbol of the grammar. False: the default symbol (program) for parsing assembly files. True: 'codeLines' symbol suitable for inline assembly parsing. More... | |
Definition at line 331 of file AssemblerParser.hh.
AssemblerParser::AssemblerParser | ( | TPEF::Binary & | aBin, |
const TTAMachine::Machine & | aMach, | ||
AssemblyParserDiagnostic * | parserDiagnostic, | ||
bool | codeLinesOnly = false |
||
) |
Grammar constructor.
aBin | TPEF where to program is compiled. |
aMach | Machine which for program is compiled. |
parent | Error message manager of the compiler. |
codeLinesOnly | If true start symbol for the grammar is 'codeLines'. The option is suitable for inline assembly parsing. Default is false. |
Constructor.
aBin | TPEF object where to create program. |
aMach | Machine which for program is written. |
parserDiagnostic | Assembler root class for warning handling. |
Definition at line 231 of file AssemblerParser.cc.
void AssemblerParser::cleanup | ( | ) |
Frees all resources allocated by parser.
Definition at line 247 of file AssemblerParser.cc.
References DataSectionCreator::cleanup(), CodeSectionCreator::cleanup(), LabelManager::cleanup(), codeSectionCreator_, dataSectionCreator_, and labelManager_.
Referenced by Assembler::compile().
|
inline |
Definition at line 938 of file AssemblerParser.hh.
Referenced by AssemblerParser::definition< ScannerT >::start().
bool AssemblerParser::compile | ( | const std::string & | asmCode | ) | const |
Definition at line 254 of file AssemblerParser.cc.
Referenced by Assembler::compile(), and InlineAsmParser::parse().
UValue AssemblerParser::errorLine | ( | ) |
Returns line number where parse error happened in assembler file.
Definition at line 268 of file AssemblerParser.cc.
References ParserTemp::lineNumber, and parserTemp_.
Referenced by Assembler::compile(), and InlineAsmParser::parse().
void AssemblerParser::finalize | ( | bool | littleEndian | ) | const |
Finalizes parsed TPEF.
After calling this successfully parser should contain valid tpef.
Definition at line 278 of file AssemblerParser.cc.
References bin_, codeSectionCreator_, dataSectionCreator_, DataSectionCreator::finalize(), CodeSectionCreator::finalize(), LabelManager::finalize(), labelManager_, TPEF::Binary::setArch(), and TPEF::Binary::setType().
Referenced by Assembler::compile(), and InlineAsmParser::parse().
|
private |
TPEF where to program is compiled.
Definition at line 943 of file AssemblerParser.hh.
Referenced by finalize().
|
private |
Controls start symbol of the grammar. False: the default symbol (program) for parsing assembly files. True: 'codeLines' symbol suitable for inline assembly parsing.
Definition at line 960 of file AssemblerParser.hh.
|
mutableprivate |
Creates code section.
Definition at line 950 of file AssemblerParser.hh.
Referenced by cleanup(), and finalize().
|
mutableprivate |
Creates data sections.
Definition at line 948 of file AssemblerParser.hh.
Referenced by cleanup(), and finalize().
|
mutableprivate |
Creates symbol and relocation sections.
Definition at line 952 of file AssemblerParser.hh.
Referenced by cleanup(), and finalize().
|
mutableprivate |
Temp-structure containing most recent parsed tokens.
Definition at line 955 of file AssemblerParser.hh.
Referenced by errorLine().
|
mutableprivate |
Generates string, resource, null and address space sections.
Definition at line 946 of file AssemblerParser.hh.