Qupla & Abra

This article is a translation of the German IOTA Beginner’s Guide by Schmucklos.

Qupla & Abra

The development of the original Abra programming language increased in scope over time to such an extent that this limited language was no longer sufficient for the newly emerging requirements for Qubic. This was not expected in advance, so the IF decided to rework the existing parser / interpreter / compiler into a higher-level programming language called Qupla (short for QUbic Programming LAnguage). According to the explanations of Eric Hop, the chief developer of Qubic, some concepts in Abra (ternary) cannot be easily mapped to an existing binary language, nor can many concepts of existing binary languages be easily or not at all mapped to Abra. However, this is necessary because current hardware still works in binary and you have to go both ways for a longer time.

Thus, Qupla was introduced as the parent programming language for Qubic in December 2018. Abra is now the tritcode specification and Qupla generates the Abra tritcode according to this specification in a dataflow architecture focused on the IoT. Qupla is the first higher-level programming language to implement the new Abra specification.

Abra is a ternary-based functional “low-level” intermediate programming language and is extremely minimal. Its runtime model is implemented by a common tritcode specification that allows Abra code to run anywhere.

Abra has been designed with state-of-the-art hardware in mind. Qubic, like the IoT itself, is intended to run on a variety of hardware. In order to run the same code on different hardware platforms, Qubics are packaged in this intermediate language, which essentially means that the language lends itself to easy translation for specific hardware. This makes Qubics largely independent of hardware.

A functional programming language allows for easier analysis to prove the correctness of the code. Writing correct programs is not a trivial task. We have seen in the past how difficult it is to make even simple smart contracts error-free. Having a language that lends itself to automated analysis is a dramatic improvement over a traditional imperative language. As an added benefit, functional programs lend themselves to heavy use of parallelization, meaning that different parts of a larger program can be run simultaneously to take advantage of multiple CPUs or even multiple devices.

Abra consists of functions, which in turn can consist of functions that converge asymptotically to functions that can return a ternary value or zero, indicating the termination of a logical branch. There is no control flow, but an implicit branching and merging of data, when executing these functions. A given endpoint is considered to be the surviving function branch that returned a value. Abra thus belongs to a programming paradigm called dataflow programming and is suitable for what is known as wave parallel processing. Data can flow through the various levels of the processor without the need for synchronization or buffering delays. It has been shown that this allows clock frequencies to be 2 to 7 times higher than conventional parallel processing.

A final note on optimizations: Abra comes with a library of predefined basic functions for the most common platforms. Although most functions are defined at a very low level, the nature of Abra allows functions to be overridden with hardware-specific implementations that are more efficient when needed.

Original source


Last Updated on 16. February 2021