The transpiler then transforms this AST of the source language (Python) into the AST of the target language (JavaScript), which is converted into runnable JavaScript code.
Transpilers work by parsing the source code into a data structure known as an Abstract Syntax Tree (AST), which represents the code’s syntactic structure in a tree format. The transpiler then transforms this AST of the source language (Python) into the AST of the target language (JavaScript), which is converted into runnable JavaScript code.