Content deleted Content added
Matthiaspaul (talk | contribs) →References: improved ref |
Changed 'assembler' to 'assembly' |
||
Line 5:
{{Program execution}}
{{Data transformation}}
A '''source-to-source translator''', '''source-to-source compiler''' ('''S2S compiler'''), '''transcompiler''', or '''transpiler'''<ref name="ARC_1988_Transpiler"/><ref name="Pountain_1989"/><ref name="Sector7_1993_Transpiler"/> is a type of [[translator (computing)|translator]] that takes the [[source code]] of a program written in a [[programming language]] as its input and produces an equivalent source code in the same or a different programming language. A source-to-source translator converts between programming languages that operate at approximately the same level of [[abstraction (computer science)|abstraction]], while a traditional [[compiler]] translates from a [[high-level programming language|higher level programming language]] to a [[low-level programming language|lower level programming language]]. For example, a source-to-source translator may perform a translation of a program from [[Python (programming language)|Python]] to [[JavaScript (programming language)|JavaScript]], while a traditional compiler translates from a language like [[C (programming language)|C]] to [[Assembly language|
Another purpose of source-to-source-compiling is translating legacy code to use the next version of the underlying programming language or an API that breaks backward compatibility. It will perform automatic [[code refactoring]] which is useful when the programs to refactor are outside the control of the original implementer (for example, converting programs from Python 2 to Python 3, or converting programs from an old API to the new API) or when the size of the program makes it impractical or time-consuming to refactor it by hand.
|