Reputation: 21
I'm making ARM processor, but error occured at unexpected part!:( I know about using tab, but I don't know about what is wrong. please help me!!!
def LDSTR():
global k
I=memory[k]/0b10000000000000000000000000%0b10
P=memory[k]/0b1000000000000000000000000%0b10
B=memory[k]/0b10000000000000000000000%0b10
W=memory[k]/0b1000000000000000000000%0b10
L=memory[k]/0b100000000000000000000%0b10
if(I==0):
if(P==0):
#add offset after transfer (example) ldr Rx,[Ry],Rz
if(B==0):
#ldr/str word (example) ldr Rx,Ry
if(W==0):
#no '!'
if(L==0):
#str Rx,[Ry],Rz
elif(L==1): >>>error occured!!
#ldr Rx,[Ry],Rz
elif(W==1):
#'!'exists (example)ldr Rx,[Ry,Rz]!
if(L==0):
#str Rx,[Ry],Rz!
elif(L==1):
#ldr Rx,[Ry],Rz!
Upvotes: 1
Views: 69
Reputation: 34146
The if-elif
block are empty. Python expects a sentence after the conditions.
If you want to have an empty block you can use the keyword pass
:
if (...):
pass
elif (...):
pass
Note: Comments #...
are ommited, and not considered as statements.
Upvotes: 2
Reputation: 21
You don't have any code (just a comment) after the if statement where the error occurs.
If you add pass
wherever you don't have code (just a comment), things should start to work.
Upvotes: 0
Reputation: 7562
no wonder, there's nothing between if
and elif
:
if(L==0):
elif(L==1):
this is a syntax error.
you can put a pass
in between, if you don't care about that branch:
if(L==0):
pass
elif(L==1):
pass
Upvotes: 0