What do we do at Leaning Technologies?

Author(s):

During the last few weeks, I had a few occasions in which I had to explain what I do at work.

Explaining how lucky I feel like and how rewarding it is to work on interesting problems is easy.

Telling that I spend most of the time at the coffee machine waiting either for recompilations of our codebase or for test results is somehow accurate but a bit too micro. I do also some work on optimizing our compiler results, data-structures, working on the testing infrastructure, or writing documentation.

But what do we do as a company?

There is an overlap between this and a business pitch, clients are always welcome, but the focus is on convincing you that it’s fun and rewarding spending time toying with our technology. And it may be even useful.

And what we do: a compiler, so a tool to translate from one programming language into another. In our case, the input is either C/C++/Java/.jar files. And the output is a mixture of JavaScript and WebAssembly.

Lots of nice buzzwords, but what does that mean / what can I show?

  • Cheerp: a compiler from C/C++ codebases to JS and/or Wasm
  • CheerpJ: a compiler form Java to JavaScript
  • our new project, CheerpX 🚀
  • few selected articles
  • a retro multiplayer shooter game

With some hand waving, it’s generally fine to use our products for private use or for an open-source project. That should cover most non-profit usage of the product. And you can always double-check with us, in the end, you will find how to get in touch.

1. Cheerp

Powerful diagram, by me 🙂

It’s a command-line tool that works basically as a replacement for clang (it’s even invoked like /path/to/cheerp/directory/bin/clang++), accepting most of the clang options.

It will then produce a JavaScript file that will instantiate a Wasm module, and they will go hand in hand, with the JavaScript side interacting with browser APIs, inputs and outputs and the Wasm side churning whatever computation is required. (Other compilation modes like pure JS are available, but we concentrate on the main one)

Most small examples will compile out of the box, and the magic will work just so. On bigger codebases, it may or may not work with a single line, since the build system will need to be adapted and there are generally more chances of problems arising. Custom warnings and errors are well described and will guide in the right direction to a smooth solution.

Bonus part: memory model

Memory for Wasm is basically a big chunk of memory addressed via an integer, and this maps quite naturally with C++ memory management, but how things work on the JavaScript side?

You may work with the “big chunk of memory” model, but how could you then interact with browser API’s or other JavaScript code? How would you know whether to keep the memory alive or free it? Either you restrict a lot what the possible interactions with other libraries are or you could rely on the compiler to instantiate C++ objects as regular JavaScript objects.

This creates a lot of other possible problems, to name one JavaScript does not have the concept of pointers, so no pointer arithmetic/pointer ordering will be possible. But this and other problems are all solved by the compiler (and before that, by us 😺).

So the Cheerp compiler will internally tag each class/struct as either living in one model or in the other. “JavaScript-like” objects than make for 0-overhead interoperability while “big chunk of memory” objects could be generally more performant.

You can now follow the wiki instruction and get started with experimenting, or I can show two demos:

Teeworlds

Here it starts with a complex C++ codebase that requires audio, video, communication with other peers, performance tuning and many other problems.

The result is a fun gaming experience, on the browser, no installation required. And you can jump around and shoot at total strangers.

A fast BigInt in an evening

This should show that there is a lot of attention to the performances of the resulting programs, and we aim to be close to native speed.

This article also doubles down as a tutorial of a sort, and substituting BigInt with whatever library you may need should be a fun way to start playing with Cheerp.

2. CheerpJ

There are 3 ways to experiment with it:

Java Fiddle

The site is in need of a redesign (want to help?) but should be intuitive enough. You basically code any Java on the left, click “compile and run” and to the right, you will see the console output + any visual element you may have drawn.

CheerpJ Applet Runner

This is mainly thought for users of websites where there are legacy java applets, and it’s a safe alternative to messing with the security options of your browser.

You just add the extension and whatever content present on the sites you browse will properly execute.

Here an article on how it solves a problem for a high-school professor: Java Applet archaeology.

To next year, ViewSource!

CheerpJ is also a command-line tool: it takes a .jar file, and produce an equivalent JavaScript file. Check out the documentation for getting started!

3. CheerpX

It’s unclear whether the name of the technology is temporary or not, but you can read more of what surprises are we working on directly on our CTO Alessandro’s article:

Get in touch!

Author(s):

During the last few weeks, I had a few occasions in which I had to explain what I do at work.

Explaining how lucky I feel like and how rewarding it is to work on interesting problems is easy.

Telling that I spend most of the time at the coffee machine waiting either for recompilations of our codebase or for test results is somehow accurate but a bit too micro. I do also some work on optimizing our compiler results, data-structures, working on the testing infrastructure, or writing documentation.

But what do we do as a company?

There is an overlap between this and a business pitch, clients are always welcome, but the focus is on convincing you that it’s fun and rewarding spending time toying with our technology. And it may be even useful.

And what we do: a compiler, so a tool to translate from one programming language into another. In our case, the input is either C/C++/Java/.jar files. And the output is a mixture of JavaScript and WebAssembly.

Lots of nice buzzwords, but what does that mean / what can I show?

  • Cheerp: a compiler from C/C++ codebases to JS and/or Wasm
  • CheerpJ: a compiler form Java to JavaScript
  • our new project, CheerpX 🚀
  • few selected articles
  • a retro multiplayer shooter game

With some hand waving, it’s generally fine to use our products for private use or for an open-source project. That should cover most non-profit usage of the product. And you can always double-check with us, in the end, you will find how to get in touch.

1. Cheerp

Powerful diagram, by me 🙂

It’s a command-line tool that works basically as a replacement for clang (it’s even invoked like /path/to/cheerp/directory/bin/clang++), accepting most of the clang options.

It will then produce a JavaScript file that will instantiate a Wasm module, and they will go hand in hand, with the JavaScript side interacting with browser APIs, inputs and outputs and the Wasm side churning whatever computation is required. (Other compilation modes like pure JS are available, but we concentrate on the main one)

Most small examples will compile out of the box, and the magic will work just so. On bigger codebases, it may or may not work with a single line, since the build system will need to be adapted and there are generally more chances of problems arising. Custom warnings and errors are well described and will guide in the right direction to a smooth solution.

Bonus part: memory model

Memory for Wasm is basically a big chunk of memory addressed via an integer, and this maps quite naturally with C++ memory management, but how things work on the JavaScript side?

You may work with the “big chunk of memory” model, but how could you then interact with browser API’s or other JavaScript code? How would you know whether to keep the memory alive or free it? Either you restrict a lot what the possible interactions with other libraries are or you could rely on the compiler to instantiate C++ objects as regular JavaScript objects.

This creates a lot of other possible problems, to name one JavaScript does not have the concept of pointers, so no pointer arithmetic/pointer ordering will be possible. But this and other problems are all solved by the compiler (and before that, by us 😺).

So the Cheerp compiler will internally tag each class/struct as either living in one model or in the other. “JavaScript-like” objects than make for 0-overhead interoperability while “big chunk of memory” objects could be generally more performant.

You can now follow the wiki instruction and get started with experimenting, or I can show two demos:

Teeworlds

Here it starts with a complex C++ codebase that requires audio, video, communication with other peers, performance tuning and many other problems.

The result is a fun gaming experience, on the browser, no installation required. And you can jump around and shoot at total strangers.

A fast BigInt in an evening

This should show that there is a lot of attention to the performances of the resulting programs, and we aim to be close to native speed.

This article also doubles down as a tutorial of a sort, and substituting BigInt with whatever library you may need should be a fun way to start playing with Cheerp.

2. CheerpJ

There are 3 ways to experiment with it:

Java Fiddle

The site is in need of a redesign (want to help?) but should be intuitive enough. You basically code any Java on the left, click “compile and run” and to the right, you will see the console output + any visual element you may have drawn.

CheerpJ Applet Runner

This is mainly thought for users of websites where there are legacy java applets, and it’s a safe alternative to messing with the security options of your browser.

You just add the extension and whatever content present on the sites you browse will properly execute.

Here an article on how it solves a problem for a high-school professor: Java Applet archaeology.

To next year, ViewSource!

CheerpJ is also a command-line tool: it takes a .jar file, and produce an equivalent JavaScript file. Check out the documentation for getting started!

3. CheerpX

It’s unclear whether the name of the technology is temporary or not, but you can read more of what surprises are we working on directly on our CTO Alessandro’s article:

Get in touch!

Latest Blogs