I am engaged in a project that works mainly in AutoCAD to design and manufacture prefabricated building components such as roofing trusses. One of our goals is to redesign a program that was written in LISP that functions in designing roofing trusses. We are to rewrite the LISP code in C# and incrementally implement it into the current libraries that they have set up.
My problem is that I have been tasked with building a rudimentary LISP to C# converter. After some research (as Google results quickly show that such a thing does not readily exist on hand), I have come to the question of which way of converting this legacy code would be more efficient. Would it be better to take chunks of the LISP code to analyze and rewrite in C#, or should I continue on with developing a rudimentary converter for the AutoLISP code?
1
Hopefully the problem domain that you just described is relatively small. That is, the code you are converting is constrained to a small handful of specific AutoLISP functions, and you don’t have to represent the entirety of AutoLISP semantics in C#.
If that’s the case, the first thing I would do is find some AutoLISP code that’s fairly representative of the code that you want to convert, and convert it by hand. Ideally, you’ll find a pattern that allows you to perform a simple transliteration; that is, code in AutoLISP that maps directly to some functions that you write in C#.
It is a good idea to perform the manual conversion at least once. It will give you better insight into how the translation process works. What you are attempting is not at all the same thing as, say, a VB.NET to C# converter, since that kind of converter is mapping very similar semantics to what amounts to syntax variations.
In other words, converting between two languages that are so different is normally done by hand. When it is done in an automated fashion, it is usually done by writing some functions in the target language that mimic the functions in the source language, and then stitching those functions together.
1