PassOne Module Implementation Specifications


Client Specifications

Implementation Data Model

Main Program calls PassOne(), for creating a Symbol table. PassOne() accomplishes the table constructions using several public functions: PassOne() calls the function GetLine(), which is in Scanner Module, to retrieve one line of characters at a time. It calls Tokenize(), which is in Scanner module, to read through the string created by GetLine() to extract labels, opcodes, operands and comments.

PassOne calls isDirective(), isComment(), isLabel() and isOpcode() to verify value of tokens encountered. When valid labels are encountered, both the name of the symbol(token) and its address are stored in a symbol table. Location counter is increased by calling addByte(), addWord() and addStr() and treated as the address of the symbol when a symbol is encountered.

searchST() is called to check symbol duplication before the symbol is inserted into symbol table. If the symbol is first time encountered, makeNode() is called to create a new SymbolNode that contains this symbol name and address, and insertSymbol() is used to add this new node into the Symbol table.

Private Importing Information

Use PassOne module needs include those information:

#include <stdio.h> - Standard C header file
#include <string.h>
#include <stdlib.h>
#include "pass.h"  - contains static records of directives, operators, special symbols, Table
structure, and all associated typedefs
#include "table.h" - contains function declarations for functions used to process tables

Private Data Type Implementations

Public Data Type Implementations

Private Function Specifications

Token Checking

Address Value Calculating

Create SymbolNode

Private Function Algorithms

Public Function Algorithms


1