Question
MIPS- +-*/ calculator Write a program that read in an input string of up to 20 characters in the following format and caluculate the result.
MIPS- +-*/ calculator
Write a program that read in an input string of up to 20 characters in the following format and caluculate the result.
"
where
- Id = 6 charatics alphabetic variable name
- Int = postive int value < 1000
- op = {+ or - or * or /}
I understand how to read in a string in MIPS, and how to perform the calculation once I have the op, Int1, and Int2. But I don't understand how to parses the string acording to the grammar, and find what is the Id/ Int1/. Int2/ op from the the string in MIPS. Can you please teach me/ write me the code on how to parses the string into Id/ Int1/ Int2/ op. Thanks!!
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