ImperatorLang

A project to bring imperative programming languages to Cardano L1.

What is it?

This is a language (compiler) that transforms a lightweight imperative language into pluto, a language that more or less directly compiles into Untyped Plutus Core (UPLC).

I have given a presentation on this project at the Catalyst Swarm Idea Fest. Check it out here.

I have also hosted an AMA on reddit: linked here

Why is it interesting?

Unlike most programming language, Plutus does not compile down to assembly or any assembly like language. Plutus/Untyped Plutus Core is a functional programming language, which still causes headache to many programmers citation needed. However, in order for the development of Smart Contracts and dApps on the Cardano blockchain to thrive, the development of applications should be as accessible as possible. Imperator is a solution to this, translating an imperative language into the functional language UPLC. This direction is rather unusual but well known to be possible among theoretical computer scientists.

This translation brings many useful features in being:

  • a more familiar, intuitive way of writing SCs than Plutus
  • a more secure platform for SCs than Solidity (by i.e. eliminating side effects)
  • extensible by efficiently written libraries

Is Cardano L1 now EVM compatible??

No. Cardano L1 still works based on Smart Contracts acting as validators rather than actors. Moreover, the state of the contract is not stored in the blockchain. However, this project may help at convincing more people to develop on Cardano and enrich the ecosystem.

How does it work?

First you write a small program in imperator.


This compiles into the following (rather unwieldy) pluto code, using the compiler provided in this repository.


And produces the following output


You can check that this is the expected output by comparing it to the directly evaluated program.


How can I support this?

Contributions are a very welcome way of support, be it ideas or code.

Compare similar projects toImperatorLang