开发者

Declaring more than one SPIM array causes a syntax error

开发者 https://www.devze.com 2022-12-29 02:29 出处:网络
Below is the beginning of a chunk of SPIM code: .data a:.space20 b:.space20 .text set_all: sw $ra,0($sp) li $t0,0

Below is the beginning of a chunk of SPIM code:

    .data
a:  .space  20
b:  .space  20

    .text
set_all:
    sw $ra,0($sp)
    li $t0,0
    li $t1,10
............

Unfortunately, the second array I declare ('b') causes the SPIM interpreter to spit out:

spim: (parser) syntax error on line 3
of file spim.out      b:    .space  20
                        ^

Similar code works when I only have one array -- it seems to be the second that screws it up. I've prodded at it but can't figure out what it is about that statement that makes it break. Any 开发者_开发问答thoughts? Thanks for any insight.


/facepalm

After poking around a bit more, I remembered that 'b' is a reserved word in SPIM. It stands for 'branch'. Hoo boy.

0

精彩评论

暂无评论...
验证码 换一张
取 消