Cthulhu  0.2.10
Cthulhu compiler collection
Cthulhu

Wow this project got out of hand.

A brief overview

Cthulhu was born out of frustration with existing compilers and tooling. Cthulhu is a set of tools for building compilers, designed to be low friction to start with and easily extensible.

Started in 2019, Cthulhu now contains 2 complete language frontends:

  • PL0.
    • A simple language used for demonstrating compiler features.
    • Also used as a testbed for new features.
  • Cthulhu.
    • The namesake language, a C like language with a few extra features.

And 1 language frontend in progress:

  • Oberon-2
    • Currently has partial support, but is missing the standard library and object oriented features.

Long term language support is planned for both jvm bytecode and the ifc c++ modules that msvc produces.

Compelling features

Currently cthulhu is the only compiler (to my knowledge) that supports language interop between languages without boilerplate. This is achieved by using common interfaces between language drivers.

  • All drivers follow the same compilation phases, allowing for symbol visibility.
  • All languages use the same intermediate form, called tree. allowing for interop between languages.
    • This even includes languages that follow different type systems.
    • This even allows for interop between language runtimes, for example a program written in Cthulhu may call out to a function available in the JVM runtime.

As alot of code can be shared, adding a feature for one language may often require no work for other languages to implement.

Getting started

Building Cthulhu Building the compiler

Usage Consuming the framework as a library.

Contributing Contributing to Cthulhu

TODO The ever growing todo list

License

All source code under the src/common directory is licensed under LGPLv3. All other code, unless explicitly stated, is licensed under GPLv3.

All source code is available on Github