Skip to content
kripken edited this page Jun 12, 2011 · 161 revisions

Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode (which can be generated from C/C++, using llvm-gcc or clang, or any other language that can be converted into LLVM) and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Using Emscripten, you can

  • Compile C and C++ code into JavaScript and run that on the web
  • Run code in languages like Python as well, by compiling CPython from C to JavaScript and interpreting code in that on the web

Demos

  • Python - CPython compiled to JavaScript.
  • Bullet physics - The Bullet physics engine, combined with WebGL rendering [recently updated!]
  • Poppler - PDF rendering in JavaScript, using Poppler and FreeType. Warning: Very large (>12MB) download.
  • Ray tracing - A simple C++ ray tracer, rendering to a canvas element
  • OpenJPEG - JPEG 2000 decoding in JavaScript, using OpenJPEG
  • FreeType - TrueType font rendering in JavaScript, using FreeType
  • Lua - The Lua interpreter

Note: Most or all of the demos are not optimized or even minified. It may take a short while to download a few MB of source code for each one.

Links

  • FAQ - Goals of this project, what it can be used for, architecture overview, limitations, etc.
  • Getting Started - How to build the project, run the tests, etc.
  • Developer blogs: kripken/azakai
  • Technical Paper - A detailed writeup about how Emscripten works (the memory model, Relooper algorithm, etc.).

Get in Touch

  • IRC: #emscripten on irc.mozilla.org
  • Mailing list: emscripten-discuss
  • Bug reports: Please file issues here on GitHub.

Clone this wiki locally