[Paper Review] QRtree -- Decision Tree dialect specification of QRscript
QRtree is a specialized dialect of QRscript designed to encode decision trees—without chance nodes—into executable QR codes (eQR codes) using a compact binary format called eQRtreebytecode. It leverages a three-address code intermediate representation and defines a binary encoding scheme for instructions like if, goto, print, and references, enabling efficient, human-readable decision logic execution on mobile or embedded devices via QR code scanning.
This specification document specifies the syntax and semantics of QRtree, which is a specific dialect of QRscript particularly suited to represent decision trees without chance nodes. The term dialect identifies one of the possible sub-languages that can be encoded inside of an eQR code via QRscript. This specification will describe an intermediate representation of QRtree, made through a language derived by the three-address code. It will then define the transformation rules from the intermediate representation to a binary code. The latter is a binary representation called eQRtreebytecode. These rules can also be applied inversely to transform the eQRtreeBytecode into the intermediate representation. This specification document will pay particular attention to the creation of a compact eQRtreebytecode, as the maximum number of bits that can be stored in a QR code is, at the time of writing, equal to 2953 bytes (in the case of QR code version 40 with a "low" error correction level).
Motivation & Objective
- To define a standardized, compact dialect of QRscript for representing decision trees without chance nodes.
- To enable the encoding of decision tree logic into executable QR codes (eQR codes) for deployment on mobile and embedded devices.
- To establish a binary bytecode format (eQRtreebytecode) that supports efficient storage and execution of decision tree logic within QR code constraints.
- To support human-readable decision logic via references to external content, reducing QR code payload size.
Proposed method
- Defines a three-address code intermediate representation for decision tree logic, enabling standardized translation.
- Introduces a binary encoding scheme (eQRtreebytecode) for translating the intermediate representation into a compact, QR-code-compatible format.
- Specifies a QRtree header with type identifiers (e.g., INT_TYPE, FLOAT_TYPE, DICT_TYPES) to manage data types and structure.
- Supports direct and indirect input handling, including references to external data to minimize payload size.
- Uses exponential encoding for integers and specific bit patterns for instructions (e.g., if, goto, print) to optimize space usage.
- Defines transformation rules from eQRtreebytecode back to intermediate representation for execution on a virtual machine.
Experimental results
Research questions
- RQ1How can decision tree logic be efficiently encoded within the storage limits of a QR code using a standardized format?
- RQ2What binary encoding strategy minimizes payload size while preserving readability and execution efficiency for decision trees in eQR codes?
- RQ3How can references to external content (e.g., images, URLs) be integrated into the QR code without bloating the payload?
- RQ4What mechanisms ensure backward compatibility and correct interpretation of the encoded decision tree logic across different devices?
- RQ5How can the three-address code intermediate representation be mapped to a compact, machine-readable bytecode for QR code execution?
Key findings
- The QRtree dialect enables the representation of decision trees without chance nodes using a standardized, compact binary format (eQRtreebytecode) suitable for QR code storage.
- The specification supports efficient encoding of control flow (e.g., if, goto) and data types (INT16, INT32, FP16, FP32, UTF-8 strings) within the 2953-byte limit of QR code version 40.
- The use of references allows external data (e.g., images, videos) to be linked without including them in the QR code, significantly reducing payload size.
- The specification defines a reversible transformation from eQRtreebytecode back to the intermediate three-address code representation for execution on a virtual machine.
- The use of exponential encoding for integers reduces the number of bits required for large integer values, improving space efficiency.
- A sample implementation is available under the GPL-3.0 license, validating the feasibility and correctness of the specification.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.