Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

int main(int argc, char* argv[]) { char infixstream[100]; char postfixstream[100

ID: 3632338 • Letter: I

Question

int main(int argc, char* argv[])
{
char infixstream[100];
char postfixstream[100];
printf(" Enter a mathematical expression :");
scanf("%s",infixstream);
printf(" ");

toPostfix(infixstream,postfixstream);
printf(" The postfix equivalent of the input expression :");
printf("%s",infixstream);
printf(" ");
}

Write an assembly language function toPostfix starting with the code given below to accept an
infix notation formula and convert it to postfix (reverse polish ) notation.

Please note that every line of your code should be explained. You should submit
1- Algorithm developed for the conversion
2- Source code
3- Execution and output examples

Please, make it more simple; I just need to know how I should right its assembly code.

Explanation / Answer

.MODEL SMALL .DATA NL DB 0DH,0AH,'$' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX READ_CHAR: MOV AH,01H INT 21H CMP AL,0DH JE END_OF_SCAN CMP AL,2BH JE EVAL_PLUS CMP AL,2DH JE EVAL_MINUS CONV_ASCII: CMP AL,39H JLE CONVERT SUB AL,37H JMP TO_PUSH CONVERT: SUB AL,30H TO_PUSH: MOV AH,0 PUSH AX JMP READ_CHAR EVAL_PLUS: POP AX POP BX ADD AX,BX PUSH AX JMP READ_CHAR EVAL_MINUS: POP AX POP BX SUB AX,BX PUSH AX JMP READ_CHAR END_OF_SCAN: POP BX MOV CL,4 MOV AH,09H LEA DX,NL INT 21H NEXT_HEX: MOV DL,BL AND DL,0F0H SHR DL,CL CMP DL,9H JLE ZERO_TO_9 ADD DL,37H JMP DISPLAY ZERO_TO_9: ADD DL,30H DISPLAY: MOV AH,02H INT 21H SHL BL,CL CMP BL,0H JZ EXIT JMP NEXT_HEX EXIT: MOV AH,4CH INT 21H MAIN ENDP END MAIN OUTPUT *********** ENTER BASE:3 ENTER POWER:209 C: asm>EX12 ENTER BASE:4 ENTER POWER:4I6 C: asm>EX12 ENTER BASE:3 ENTER POWER:103