Skip to content

Compilers and languages

avaloni

Maintained by avalon-lang

Quantum computing is progressing slowly but surely.

C++MIT
avaloni illustration

Resource snapshot

Category

Compilers and languages

Stars

23

Last pushed

Dec 16, 2018Updated 7y ago

Open issues

0

Quickstart

Get running in a few lines.

Quickstart
import io
import quant

def __main__ = (val args : [string]) -> void:
    -- initialize quantum variables
    val source = 0q1,
        destination = 0q0,
        ancilla = 0q0

    -- create an entanglement between the destination and the ancilla
    Quant.had(ref destination)
    Quant.cx(ref destination, ref ancilla)

    -- perform the teleportation
    Quant.cx(ref source, ref ancilla)
    Quant.had(ref source)

    -- measure the source and the ancilla
    var source_bit = cast(ref source) -> bit,
        ancilla_bit = cast(ref ancilla) -> bit

    -- perform phase correction on the destination
    if source_bit == 0b1:
        Quant.pz(ref destination)
    if ancilla_bit == 0b1:
        Quant.px(ref destination)

    -- measure and print the destination which should contain <0q1>
    var destination_bit = cast(ref destination) -> bit
    Io.println(string(destination_bit))

    return

What it is

avaloni is maintained by avalon-lang and sits in the Compilers and languages lane of the open-source quantum map.

Quantum computing is progressing slowly but surely.

Last verified by Qtangl generator on May 27, 2026

Who it's for

Developers who want to understand the representations and compilers that sit between high-level code and runnable circuits.

What you can build or learn

  • Compare IRs, DSLs, transpilers, and compiler assumptions across ecosystems.
  • Understand how high-level code becomes something a backend can execute.
  • Spot tools that matter when interoperability and compilation quality are important.

License

MIT

SPDX identifier detected from the repository metadata or license files.

Repository README

Preview from the project README.

Rendered as Markdown inside a scrollable preview. Long READMEs stay contained; expand or open on GitHub for the full document.

~619 words · about 3 min readOpen on GitHub

Avalon - A classical-quantum programming language

Quantum computing is progressing slowly but surely. And as it progresses, tools are going to be needed to program quantum computers.

Avalon is a programming language aimed at a specific class of quantum computers called classical-quantum hybrid quantum computers. A hybrid classical-quantum computer has the property of having a classical computer driving (telling) the quantum computer what to do. These computers are being built by IBM and Rigetti and Avalon seeks to target both, starting with Rigetti.

Currently, all you will get is an interpreter to start prototyping on your own system while I'm working on generating QUIL (Rigetti) code. The documentation can be found at Read The Docs and please do look in the tests/integration folder for sample code to run.

Why Avalon

Quantum computing is progressing and it needs tools among which programming languages are going to play a vital role. Yes, there exists other programming languages that target hybrid classical-quantum computers but I have found them to be lacking in abstractions and many even exposing hardware primitives making them unfriendly to the novice developer.

Even more important, as we approach the NISQ era, compilers are going to play a vital role in the optimisation of quantum programs when we have little to no error correction built into the hardware. It is the hope that Avalon will come out as the leading programming language for writing programs meant for near-term quantum computers.

What it looks like

Avalon sample program in my editor

State of the project

Currently, the classical part is close to 90% finished (excluding known bugs). The missing feature is pointer types. Getters and setters are being reworked into a better form. Otherwise the rest works as intended.

The quantum part, 1-Qubit data types and gates that act on them are implemented and can be tested. The 2-Qubits, 4-Qubits and 8-Qubits data types are implemented but gates that operate on them are still missing but upcoming.

Show me the code

Please find below the teleportation code found in tests/integration/quantum/teleportation.avl reproduced for your copy-paste-run pleasure.

import io
import quant

def __main__ = (val args : [string]) -> void:
    -- initialize quantum variables
    val source = 0q1,
        destination = 0q0,
        ancilla = 0q0

    -- create an entanglement between the destination and the ancilla
    Quant.had(ref destination)
    Quant.cx(ref destination, ref ancilla)

    -- perform the teleportation
    Quant.cx(ref source, ref ancilla)
    Quant.had(ref source)

    -- measure the source and the ancilla
    var source_bit = cast(ref source) -> bit,
        ancilla_bit = cast(ref ancilla) -> bit

    -- perform phase correction on the destination
    if source_bit == 0b1:
        Quant.pz(ref destination)
    if ancilla_bit == 0b1:
        Quant.px(ref destination)

    -- measure and print the destination which should contain <0q1>
    var destination_bit = cast(ref destination) -> bit
    Io.println(string(destination_bit))

    return

Installation

Currently, installation can only happen from source and the code has only been tested on a Linux system.
Installation directions can be found at installing Avalon.

Documentation

Documentation is currently being written as the language evolves.
You can find the documentation at Read The Docs.

Contributing

Thank you for considering it. Please see the contribution guidelines for help on contributing.

Contact

You can reach me at nbashige@gmail.com

License

This code is licensed under the MIT license. Please see the LICENSE file for the terms.

Acknowledgement

Development of Avalon is being supported by the Unitary Fund grant. My thanks to Will J. Zeng for running the program.

Copyright

Copyright (c) 2018 Ntwali Bashige Toussaint

In case you found code that is yours and I failed to give attribution or I am claiming copyright of the code, please do email me to resolve the issue.

Read on GitHub

Activity

Latest release

—

Watchers

4

Python support

—

Learn digest

Get monthly updates when library entries change.

Monthly digest: new library entries, updated flagships, and one editorial pick.

Related resources

Keep exploring nearby tools.

NVIDIA

cuda-quantum

C++ and Python support for the CUDA Quantum programming model for heterogeneous quantum-classical workflows

C++Apache-2.0Flagship

1,048 stars · Updated 3mo ago

QISKit

openqasm

Quantum assembly language for extended quantum circuits

PythonApache-2.0

1,468 stars · Updated 3mo ago

Quantomatic

pyzx

Python library for quantum circuit rewriting and optimisation using the ZX-calculus

OpenQASMApache-2.0Flagship

524 stars · Updated 3mo ago

QISKit

qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

PythonApache-2.0FlagshipQtangl relevant

7,412 stars · Updated 3mo ago

Microsoft

QuantumKatas

Tutorials and programming exercises for learning Q# and quantum computing

Jupyter NotebookMITFlagshipArchive

4,862 stars · Updated 2y ago

CQCL

tket

Source code for the TKET quantum compiler, Python bindings and utilities

C++Apache-2.0FlagshipQtangl relevant

308 stars · Updated 3mo ago