Language translators: everything you need to build
Yes. They are called compilers.
Compilers are just one example of a class of programs called language translators.
Compilers convert higher-level languages ββsuch as C ++ and Java to lower-level languages, including VM bytecodes, assembly, C, or directly into object-coded machine code.
a source to share
This is effectively what any compiler does, since assembler is just another form of machine code. I believe that GCC does this explicitly, and you can ask it to show you an intermediate assembler. For example, take a look at the GNU Assembler .
a source to share
Problems arise when you say that something is "perfectly possible." A feature of one language often does not translate directly or easily to another; why we choose the language for the problem in the first place! For example converting Fibonacci number from Java to C is trivial, but for Haskell? It's still doable of course, but try converting a program that opens posix streams and listens on multiple ports for different bits of network traffic.
Almost every piece of useful code is widely used in external libraries, many of which are not open source. Other than that, what do you think should be translated to C? Java even?
def method( f ):
G = {'a':1}
f(G)
def f( x ):
print( [ (key, value) for (key,value) in x.items() ] )
method(f)
This task is inherently more difficult than it seems for anything other than the most trivial case (the C language for the C language). The transition between static and dynamically typed languages ββwill be as rough as any language.
a source to share
Here is a program to convert .NET code to Java, PHP, JavaScript and ActionScript http://jsc.sourceforge.net/
a source to share
There are tools that allow you to translate one language into another. Basically, there is a parser, translator and printer.
The parser explicitly parses the source in the AST .
The translator then has to convert the AST to structures that make sense in the target language.
Finally, the printer understands post-transformed structures and can output this target code.
a source to share