Would a practical approach be parsing the source into clang's AST format. Then let it make the actual executable.