I'm glad you guys are enjoying it. Sorry Owen, I was not online when you were having your problems. I'm glad you got it sorted out. I think your indentation style is heavily influenced from assembly language.
Leading and trailing white space is not considered, and before any processing happens on a line, all white space is trimmed from both ends. If you "define" a label, it has to be the first token on a line and end with a single colon. You can use A-Z, a-z, 0-9, - (hyphen), and _ (underscore). Labels *are* case sensitive and have no *practical* length, however I would not really go too crazy, after all, you have to type them. Currently labels are global.
I do need to get the latest changes documented though. There is support for line numbers now, as CS1 pointed out (and as you accidentally discovered, Owen) they force the internal line number counter to the specified line number. There is no checking that your line number is valid. Remember, this is ONLY a translator, there is NO syntax checking going on here. I could add all that, but then it would be too much like a real language, so I might as well spend my time *making* a real language instead.
This may be my new development platform... how freakin cool is this thing?!
I'll be up all night on this damn translator... thanks alot, Matthew. My wife is already on my ass to get off the computer... but I'm having too much fun. =)
1 PRINT A:I put the colon AFTER the "PRINT A" instead of after "1"... I've since sorted it all out. =)
Actually, that is a valid BASIC statement, and that is the reason XB uses a double colon for its multi-line operator, instead of a single colon like every other BASIC of the day. It is also the reason if you use multiple colons after a PRINT statement, that you have to separate them out.
// This works in BASIC, but not XB
// You have to do this in XB
PRINT: : : : :
The trailing colon in a PRINT statement does something, but I can't remember. The semi-colon suppresses the newline I think. It was a stupid idea to double-up the colon token like that. Personally I would have changed the PRINT statement, but hey, I'm not writing an XB interpreter, so I don't have to worry about it.
Edited by matthew180, Wed Feb 16, 2011 9:15 AM.