Lang has a reader, reading trees with the symbols, a resolver, which resolves all the types from constants specification by the user and function overloading. This little article is about what follows, converting to C, or Lisp. (Or anything else)
From that last one one also, of course wants to convert to something that can actually execute. I used to have a rather ugly function to convert to C directly. The problem with that is that C does not have higher order functions or bodies inside function arguments.
The older solution solved that in the conversion itself, which is probably why it stunk so much. The newer version works differently; it uses conversion functions that can only convert a subset of Lang.
However, i add transformations that change Lang code such that it is in those subsets. That way, if i want to add conversions to other languages, it should be easy, unless the language a smaller subset then previously encountered. In that case, i would have to make another transformation. I might be overconfident here, though.
Note that it is still very incomplete, no higher order functions yet. Making a transformation to that subset for C might be tricky, for conversion to Common Lisp it isn't a subset. Another thing that i didn't do yet is types for the common lisp version. First, i am planning to express number types like this: (integer from to) and (number from to), that would work with lisp better. (I also want to keep C-like number treatment though.)
This principle, and the code might well be able to convert Common Lisp to other stuff as wel, i guess i don't have to worry that this work is useless if the Lang project fails.