简体   繁体   中英

operators and strings in MIPS

I'm trying to figure out how to do this in MIPS:

Example:

sum(7,sum(subtraction(0,5),multiplication(division(7,2),3)))

Starting from left to right, where sum , subtraction , multiplication , division are strings that have the same functions of the basic operators. So, to do the first sum you need 2 numbers so the other sum is called. To do the second sum we need to do the subtraction and so on.

I was thinking to do it with labels but how can i assign an operator to a string?

You need to write the following functions that each take two arguments and return a result: sum, subtraction, multiplication, division . Then you need to call the functions in the correct order with the correct arguments.

You should study the MIPS calling convention to see how to write the functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM