C++ code for 2 Pass Assembler
This is a simple C++ code for 2 pass assembler.
Over-review of the Code
There are 2 main methods:
Pass 1: It creates 2 csv files for symbol table and section table respectively. Pass 2: It finalize the machine code for the given tables and code. (It does not create machine code for registers defined within the code.)
Other Functions:
- convert(int) : Converts the given decimal number to the Binary String
- inti() : Initialize the Machine Opcode Array with Name, Binary Code and Size.
- search_mot(string) : It searchers the MOT for the asked Machine Code and returns index in array.
- search_symbol(string) : It searches the SYMLAB and returns the location of the symbol.
- size_evaluation(string) : It returns the size of the variable.
- data_break(string) : It takes value string and converts it into Binary.
- store_symlab() : Stores symbol table in csv format.
- store_sec() : Store section table in csv.
Structures:
- mnemonics : Machine Opcode Table
- symbol : Symbol Table
- section: Section Table
Data Structures:
- Vector
- File Stream
Thank You. For any queries you can mail me at: krishna.dduc@gmail.com