Write a C++ program that translates a postfix expression into machine instructions in assembly code. The assembly code will use the following instructions:

  • LOAD x: Place the value of x in the accumulator register
  • STORE x: Store the contents of the accumulator register into variable x
  • ADD x: Add the value of x to the contents of the accumulator register
  • SUB x: Subtract the value of x from the contents of the accumulator register
  • MULT x: Multiply the contents of the accumulator register by the value of x
  • DIV x: Divide the contents of the accumulator register by the value of x

For example, the postfix expression

a b c + * d e * -

Should give the following sequence of instructions and save the instructions to a text file.

LOAD b
ADD c
STORE temp1
LOAD a
MULT temp1
STORE temp2
LOAD d
MULT e
STORE temp3
LOAD temp2
SUB temp3
STORE temp4

Use two different algorithms for this homework. There must be two source code (main.cpp) file. The first main.cpp is for first algorithms. The other one is for second. First main you must include Stack.h library the other main you must include LinkedStack.h library. For example: There are two folders. The first one which is first algorithm (Stack.h) includes; main.cpp and stack.h header file. The second folder includes other type of algorithms(LinkedStack.h).

Ex: If you use if () in first main.cpp, you should use switch case in other main.cpp for +-*/ operand.

Ex: If you include stack.h header file in first main.cpp, you should include LinkedStack.h in other.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.