{
    "content": "<h1>Transpilers<\/h1><p>A <a href=\"..\/Transpiler\/\">Transpiler<\/a>, or source-to-source compiler, is a type of <a href=\"..\/Compiler\/\">Compiler<\/a> that translates the source code of a program from one high-level <a href=\"..\/Programming-Language\/\">Programming Language<\/a> to another. Unlike traditional compilers that translate high-level code into low-level <a href=\"..\/Machine-Code\/\">Machine Code<\/a>, transpilers operate at a similar level of abstraction. This process is fundamental in modern <a href=\"..\/Software-Engineering\/\">Software Engineering<\/a> for maintaining compatibility and adopting new language features before they are natively supported by runtimes.<\/p><h2>Core Functionality and Examples<\/h2><p>The primary utility of a <a href=\"..\/Transpiler\/\">Transpiler<\/a> is to enable developers to write code in a preferred syntax while targeting an environment that does not support it. For instance, <a href=\"..\/Babel\/\">Babel<\/a> is a widely used tool in <a href=\"..\/Web-Development\/\">Web Development<\/a> that converts modern <a href=\"..\/JavaScript\/\">JavaScript<\/a> (ES6+) into a version compatible with legacy browsers. Similarly, <a href=\"..\/TypeScript\/\">TypeScript<\/a> acts as a superset of <a href=\"..\/JavaScript\/\">JavaScript<\/a>, providing static typing that is eventually stripped away during the transpilation process to produce standard <a href=\"..\/JavaScript\/\">JavaScript<\/a>. Other notable examples include <a href=\"..\/CoffeeScript\/\">CoffeeScript<\/a>, <a href=\"..\/Dart\/\">Dart<\/a>, and <a href=\"..\/Haxe\/\">Haxe<\/a>, which can target multiple platforms.<\/p><h2>The Transpilation Pipeline<\/h2><p>The technical process typically involves three major phases: parsing, transformation, and code generation. During the parsing phase, the source code is analyzed to create an <a href=\"..\/Abstract-Syntax-Tree\/\">Abstract Syntax Tree<\/a> (AST). The transformation phase modifies this tree to replace unsupported syntax with equivalent constructs in the target language. Finally, the generator converts the modified AST back into a string of source code. According to the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Transpiler\">MDN Web Docs<\/a>, this allows for the use of <a href=\"..\/Syntactic-Sugar\/\">Syntactic Sugar<\/a> without sacrificing reach. Detailed technical comparisons can also be found via <a href=\"https:\/\/en.wikipedia.org\/wiki\/Source-to-source_compiler\">Wikipedia's overview of source-to-source compilers<\/a>.<\/p><ul><li><a href=\"..\/Compilers\/\">Compilers<\/a><\/li><li><a href=\"..\/Polyfills\/\">Polyfills<\/a><\/li><li><a href=\"..\/Static-Analysis\/\">Static Analysis<\/a><\/li><li><a href=\"..\/Preprocessors\/\">Preprocessors<\/a><\/li><\/ul>",
    "tags": [
        "transpiler",
        "compiler",
        "javascript",
        "typescript",
        "babel",
        "programming",
        "web development",
        "software engineering",
        "ast",
        "source-to-source"
    ]
}