dcpu16
dcpu16 copied to clipboard
invalid operand
I'm getting:
hello.asm:10: invalid operand hello.asm:10: >> :nextchar ife [data+i], 0 ; If the character is 0 .. <<
When I try running Notch's "hello world" code through a16.
https://raw.github.com/jtauber/DCPU-16-Examples/master/hello.asm
Any thoughts on that? I haven't completely traced through your code to see where things go awry, yet.
Ah I see what it is. 'data' is a keyword so it's getting confused.
Hmm. That's fixable. It gets a little weird though if you want to be able to use labels named "a" or the like. Easiest fix for now is probably removing the DATA alias for DAT
Yeah, I think the best solution would be to put the lexer into a 'look for label' mode when at that part of the parser. I'd guess it'd not try to match against keywords, but only registers at that point.
The problem is that [a,b] is ambiguous if we allow labels to alias register names. Aliasing keywords is not a problem though, you're right.