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.

" :: = Id = Int op Int"

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!