Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!samsung!uunet!munnari.oz.au!basser!metro!pta!teti!stephen From: stephen@teti.qhtours.oz (Stephen Chung) Newsgroups: aus.computers,comp.lang.c Subject: BASIC --> C "INTELLIGENT" translator Message-ID: <255@teti.qhtours.oz> Date: 21 Nov 89 23:28:58 GMT Reply-To: stephen@teti.UUCP (Stephen Chung) Organization: Q.H.Tours Ltd (Jetabout), North Sydney, Australia. Lines: 35 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