Good dealby (no login)
A little late on the draw, but better late than never. What's preventing the usage of arguments or shared variables? Shared variables can be implemented via normal global variables, and function arguments are very easy to translate between BASIC and C. You're using an LR parser, right? If so, then it's a simple case of this:
-First token will either be BYREF, BYVAL, or (unrecognized), and if (unrecognized), then it's assumed to be a variable.
-If previous token was (unrecognized), skip this step, otherwise use this token as the variable name.
-end of argument? (caused by a comma or end parenthesis.) If not, the next token should be AS, and failing this, generate a syntax error
-If a previous token existed and was AS, the final token will be the variable type.
-Make sure this is the end of the argument by checking for comma or end parenthesis. If both are missing, generate a syntax error.
Now that you have your data set, you can easily convert it to working code:
-Assign the variable type. If this was missing on the argument list, just assign it as the current default data type.
-Pointer for BYREF? If BYREF wasn't used or implied (as it is by default), skip this step.
Pretty easy to implement, really. It should work the same if you're using an LL parser too.
Return to Index