DEFINITION MODULE CodeGenerator;
(* Uses information supplied by Parser, OperationCodes, *)
(* and SyntaxAnalyzer to produce the object code.       *)

   FROM Parser IMPORT
      TOKEN, OPERAND;

   FROM LongNumbers IMPORT
      LONG;


   EXPORT QUALIFIED
      LZero, AddrCnt, Pass2, BuildSymTable, AdvAddrCnt, GetObjectCode;


   VAR
      LZero, AddrCnt : LONG;
      Pass2 : BOOLEAN;


   PROCEDURE BuildSymTable (VAR AddrCnt : LONG; 
                            Label, OpCode : TOKEN; SrcOp, DestOp : OPERAND);
   (* Builds symbol table from symbolic information of Source File *)


   PROCEDURE AdvAddrCnt (VAR AddrCnt : LONG);
   (* Advances the address counter based on the length of the instruction *)


   PROCEDURE GetObjectCode (Label, OpCode : TOKEN;
                            SrcOp, DestOp : OPERAND;
                            VAR AddrCnt, ObjOp, ObjSrc, ObjDest : LONG;
                            VAR   nA,      nO,    nS,     nD    : CARDINAL);
   (* Determines the object code for the operation as well as the operands *)
   (* Returns each (up to 3 fields), along with their length               *) 

END CodeGenerator.
