Parse error
Brought to you by:
jameslarus
This simple program caused a parse error on the label "b:" and it shouldn't have. Changing the label b: to bbb: fixes the problem! Here's the program:
# Data declarations
.data
a: .word 30
b: .word 45
c: .space 4
.text # to signify the start of your code
.globl main # The name of your main program
.ent main # optional, used to specify entry point if different from program name
main: lw $s1, a # load a into $s1. (Normally don't put such obvious comments in your code!)
lw $s2, bbb # BUG: Can't use the name b!!!
add $s3, $s1, $s2
sw $s3, c
# Done, now terminate program by returning to the "system"
li $v0, 10
syscall
.end main
Anonymous
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
The 2nd executable code text line should read, "lw $s2, b"
The problem is that "b" is the opcode for branch. All of the MIPS opcodes are reserved keywords that can't be used for labels.