After I implemented labels and macros, I figured that it would be nice if I was able to define them all in one place and then re-use them over and over again. Hence, the concept of imports.
Examples: In file macros.b: # Macro to convert ASCII representation of integer to actual # integer value *OFFSET = 48; @atoi(CHR) = -$OFFSET$CHR; # Macro to convert integer value to ASCII representation of # integer value @itoa(NUM) = +$OFFSET$NUM; In file macro-use.bad: %macros.b # Input a character ?a # Convert to actual integer value &atoi(a) # Store the number 9 in location pointed to by value in # register a >9[a # Convert 9 to ASCII value of the character '9' (57) &itoa([a)
By convention, bAdkOde scripts end with the extension bad, whereas macro-definition files end with the extension b. Also, macro-definition files shouldn't contain any actual code. Any such code is ignored. It's possible to "overload" macros. You can have macros that share the same name, but they must have different numbers of parameters.
Example bAdkOde scripts
Here are a few example scripts:
# prints the first 10 fibonacci numbers
# reverse prints what ever the user enters
# takes whatever the user enters and stores it in memory
# and then prints it out
As you can see, pretty unreadable. I've tried to provide a semblance of readability in some scripts by indenting. But you can pretty much write everything in one line and it'll work.