PLease give me this question Answer.
Push A
Push B
Push C
Add
Push D
Push F
Subtract
Subtract
Push E
Add
Add
Pop X
A, 3
B, 5
C, 7
D, 2
E, 4
F, 1
section .text
global _start
_start:
mov eax,’3’;
mov ebx,’5’;
mov ecx,’7’;
push eax;
push ebx;
add ecx, [esp] ;
push ecx;
mov eax, ’2’;
mov ebx,’1’;
sub eax,ebx;
pop ebx;
sub eax,ebx;
mov ebx,’4’;
add eax, ebx;
pop ebx;
add eax, ebx;
move X, eax;
the final value of X is 18
PLease give me this question Answer. Write working assembly code that successfully executes the ...
i want similar for this code to solve two questions : 1- Write a program to convert a postfix expression to infix expression 2-Write a program to convert an infix expression to prefix expression each question in separate code ( so will be two codes ) #include <iostream> #include <string> #define SIZE 50 using namespace std; // structure to represent a stack struct Stack { char s[SIZE]; int top; }; void push(Stack *st, char c) { st->top++; st->s[st->top] = c;...
Help with c++ program. The following code takes an infix expression and converts it to postfix. When I compile the code it returns "Segmentation fault". However I don't know what causes this. #include #include #include using namespace std; template class Stack { public: Stack();//creates the stack bool isempty(); // returns true if the stack is empty T gettop();//returns the front of the list void push(T entry);//add entry to the top of the stack void pop();//remove the top of the stack...
By using PYTHON language Postfix to Infix using Stack Develop a stack application that can convert Postfix notation to Infix notation using the following algorithm. In your stack application, you can use only two stacks, one for a stack that can store Postfix notation, and the other is a stack to store infix notation. Also, it would help if you had a function to distinguish between an operation or an operand. Input A B C * + D E /...
Help me to fix this code in C language. This code converts infix expressions to postfix and then evaluate the expression. Right now, it works with single digits. I need to modify it so that it can evaluate expressions with also 2 digits, example: (60+82)%72. Additionally I need to display an error when the parenthesis don't match like (89+8(. I have muted some line that would print the postfix expression with a space like: 22 8 + when the input...
We as humans write math expression in infix notation, e.g. 5 + 2 (the operators are written in-between the operands). In a computer’s language, however, it is preferred to have the operators on the right side of the operands, i.e. 5 2 +. For more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix. Write a program that takes an “infix” expression as input, uses...
JAVA, please You must write a robust program meaning that your program should not crash with any given data. Data validation must be done any time that user enters an input. Write a program that 1. Gets an infix expression form the user and evaluate the expression using stack ADT a. Finds the postfix equivalent of the given infix expression b. Evaluate the created postfix expression. c. Note: your program should not crash when you enter an invalid expression such...
Question 26 Write Hack Assembly Language that will implement the following Hack Virtual Machine commands: Virtual Machine Code a) push constant 0 Assembly Language Code [5 marks] b) pop local 1 6 marks c) push argument 56 [10 marks] Total for Question 26: 21 marks] Question 26 Write Hack Assembly Language that will implement the following Hack Virtual Machine commands: Virtual Machine Code a) push constant 0 Assembly Language Code [5 marks] b) pop local 1 6 marks c) push...
In the following code I give, everytime it will output ")". Input : ((A+B)*((C-D)/(E^F))) Expected output : ((A+B)*((C-D)/(E^F))) A+B*C-D/E^F my output : ) My code : class Et: def __init__(self , value): self.value = value self.left = None self.right = None def isOperator(c): if (c == '+' or c == '-' or c == '*' or c == '/' or c == '^' ): return True else: return False def inorder(t): if t is not None: inorder(t.left) print (t.value) inorder(t.right)...
You are to write a program that implements a Reverse Polish Notation Calculator in C using BISON and FLEX, You only have to edit the BISON and FLEX files. Link to the files to start and have a general view of the program: https://www.dropbox.com/sh/83yzs66jhftqj5b/AABZcY9Qwl84JdUFnYpQaZk9a?dl=0 Reverse Polish Notation is a mathematical notation in which every operator follows all of its operands. It is sometimes called postfix notation, and does not require any parentheses as long as each operator has a fixed...
6 pts) Compare zero- and three-address machines by writing programs to compute X = (A-B * C) + (D + E) * F for each. Store your final result in variable "X". For the 0-address machine, you'll use "POP X". You have the following commands: 0 Address PUSH M POP M ADD SUB MUL DIV 3 Address MOVE (XY) SUB (XEY Z) DIV (X-Y/Z) Add or remove rows as needed. 0 Address 3 Address