Weird Compiler

Because TeX and SH are wonderful VMs.

Version 0.2.2 is out! —

Version 0.2.2 is out! So what’s new in this version:

  • Lots of optimisations: the shell backend is arround 3 to 4 times faster thanks to new closure implementation, the lambda lifting algorithm handles recursion itself and there is direct support for if-then-else constructions. Concretely, the rec.wc example does not require any closure any more! The shell backend is now fast enough for non-trivial applications.
  • OWC: the Weird Compiled goes online! Thanks to obrowser, the compiler can run in the browser so you can compile your programs online without installing anything! Great isn’t it!

Once again, you can download the tar and zip archives or clone the git repository:

git clone git://


The Online Weird Compiler —

Many people (i mean 2 actually) complained about no examples online. Someone even asked for screenshots. I’m not convinced that screenshots are really important to present a compiler but still, there’s the point: the project need some online presentation. I may have posted some screenshots or some examples, but thanks to obrowser, there’s a much better way: why not trying it online?

The compiler comes now with an online version called the Online Weird Compiler available here. You can either click on the selection item to pick one of the examples or type your own code. Then select a compilation method to output the compiled code into the right-hand side text area. Copy-paste it and run in with TeX or a shell!

Version 0.2: 10 times faster! —

Version 2.0 is out and is about 10 times faster than version 1! The compilation algorithm has been completely rewritten. The main benefits of new algorithm are:

  • If a program does not use higher-order functions, there is no closure creation overhead. So classic programs run as fast if they were written directly in TeX or Shell.
  • Functions may keep their name from the source to the compiled code. For example:
    let threesum = fun x y z -> let k = wcplus x y
                                in wcplus k z
    in ....

    will actually produce the function:

    threesum () {
       wcplus "$1" "$2"
       stackpop 1
       wcplus "$3" "$TMP1"

As usual, the sources are available via git at:

git clone git://

or via the tar and zip archives.

First Release —

Which are the most stable language or virtual machine? So stable that you don’t need to know the compiler’s version to be sure you can compile it. TeX is definitely one of them! Which ones are available on every Unix regardless of the operating system, version, libraries installed, etc? A POSIX shell is among them!

Unfortunately TeX is a difficult language. Both TeX and the Shell lack most of modern programming-language features. The Weird Compiler (WC) compiles a (yet minimalist) functional language to TeX or shell script.


WC is licensed under the terms of the GNU General Public License version 3 or any later.


The sources can be fetched by git:

git clone git://

Or download the tar or zip archives.