Yallo, a new Tezos language

As someone noticed from the previous post, last weeks I started to write a new programming language for Tezos smart contracts. This project was initially intended as a personal exercise for studying parsers, ast and other compiler’s things, but the code just go out of hand very quickly. The joke compiler is now becoming a “real language” that I’ll continue as an hobby project github.com/dakk/yallo-lang.

Yallo (which stands for yet another language lo?) is essentially a functional language which integrates (a sort of) object oriented paradigm. Instead of classes, interfaces and objects, in yallo we have contracts, contract interfaces and contract instances. Here it is an exemple to show how it works.

Let’s suppose we want to create a contract that defines a new token; we first define its interface (which is not mandatory for the Token contract, but useful for other contract calling a Token contract instance):

interface IToken {
    entry transfer(from: address, to: address, val: nat);
    view getBalance(ad: address): nat;

As you can see, our interface has two entrypoints: transfer allows to send tokens from an address to another, and getBalance is used by another contract to retrieve the token balance of the given address. Note that we defined getBalance as a “view”, which is a syntactic sugar for entrypoints which callback to an ‘a contract passed as argument.

Interfaces can also be extended, so we can create an interface IMintableToken which also has a mint entrypoint.

And now let’s see an implementation for this interface, the contract (something like a class); first we declare our storage, which is composed of typed fields. Then we declare a parametrized constructor which is useful for contract deploy (we will investigate this later). And finally we declare our two entrypoints.

contract Token implements IToken {
    field balances: (address, nat) big_map;
    field totalSupply: nat;
    field symbol: string;

    constructor (owner: address, supply: nat, symbol: string) {
        this.balances = [ { owner: supply } ];
        this.totalSupply = supply;
        this.symbol = symbol;

    entry transfer(from: address, to: address, val: nat) {
        let a: nat = this.balances.get(from, 0n);
        let b: nat = this.balances.get(to, 0n);
        assert (a >= val);
        this.balances.update(from, a - val);
        this.balances.update(to, b + val); 

    view getBalance(ad: address): nat {
        this.balances.get(ad, 0n)

After compiling and deploying our amazing Token contract, other yallo contracts can easily interact with it. Inside our new contract entrypoint, we call the Token getBalance using the IToken.of(address) which returns a typed contract instance of IToken; then we call getBalance passing an address and our callback.

import "IToken.yallo";

const tokenContractAddress: address = @KT1ThEdxfUcWUwqsdergy3QnbCWGHSUHeHJq;

contract usingAToken {
    field bal: nat;

    entry checkBalance(a: address) {
        [IToken.of(tokenContractAddress).getBalance(a, this.checkBalanceCallback)]

    entry checkBalanceCallback(b: nat) {
        this.bal = b;

Another powerful feature that I introduced is the ability to deploy a contract from another contract, as follows. We call the createContract passing the result of Token(…), which creates a pair composed with the code of Token, and the initial storage generated by its constructor.

import "Token.yallo";

contract deployAToken {
    field tokenAddress: address;

    entry deployToken() {
        let (a: address, op: operation) = Tezos.createContract (Token(Tezos.selfAddress(), 100, "ourToken"), None, 0);
        this.tokenAddress = a;

At the moment, the compiler will feature cameligo as the only target language, but I’ll work also on a Coq compilation backend. The code and the language itself is in active development and it is not yet ready to use, but any ideas and comments are welcome.

If you liked yallo, please put a star on github.com/dakk/yallo-lang


DQPU, the decentralized quantum simulator

2 minute read

During my Quantum Computing journey, I often needed to simulate some quantum circuits; sometimes they are small, but some other times they are bigger enough ...

The Time I Built a Probabilistic Computer

6 minute read

In early 2023, I embarked on a journey to explore the field of probabilistic computing. This endeavor culminated in the construction of a hardware prototype,...

Back to Top ↑


Expanding the Commodore 64 Quantum Emulator

1 minute read

In a recent article I wrote, “Quantum Computing on a Commodore 64 in 200 Lines of BASIC”, published both on Medium and Hackaday.com, shows a two-qubit quantu...

Back to Top ↑


OCaml and Quantum Computing

1 minute read

Qiskit is a python SDK developed by IBM and allows everyone to create quantum circuits, simulate them locally and also run the quantum circuit on a real quan...

Yallo, a new Tezos language

2 minute read

As someone noticed from the previous post, last weeks I started to write a new programming language for Tezos smart contracts. This project was initially int...

King of Tezos: a smart-ponzi on Tezos

2 minute read

While writing a new programming language, it is often useful to write some real use-cases to test the syntax, the language expressiveness and the code cleann...

Favorite dev quote

less than 1 minute read

Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing

New blog

less than 1 minute read

This is my new blog, based on jekyll. I’ll soon import old posts from my old blog.

Back to Top ↑


Contractvm: decentralized applications on Bitcoin

less than 1 minute read

Contractvm is a general-purpose decentralized framework based on blockchain. The framework allows to implement arbitrary decentralized applications in an eas...

Back to Top ↑


Dices provably fair - Nonce overflow vulnerability

less than 1 minute read

Most of bitcoin dice software use a system to prove the fair play of the server for each bet. Most of them implement this mechanism using two seed (server se...

Back to Top ↑


Apache2: redirect different domains to subfolder

less than 1 minute read

In the aim to merge two of my server on digitalocean, today I tried to write a mod_rewrite rule to redirect a secondary domain to a subfolder. After one hour...

Back to Top ↑


MineML: F# miner

less than 1 minute read

MineML is a multithread CPU based bitcoin miner written in F#. At the moment it’s a slow implementation, but the class structure offers the possibility to im...

Back to Top ↑