3 b.. Convert the following formula from infix to postfix (Reverse Polish Notati
ID: 3849993 • Letter: 3
Question
3 b.. Convert the following formula from infix to postfix (Reverse Polish Notation): ( A + B * C) / ( D + E * F) (A+B*C)(D+E*F)/ (A+BC*)(D+EF*)/ ABC*+DEF*+/ For Problem 4, write code that performs the computation used in problem 3b ( A + B * C) / ( D + E * F) for using CPUs that have the following instruction formats: 4 a. Three-operand instructions You may only use registers A through F, plus X and T. Registers A through F may not be changed, i.e. their values are fixed. Register T may be used as a temporary register, and Register X must contain the final answer. 4 b. Stack instructions (I need the 3 operand (4a) and stack(4b) instructions. The last answer didn't give me what I needed)
Explanation / Answer
3 b. Given infix formula X = ( A + B * C) / ( D + E * F)
Now infix to postfix (Reverse Polish Notation) = (A+B*C)(D+E*F)/
= (A+BC*)(D+EF*)/
= ABC*+DEF*+/
4 a. Code that performs the computation used in problem 3b ( A + B * C) / ( D + E * F) for using CPUs that have three-operand instructions ------->
MUL T, B, C
ADD T, T, A
MUL X, E, F
ADD X, X, D
DIV X, T, X
4 b. Code that performs the computation used in problem 3b ( A + B * C) / ( D + E * F) for using CPUs that have stack instructions ------->
PUSH A
PUSH B
PUSH C
MUL
ADD
PUSH D
PUSH E
PUSH F
MUL
ADD
DIV
POP X
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.