Core Concepts
This work provides a formal syntax and denotational semantics for a large subset of the jq language, a widely used tool for manipulating JSON data. The most significant contribution is a new interpretation of updates that allows for more predictable and performant execution.
Abstract
The content provides a formal specification of the jq language, which is a widely used tool for manipulating JSON data. The key points are:
Introduction to jq:
jq provides a programming language to define filters and an interpreter to execute them.
jq filters operate on streams of JSON values, allowing compact manipulation of JSON data.
The semantics of the jq language are only informally specified, leading to inconsistencies between the documentation and the implementation.
Syntax:
The content defines a high-level intermediate representation (HIR) and a mid-level intermediate representation (MIR) for a subset of the jq language.
It shows how to lower HIR filters to semantically equivalent MIR filters, simplifying the semantics definition.
Values and Operations:
The content defines JSON values, errors, exceptions, and streams, as well as functions and operations on these values.
It defines arithmetic operations, object construction and merging, and other basic value manipulations.
Semantics:
The content defines the semantics for evaluating jq filters on input values, focusing on a new interpretation of updates that is simpler and more performant than the existing jq implementation.
Equational Reasoning:
The content shows how to prove properties of jq programs using equational reasoning.
The formal specification aims to provide a clear and consistent definition of the jq language semantics, addressing the issues with the existing informal specification.