Question
605.202 Data Structures LAB 1 Use of Stacks Assume a Machine has a single register and six instructions (Problem 2.3.10 from the LAT text.) LD
605.202 Data Structures LAB 1 Use of Stacks Assume a Machine has a single register and six instructions (Problem 2.3.10 from the LAT text.) LD A places the operand A in the register ST A places the contents of the register into the variable A AD A adds the contents of the variable A to the register SB A subtracts the contents of the variable A from the register ML A multiples the contents of the register by the variable A DV A divides the contents of the register by the variable A Write a program that accepts a postfix expression containing single letter operands and the operators +, -, *, and / and prints a sequence of instructions to evaluate the expression and leaves the result in the register. Use variables of the form TEMPn as temporary variables. For example, using the postfix expression ABC*+DE-/ should print the following: LD B ML C ST TEMP1 LD A AD TEMP1 ST TEMP2 LD D SB E ST TEMP3 LD TEMP2 DV TEMP3 ST TEMP4 Use the following postfix expressions for input AB+C- ABC+/CBA*+ ABC+- AB-*CBA+-* AB-C+DEF-+$ ABC-/BA-+/ ABCDE-+$*EF*- ABC+$CBA-+* ABC+*CBA-+* AB0+/CBA+-/ Keep in mind that you are NOT evaluating the postfix expression, you are generating the machine language instructions that would perform the evaluation if actually executed. Needs to read an input file and produce output txt file. In java please
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started