Table of Contents
Fetching ...

QRscript: Embedding a Programming Language in QR codes to support Decision and Management

Stefano Scanzio, Gianluca Cena, Adriano Valenzano

TL;DR

The paper tackles offline executable programs in QR codes to support decision and maintenance in IoT/IIoT without Internet access. It introduces QRscript, an interpreted language that compiles to QRbytecode and runs on a VM, with dialects such as the Decision Tree Dialect. An end-to-end pipeline is described: high-level code → QRbytecode via three-address code, encoding rules for strings and references, forward-only gotos, and QR-code packaging; runtime execution on mobile apps. This approach enables compact QR codes (version $40$ with low ECC can hold up to $2953$ bytes) suitable for offline industrial deployment, and is designed to be extensible with security features in future work.

Abstract

Embedding a programming language in a QR code is a new and extremely promising opportunity, as it makes devices and objects smarter without necessarily requiring an Internet connection. In this paper, all the steps needed to translate a program written in a high-level programming language to its binary representation encoded in a QR code, and the opposite process that, starting from the QR code, executes it by means of a virtual machine, have been carefully detailed. The proposed programming language was named QRscript, and can be easily extended so as to integrate new features. One of the main design goals was to produce a very compact target binary code. In particular, in this work we propose a specific sub-language (a dialect) that is aimed at encoding decision trees. Besides industrial scenarios, this is useful in many other application fields. The reported example, related to the configuration of an industrial networked device, highlights the potential of the proposed technology, and permits to better understand all the translation steps.

QRscript: Embedding a Programming Language in QR codes to support Decision and Management

TL;DR

The paper tackles offline executable programs in QR codes to support decision and maintenance in IoT/IIoT without Internet access. It introduces QRscript, an interpreted language that compiles to QRbytecode and runs on a VM, with dialects such as the Decision Tree Dialect. An end-to-end pipeline is described: high-level code → QRbytecode via three-address code, encoding rules for strings and references, forward-only gotos, and QR-code packaging; runtime execution on mobile apps. This approach enables compact QR codes (version with low ECC can hold up to bytes) suitable for offline industrial deployment, and is designed to be extensible with security features in future work.

Abstract

Embedding a programming language in a QR code is a new and extremely promising opportunity, as it makes devices and objects smarter without necessarily requiring an Internet connection. In this paper, all the steps needed to translate a program written in a high-level programming language to its binary representation encoded in a QR code, and the opposite process that, starting from the QR code, executes it by means of a virtual machine, have been carefully detailed. The proposed programming language was named QRscript, and can be easily extended so as to integrate new features. One of the main design goals was to produce a very compact target binary code. In particular, in this work we propose a specific sub-language (a dialect) that is aimed at encoding decision trees. Besides industrial scenarios, this is useful in many other application fields. The reported example, related to the configuration of an industrial networked device, highlights the potential of the proposed technology, and permits to better understand all the translation steps.
Paper Structure (11 sections, 8 figures)

This paper contains 11 sections, 8 figures.

Figures (8)

  • Figure 1: Examples of QR code version 1 and version 40.
  • Figure 2: Example of all the steps involved in the generation of the QR code (left side) and in the execution of the program from the QR code (right side).
  • Figure 3: Definition of the initial part of the QRbytecode specifying the dialect.
  • Figure 4: Example of a decision tree without chance nodes.
  • Figure 5: Example of decision tree and corresponding high-level language that can be encoded in a QR code using QRscript ("#" denotes comments).
  • ...and 3 more figures