{'fraction_non_alphanumeric': 0.029442691903259727, 'fraction_numerical': 0.0, 'mean_word_length': 5.56551724137931, '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}}
Structure-directed Genericity in Functional Programming and Attribute Grammars

Generic control operators, such as \emph{fold}, have been introduced in functional programming to increase the power and applicability of data-structure-based transformations. This is achieved by making the structure of the data more explicit in program specifications. We argue that this very important property is one of the original concepts of attribute grammars. In this paper, we present the similarities between the \emph{fold} formalism and attribute grammars. In particular, we show the equivalence of their respective deforestation methods. Given these results and the fundamental role of deforestation in the concept of \emph{structure-directed genericity}, first devised for attribute grammars with descriptional composition, we show how the \emph{fold} operator with its fusion method allow us to transport this concept in the area of functional programming.