Transpilers : Source-to-Source Compilers

The Titans Transpilers

Working

Types

  1. Transpilers may keep translated code structure as close to the source code as possible. Closeness here refers to the ease with which blocks of code from translated code can be mapped back to the original code. This is essential during development phase where there is a constant need to test and debug the source code.
  2. Transpilers may change the structure of the original code so much that the translated code does not look like the source code. This use case applies to scenarios where thoroughly tested code just needs to be ported to a new language or the IDE integrated transpiler reports back where error lies in the source code. These transpilers have an opportunity to reduce the size of and perform complex optimisations on the code since there is no need for understandability and readability of the code.

Uses

  • Migration: Migrate legacy code to a modern language.
  • Compatibility: Generate code conforming to an older version while developers benefit from features of a newer version, such as with browsers not updated to latest JavaScript standards.
  • Coding Skills: Codebase can be transpiled to a language in which the skills are readily available. Or it might be a matter of preference. For example, those who are from OOP background prefer TypeScript. Python coders prefer CoffeeScript instead. In both cases, code is transpiled to JavaScript.
  • Performance: Initial code was written for quick prototyping or project is moving to a different platform where another language is more suitable. Perhaps the target language has a better compiler that can generate more optimized code. For example, critical parts of a Python codebase can be transpiled to Fortran and then called from Python.

Popular Transpilers

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aarnav Jindal

Aarnav Jindal

Avid programmer chasing developments in the dynamic and invigorating world of technology 🤓