ASSIGNMENT 1 : PASS 1 OF 2 PASS ASSEMBLER - TanishaShrotriya96/ThirdYear GitHub Wiki
PROBLEM STATEMENT :
Design suitable data structure and implement pass-I of a two pass assembler for pseudo-machine in Java using Object Oriented feature. Implementations should consist of a few instructions from every category and few assembler directive.
About Two Pass Assembler
Project Directory Structure and file organization -
1) Package Pass -
Classes -
- Literal
- Built to wrap all literal properties under one object
- member variables -(literal) number,addr and value
- Mnemonics
- Built to wrap all inbuilt assembler directives under one object
- member variables - name,opcode,type and length
- example (START,01,AD,00)
- Symbols
- Built to wrap all symbol properties under one object
- member variables - name,addr
- Pass1
- main class where entire pass1 takes place.
2) Textfiles :
- errInput - Sample code in Assembly Lanuage with common mistakes meant to be recognized by assembler.
- input - Correcr Sample code in Assembly Language.
- IC - file to which the Intermediate Code is written, used as input to pass2.
- LITTAB - file which keeps track of all the literals in the sample program.
- POOLTAB -file which keeps track of all the literal pools seen in the program.
- SYMTAB - file which keeps track of all the symbols encountered in the program.
- mnemonics - reference mnemonics file. This file is first read into an ArrayList of the Mnemonics class to simplify comparisons with input file.
3) Erros handled by the code after reading errInput include -
- ERROR : MNEMONIC [SUB:] USED AS A LABEL!!
- ERROR : DUPLICATE USE OF LABEL [A:]
- ERROR : SYMBOL B NOT DEFINED
- ERROR : INCOMPLETE INSTRUCTION!! [ADD]
- ERROR : MNEMONIC XYZ NOT DEFINED
- ERROR : MISSING END OF FILE!!
Based on the errInput file.
References
- Systems Programming and Operating Systems D M Dhamdhere
- https://www.javatpoint.com/
- https://www.tutorialspoint.com/index.htm