{'fraction_non_alphanumeric': 0.02193645990922844, 'fraction_numerical': 0.0, 'mean_word_length': 5.582089552238806, '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}}
Example-based Program Querying

Program query languages are an essential component of program analysis and manipulation systems. In each such system, a query identifies the source-code parts of interest by reasoning over a program representation that is dedicated to the intent of the system (e.g. call-graphs to detect behavioral flaws, abstract syntax trees for refactorings, concrete source code to verify programming conventions, etc.). In order to detect a wide variety of such “patterns of interest”, or more importantly, to detect patterns that require a combination of such program representations, developers must understand all the different applicable representations and techniques. We therefore present a logicbased language that allows the program’s implementation to be queried using concrete source code templates that are matched against a combination of structural and behavioral program representations. These representations include call-graphs, points-to analysis results and abstract syntax trees that are uniformly composed through a customizable unification procedure. The result of our approach is that developers can detect patterns in the queried program using source code excerpts (embedded in logic queries) which act as prototypical samples of the structure and behavior they intend to match.