Despite the fact that the term “transpiling” has been around since last century, there appears to be a fair bit of confusion about what it means and what the difference between transpiling and compiling is.
Firstly, transpiling is a specific kind of compiling. This helps a great deal as we now know we are talking about the same kind of thing. It is actually a specific kind of compiling. So how do we define it compared to the more general term?
- is the general term for taking source code written in one language and transforming into another
- is a specific term for taking source code written in one language and transforming into another language that has a similar level of abstraction
So (simplistically) when you compile C#, your method bodies are transformed by the compiler into IL. This cannot be called transpiling because the two languages are very different levels of abstraction.
Both compilers and transpilers can optimise the code as part of the process.