stephen@teti.qhtours.oz (Stephen Chung) (11/22/89)
I know, I know, this is another one of those XYZ Language --> C posting again. Is there a BASIC to C translator? Obviously, it will be trivial to write some form of a translater that translates BASIC programs to C, but not READABLE and MAINTAINABLE C. I am planning to write a translater that does a bit of thinking. First of all, it should use flow analysis to determine chunks of code that should be "function"ized and make them into functions. Second of all, it should determine (from the usage) whether a variable (A, A1, B, C15 etc.) is constant, local or global. Certain variables, notisably X and I, are used extensively to run counter loops. Although the usages are global, they should be translated into a number of local counter variables for each function. The same apply to other variables. It should probably rename obvious variables or prompt the author for it. My goal is to translate BASIC into C programs that MEAN something, and maintainable, instead of simply translator output. That way, a lot of programs written by non-computer people who only knows BASIC can be transferred easily to UNIX. Any suggestions on which BASIC to go for? I am biased towards GW BASIC on the PC because it is popular. In my plan, the translator should generate a C program with curses calls if the BASIC program uses screen addressing. Obviously, nothing much will be done (at this point) for graphics. I will appreciate any ideas, suggestions etc. If you know such a translator already exists, please tell me so I won't reinvent the chocolate chip cookie. Cheers Stephen