{'fraction_non_alphanumeric': 0.03292344307814359, 'fraction_numerical': 0.007140023800079333, 'mean_word_length': 5.091787439613527, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Dual Semantics for the Data Description Calculus ( Extended Abstract )

Data description languages are a class of domain specific languages for specifying ad hoc data formats, from billing records to TCP packets to scientific data sets to server logs. Examples of such languages include BRO [13], DATASCRIPT [1], DEMETER [8], PACKETTYPES [12], PADS/C [3], PADS/ML [11] and XSUGAR [2], among others. All of these languages generate parsers from data descriptions. In addition, and unlike conventional parsing tools such as Lex and Yacc, many also automatically generate auxiliary tools ranging from printers to XML converters to visitor libraries to visualization and editor tools. In previous work, we developed the Data Description Calculus (DDC), a calculus of simple, orthogonal type constructors, designed to capture the core features of many existing type-based data description languages [4, 5]. This calculus had a multi-part denotational semantics that interpreted the type constructors as (1) parsers the transform external bit strings into internal data representations and parse descriptors (representations of parser errors), (2) types for the data representations and parse descriptors, and (3) types for the parsers as a whole. We proved that this multi-part semantics was coherent in the sense that the generated parsers always have the expected types and generate representations that satisfy an important canonical forms lemma. The DDC has been very useful already, helping us debug and improve several aspects of PADS/C [3], and serving as a guide for the design of PADS/ML [11]. However, this initial work on the DDC told only a fraction of the semantic story concerning data description languages. As mentioned above, many of these languages not only provide parsers, but also other tools. Amongst the most common auxiliary tools are printers, as reliable communication between programs, either through the file system or over the Web, depends upon both input (parsing) and output (printing). In this work, we begin to address the limitations of DDC by specifying a printing semantics for the various features of the calculus. We also prove a collection of theorems for the new semantics that serve as duals to our theorems concerning parsing. This new printing semantics has many of the same practical benefits as our older parsing semantics: We can use it as a check against the correctness of our printer implementations and as a guide for the implementation of future data description languages.