Emscripten’s job is to compile different languages into each other . The main challenge here is to translate a machine-level source language (LLVM) into another type of language (high-level language). This means that Emscripten is faced with the opposite task that a compiler normally does.
Emscripten is an open source project. It is available under license from MIT and under license from University of Illinois / NCS Open Source (UIUC license). The main developer of the project is Alon Zakai, who is also known for his work for Mozilla. As a term, Emscripten is a neologism from the made-up word embiggen. This is originally from the series “The Simpsons”.
Challenges and special features
Translating a machine-level language into a high-level language involves a number of challenges that differ from other compilers.
Connection to the LLVM compiler infrastructure
LLVM is an own name for the project and originally stood as an abbreviation for Low Level Virtual Machine. It no longer has much in common with the original version of a virtual machine. The LLVM project defines the LLVM assembly language.
The LLVM IR (LLVM intermediate representation) represents an abstraction of the machine language for current processors. The code of a certain programming language can be translated into the LLVM language through a front end. A backend can then translate the LLVM into the code of the target platform
Execution of languages and possibilities
Emscripten and its inner functionality
Emscripten’s compilation work can be viewed in ideal-typical phases. First, the LLVM code is transferred into the internal representation of the code by means of emscripts. This is done via the so-called intertyper.
Areas of application and tools
This includes emcc, a kind of replacement for the gcc compiler. This has largely identical calling conventions. In simple use cases, users can simply use emcc instead of the gcc compiler to create projects. Emcc takes care of the generation of the LLVM bit code, using the interfaces available in Emscripts.