tags:

views:

20

answers:

0

I have implemented this in C++, so I have a general idea. The algorithm is:
1. read the expression into an array/string
2. check the ascii code for each of the entered character
3. if ascii values of entered char are in the range 48-57 then it's an integer
4. if char entered is integer - push on stack
5. if char entered is operator - pop the stack and perform the operation and push the result onto the stack

Since I'm new to MIPS, I'm not very comfortable with it yet.

My questions are:
Would it be better to read the user input into a string or an array?
How do I read user input so that I can positionally access each character entered?
How should I check if the entered char is an int (ascii values in the range 48-57). I know there are MIPS instruction that can check less than - blt etc, but I'm not sure how to test the range since you can't use && operation in mips.

Thanks in advance.