-
Basic To C++ Converter
I am attempting to make a BASIC to C++ converter... The name should say it all, but for you people who dont understand; it takes a .BAS file (BASIC) and re-writes the code to a .CPP file (C++); Now the program doesnt just copy one file to another, it converts the sorce to a C++ version.
Example
BASIC
-------
IF a= 10 then print "This is a test"
C++
-----
if (a = 10 ) cout << "This is a test" << endl;
Now what i need help with is coping identifires
I cant change this code
BASIC
-------
DIM a AS INTEGER
Its supposed to change to
int a
Can you please help
---------------------------
check out my site
http://home.dencity.com/neoprogramming/index.html
-
-
What are you looking for?
> DIM a AS INTEGER
read "DIM" - and throw it away
read "a" - save it in varName
read "AS" - and throw it away
read "INTEGER", perform a table lookup which translates BAS types to C++ types,
output table["INTEGER"] " " varName ";"
This simplistic approach will work for simple files, but for anything complex, you need to understand language grammars, parsing and how compilers and intepreters generally work.
And you didn't post any code...
-
you are wasting my and your time, screw you, basic is a dead "language", deal
-
I think it's great
Actually I think it's great. If you would like to update old programs into C++, this would be easier. Like ORE. It's a MMRPG engine, written in Visual Basic. Which is exactly the same as basic, they just included some stuff for VB, but anyway. Using a converter, a programmer fluent in C++ but not Basic could edit the engine. DUH YOU IDIOT.