Saggitarius: A DSL for Specifying Grammatical Domains

08/23/2023
by   Anders Miltner, et al.
0

Common data types like dates, addresses, phone numbers and tables can have multiple textual representations, and many heavily-used languages, such as SQL, come in several dialects. These variations can cause data to be misinterpreted, leading to silent data corruption, failure of data processing systems, or even security vulnerabilities. Saggitarius is a new language and system designed to help programmers reason about the format of data, by describing grammatical domains – that is, sets of context-free grammars that describe the many possible representations of a datatype. We describe the design of Saggitarius via example and provide a relational semantics. We show how Saggitarius may be used to analyze a data set: given example data, it uses an algorithm based on semi-ring parsing and MaxSAT to infer which grammar in a given domain best matches that data. We evaluate the effectiveness of the algorithm on a benchmark suite of 110 example problems, and we demonstrate that our system typically returns a satisfying grammar within a few seconds with only a small number of examples. We also delve deeper into a more extensive case study on using Saggitarius for CSV dialect detection. Despite being general-purpose, we find that Saggitarius offers comparable results to hand-tuned, specialized tools; in the case of CSV, it infers grammars for 84 seconds, and has comparable accuracy to custom-built dialect detection tools.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/17/2021

RL-GRIT: Reinforcement Learning for Grammar Inference

When working to understand usage of a data format, examples of the data ...
research
10/10/2022

Data types as a more ergonomic frontend for Grammar-Guided Genetic Programming

Genetic Programming (GP) is an heuristic method that can be applied to m...
research
04/26/2021

Evaluating Query Languages and Systems for High-Energy Physics Data

In the domain of high-energy physics (HEP), query languages in general a...
research
04/30/2023

How to enumerate trees from a context-free grammar

I present a simple algorithm for enumerating the trees generated by a Co...
research
04/26/2022

Faster and Better Grammar-based Text-to-SQL Parsing via Clause-level Parallel Decoding and Alignment Loss

Grammar-based parsers have achieved high performance in the cross-domain...
research
10/10/2018

Leveraging Textual Specifications for Grammar-based Fuzzing of Network Protocols

Grammar-based fuzzing is a technique used to find software vulnerabiliti...
research
06/02/1999

Learning Efficient Disambiguation

This dissertation analyses the computational properties of current perfo...

Please sign up or login with your details

Forgot password? Click here to reset