编程代考 #ifndef ASSEMBLER_H

#ifndef ASSEMBLER_H
#define ASSEMBLER_H

#include

Copyright By PowCoder代写 加微信 powcoder

#include “SymbolTable.h”

using namespace std;

class Assembler {
/** Instruction types */
enum InstructionType {
A_INSTRUCTION,
C_INSTRUCTION,
L_INSTRUCTION,
NULL_INSTRUCTION

/** C-instruction destinations */
enum InstructionDest {

/** C-instruction jump conditions */
enum InstructionJump {

/** C-instruction computations/op-codes */
enum InstructionComp {
CONST_NEG_1,

/** Practical Assignment 5 methods */
Assembler();
~Assembler();

void doFirstPass(SymbolTable* symbolTable, string instructions[], int numOfInst);
string doSecondPass(SymbolTable* symbolTable, string instructions[], int numOfInst);

InstructionType parseInstructionType(string instruction);
InstructionDest parseInstructionDest(string instruction);
InstructionJump parseInstructionJump(string instruction);
InstructionComp parseInstructionComp(string instruction);
string parseSymbol(string instruction);

string translateDest(InstructionDest dest);
string translateJump(InstructionJump jump);
string translateComp(InstructionComp comp);
string translateSymbol(string symbol, SymbolTable* symbolTable);

#endif /* ASSEMBLER_H */

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com