Automatically Mining Input Grammars from Code: A Breakthrough in Symbolic Execution

Wednesday 09 April 2025


Computer programs are like puzzles, and understanding how they work is crucial for making them better. But what if we could decipher the secrets of these digital puzzles without having to provide a bunch of random inputs? That’s exactly what researchers have achieved in a recent breakthrough.


For decades, computer scientists have been trying to develop methods that can automatically generate input grammars for programs. Input grammars are like recipes that tell us how to create valid inputs for a program. Think of it like a language – just as we need rules to form sentences, programs need rules to accept or reject user inputs.


Traditionally, researchers relied on sample inputs and manual analysis to infer these grammars. But this approach has limitations. For instance, if the sample inputs are limited or biased, the inferred grammar might not accurately represent the program’s behavior.


The new method, called STALAGMITE, takes a different approach. Instead of relying on sample inputs, it analyzes the program itself to extract the rules that govern its behavior. This allows researchers to generate input grammars without needing any prior knowledge about the program’s behavior or even having access to it.


To achieve this, STALAGMITE uses a combination of static analysis and symbolic execution. Static analysis involves analyzing the program’s code without actually running it, while symbolic execution simulates the program’s execution by treating variables as symbols rather than actual values.


By combining these two techniques, STALAGMITE can generate input grammars that accurately capture the program’s behavior. The researchers tested their method on a range of programs, including parsers for different programming languages and a JSON parser. The results were impressive – the inferred grammars had near-perfect precision and recall, meaning they correctly accepted or rejected inputs almost all the time.


This breakthrough has significant implications for software testing and development. By automating the process of generating input grammars, researchers can quickly identify vulnerabilities in programs and develop more robust tests. This can help prevent security breaches and improve overall program reliability.


Moreover, STALAGMITE’s ability to analyze programs without needing sample inputs opens up new possibilities for reverse engineering and program understanding. Imagine being able to understand how a complex system works simply by analyzing its code – it could revolutionize the way we approach software development and maintenance.


The researchers’ work is an important step forward in computer science, demonstrating the potential of static analysis and symbolic execution to tackle long-standing challenges in programming languages and software engineering.


Cite this article: “Automatically Mining Input Grammars from Code: A Breakthrough in Symbolic Execution”, The Science Archive, 2025.


Computer Programs, Puzzles, Input Grammars, Recipes, Language, Rules, Samples, Analysis, Symbolic Execution, Software Testing.


Reference: Leon Bettscheider, Andreas Zeller, “Inferring Input Grammars from Code with Symbolic Parsing” (2025).


Leave a Reply