Basic to C Translator (B2CTrans)
B2CTrans developed from my earliest gaming interests back in the 1980s where games where written and distributed in listings in various flavors of the BASIC programming language.
Back then an old friend of mine, Dave, and I spent many hours laboriously typing in these programs from listings. OCR wasn’t a reality for us yet. Both Dave and I worked on mainframe computers so games were pretty rare. So after many hours of cramped hands we got to play our games. They were trivial but fun.
However, BASIC has gone from an interesting alternative to my commonly used Fortran and Cobol (yuk!) programming, at the time, to a nuisance, especially after getting used to structured modern languages.
The idea of translating these programs into C appealed to me but the process didn’t so I decided to let my university education kick in and I built a Lex/Yacc based translator to convert them. This seemed to work very well. The days and weeks it took to develop B2CTrans was well offset by the 1/10sec it took to translate these BASIC programs ;-).
If you are a programmer you’ll understand that the more sophisticated compiler programming was a lot more rewarding than the original games so I lost a little bit of my interest in the games themselves.
Once I get B2CTrans working again I’d like to progress to doing a Fortran-to-C translator because I’ve got the Empire and Galaxy sources I’d like to translate and get working again too.
The B2CTrans project got to the point where I wanted to convert the BASIC spaghetti code into a structured C instead of doing a straight line-for-line translation. But I got bogged down in trying to translate my parse tree in place and put the project down for a while.
When I tripped across a project called BNFC (Backus-Naur Form Converter) this reignited my interest in B2CTrans as it makes the front end considerably easier to re-write from scratch.
Once I get this working again I’d like to progress to doing a Fortran-to-C translator because I’ve got the Empire, Galaxy and Star Trek sources I’d like to translate and get working again too.