Parsing Mips汇编计算器公式解析

Parsing Mips汇编计算器公式解析,parsing,assembly,mips,calculator,storing-data,Parsing,Assembly,Mips,Calculator,Storing Data,我正在做一个mips汇编语言类型的计算器。它得到一个方程作为数据,我必须解析方程并遵循PEMDAS(操作顺序)。我似乎不知道如何解析和存储字符串以便这样做。我知道你必须检查方程的十六进制值才能知道要解决什么数学问题,但不知道如何编写代码。同样,在我们乘以两个数字之后,如何将答案放回方程中,继续迭代。下面是我编写的一些代码,需要完成这项工作。这个等式只是一个例子。括号和指数不在本节中使用。由于这是程序集,我没有把我的确切代码放进去,因为那会有很多行,但我画了一个大纲,我需要修复或帮助,以及我拥有和

我正在做一个mips汇编语言类型的计算器。它得到一个方程作为数据,我必须解析方程并遵循PEMDAS(操作顺序)。我似乎不知道如何解析和存储字符串以便这样做。我知道你必须检查方程的十六进制值才能知道要解决什么数学问题,但不知道如何编写代码。同样,在我们乘以两个数字之后,如何将答案放回方程中,继续迭代。下面是我编写的一些代码,需要完成这项工作。这个等式只是一个例子。括号和指数不在本节中使用。由于这是程序集,我没有把我的确切代码放进去,因为那会有很多行,但我画了一个大纲,我需要修复或帮助,以及我拥有和理解的东西。如果我能理解解析,以及方程式和数字是如何存储的,我可能会自己解决其余的问题,所以我真的需要解析和pemdasone、2和3标签方面的帮助

.globl division
.globl multiplication
.globl addition
.globl subtraction
.globl end
.globl PemdasOne
.globl PemdasTwo
.globl PemdasThree
.globl parse

.data
a: .half 2
b: .half 3
c: .half 8
d: .half 35
exp: .asciiz "b:=26/a-c+b"

.text
parse:
    (HELP!This is the part that needs work.) (HELP! Read and store     expression)
    (HELP! Create iterator to keep spot in the equation?)

pemdasone:
    (HELP! Check if ascii value at iterator is * or /)
    (UNDERSTAND: if so branch or jump to math equation)
    (UNDERSTAND: if not branch or jump to pemdastwo)
pemdastwo:
    (HELP! check if ascii value at iterator is + or -, reiterate through equation with updated values after pemdasone is done with what it does)
    (UNDERSTAND: if so branch or jump to math equation)
    (UNDERSTAND: if not branch or jump to pemdasthree)
pemdasthree:
    (HELP! check if equation is completed. Store answer in variable b so it is updated from the input value to the answervalue.)
    (UNDERSTAND that if it is done jump to end label)

multiplication: 
    (HELP! get number before the ascii value of * and fter the ascii value of * and store them in registers for the equation.)
    (UNDERSTAND: how to do the mathmatical operator with two numbers.)
    (HELP! store answer in equation so you can keep doing the equation)
    (UNDERSTAND: that jump or branch back to pemdasone)
division:
    (All the math parts are the same help and understands just with new operator and jump and branch locations)
addition:
    (Same help and understands as divide and multiply except jump to pemdastwo)
subtraction:
    (Same as addition)
end:
    (UNDERSTAND that you store the answer into the variable it tells you to)
    (HELP! with memory and where we stored the answer)

先用C、Java或其他熟悉的语言编写程序(使用尽可能少的库函数)。然后使用MIPS指令集引用(即MIPS32)将其转录到MIPS程序集中™ 程序员体系结构第二卷:MIPS32™ 指令集)。