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

Link to know more about Two Pass Assembler

Project Directory Structure and file organization -

1) Package Pass -

Classes -

  1. Literal
    • Built to wrap all literal properties under one object
    • member variables -(literal) number,addr and value
  2. Mnemonics
    • Built to wrap all inbuilt assembler directives under one object
    • member variables - name,opcode,type and length
    • example (START,01,AD,00)
  3. Symbols
    • Built to wrap all symbol properties under one object
    • member variables - name,addr
  4. Pass1
    • main class where entire pass1 takes place.

2) Textfiles :

  1. errInput - Sample code in Assembly Lanuage with common mistakes meant to be recognized by assembler.
  2. input - Correcr Sample code in Assembly Language.
  3. IC - file to which the Intermediate Code is written, used as input to pass2.
  4. LITTAB - file which keeps track of all the literals in the sample program.
  5. POOLTAB -file which keeps track of all the literal pools seen in the program.
  6. SYMTAB - file which keeps track of all the symbols encountered in the program.
  7. 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 -

  1. ERROR : MNEMONIC [SUB:] USED AS A LABEL!!
  2. ERROR : DUPLICATE USE OF LABEL [A:]
  3. ERROR : SYMBOL B NOT DEFINED
  4. ERROR : INCOMPLETE INSTRUCTION!! [ADD]
  5. ERROR : MNEMONIC XYZ NOT DEFINED
  6. ERROR : MISSING END OF FILE!!

Based on the errInput file.


References

  1. Systems Programming and Operating Systems D M Dhamdhere
  2. https://www.javatpoint.com/
  3. https://www.tutorialspoint.com/index.htm