Documentation

Overview

The core innovation of Cubix is incremental parametric syntax. With incremental parametric syntax, we can build support for languages by surgically altering third-party language definitions to be slightly more generic. We can then write transformations on multiple languages using a hybrid of language-specific and generic-code. The upshot is that Cubix is the world's only framework that allows programmers to build a single source-to-source tool that runs on multiple languages.

Cubix, at time of writing supports only 5 languages: C, Java, JavaScript, Lua, and Python. Yet initial support for each language was added in only two days, and thus, as the Cubix userbase grows, we expect to add support for many more.

Outside of that, Cubix offers many additional features for building generic tools. There is no single ingredient to these, save a commitment to the practice of identifying commonalities between languages, and building a generic interface to query their differences. For example:

  • Local changes to syntax definitions. For example, while there are Cubix transformations that insert code at the start of a block, nothing may be inserted prior to a ""use strict"; statement in JavaScript. Cubix uses a modified definition of JavaScript blocks so that "use strict"; is not considered part of the block, enabling transformations to support this case with no language-specific code.
  • A generic interface for querying the strictness of a node (used to make transformations sensitive to short-circuiting operators).
  • A mini-framework for writing very compact control-flow graph generatorss.
  • And a mechanism to insert statements in a position based on control-flow, rather than by tree rewrites.

Cubix is still in its infancy escaping the walls of MIT, and we are being proactive in helping all interested users. If ever anything confuses you, or you just want to mention that you're thinking of using Cubix for a project, do not hesitate to write our mailing list.

Welcome, Cubix programmer.

Where to start?

We suggest the following order for learning Cubix:

  1. Watch the OOPSLA 2018 talk below.
  2. Complete the tutorial.
  3. Read the Cubix paper, and read the papers it's based on as needed.
  4. Get comfortable with strategy combinators: by reading the tutorial paper, playing with another language or library with strategy combinators, or by playing with Cubix itself.
  5. Enjoy your new power of building multi-language tools.

Additional Resources

Talks

We have given many talks presenting an overview of the ideas behind Cubix over the years.

Here is the shorter version of the presentation, as given at OOPSLA 2018. (slides)

And here is a longer version of the talk, presented to many groups; this recording is from the presentation at the Boston Haskell meetup. (slides)

Useful papers

The following papers can help to get the necessary background in generic programming to understand Cubix:

Transformations in Cubix use our compstrat library of strategy combinators. To understand strategy combinators, we recommend the following paper: