Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. A
source-to-source compiler is a type of compiler that takes a high level
programming language as its input and outputs a high level language. For
example, an automatic parallelizing compiler will frequently take in a
high level language program as an input and then transform the code and
annotate it with parallel code annotations (e.g., OpenMP) or language
constructs (e.g. Fortran's DOALL statements). 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.