grammar engineering

Designing and formalizing syntactic and semantic grammars and mutation operators to represent discrete candidate spaces, search operations, and realistic corpora, enabling systematic generation and exploration of structured design or program spaces.

grammarengineering

12-Month Skill Trend

Momentum and market value over time
Trending
Score
+20 in 12 mo
96
12 mo agoNow
Career
Value
+$12K in 12 mo
$42K/year
12 mo agoNow

Recommended Survey Paper

Quick overview of the field
View more

Must-Read Papers

Most classic and influential ideas
View more

Learning Semantics-aware Search Operators for Genetic Programming

Feb 06, 2025
PW
Piotr Wyrwiński
🏛️ Poznan University of Technology

To address the rugged fitness landscape and the lack of semantic guidance in traditional syntactic operators for test-driven program synthesis, this paper proposes a semantics-aware genetic programming framework. Methodologically, it (1) employs graph neural networks to model instruction-data interactions within program abstract syntax graphs, generating node saliency maps that quantify semantic importance; (2) introduces the notion of “latent value” to prioritize low-fitness yet evolutionarily promising individuals during search; and (3) designs semantics-sensitive mutation and crossover operators. Evaluated on multiple symbolic regression benchmarks, the approach achieves up to 42% faster convergence compared to classic tree-based genetic programming, while significantly improving solution quality stability. Ablation studies confirm the distinct and measurable contributions of each component.

Enhance program synthesis with graph neural networksImprove genetic programming search efficiencyIntroduce semantics-aware search operators

Inferring Attributed Grammars from Parser Implementations

Jul 17, 2025
AP
Andreas Pointner
🏛️ University of Applied Sciences, Upper Austria | Johannes Kepler University Linz

Existing structured-input processing systems often lack complete and up-to-date syntactic and semantic specifications; while syntax mining has focused primarily on parsing structure, semantic recovery remains unaddressed. Method: We propose the first approach to automatically infer attribute grammars from recursive-descent parser implementations. Our method combines dynamic execution tracing and program instrumentation to capture runtime behavior, augmented by control-flow analysis and grammar-driven semantic mapping, thereby precisely associating parsing operations with productions and extracting semantic actions. Contribution/Results: This work pioneers syntax mining at the semantic level, enabling fully automated generation of executable attribute grammars that faithfully model input-processing logic. Evaluation across multiple real-world programs demonstrates that the inferred grammars accurately reproduce original parser behavior—enabling novel applications in reverse engineering, specification documentation, and security analysis.

Inferring attributed grammars from parser implementationsMapping runtime behavior to grammar for specification recoveryRecovering semantic aspects of input handling from parsers

This work addresses the performance bottleneck in search-based program synthesis caused by the high computational cost of fine-grained abstract semantics, which, while effective at pruning incorrect programs, hinders overall efficiency. To overcome this limitation, the authors propose an offline pre-synthesis approach that first constructs a tree automaton over the input space to precisely capture the abstract semantics of the domain-specific language (DSL). This automaton enables the generation of an efficient pruning oracle that decouples abstract semantic reasoning from the online synthesis process. By doing so, the method achieves, for the first time, highly efficient synthesis under fine-grained abstract semantics. Empirical evaluations demonstrate substantial performance improvements over state-of-the-art techniques across three diverse domains: SQL query synthesis, string transformation, and matrix manipulation.

abstract semanticsprogram synthesisscalability

Automating the Analysis of Parsing Algorithms (and other Dynamic Programs)

Dec 29, 2025
TV
Tim Vieira
🏛️ Johns Hopkins University | ETH Zürich

This paper addresses the challenge of establishing performance guarantees for dynamic programming (DP) parsing algorithms in natural language processing. We present the first automated analysis system that unifies program analysis and complexity inference within a DP framework. Our approach integrates static analysis, type inference, abstract interpretation, and dependency graph modeling to enable formal verification and synthesis of efficient data structures. Key contributions include: (1) a unified formal model capturing DP control flow, data flow, and recurrence structure; (2) automatic inference of precise types, detection of dead code, and identification of redundant computations; and (3) generation of tight, parameterized upper bounds on time and space complexity. We evaluate our system on canonical parsing algorithms—including CKY, Earley, and Neural PCFG—demonstrating substantial improvements in both the automation level and precision of complexity analysis.

Automating analysis of parsing algorithms and dynamic programsInferring types, dead code, and verifying algorithm propertiesProviding guarantees on runtime and space complexity bounds

SpecGen: Automated Generation of Formal Program Specifications via Large Language Models

Jan 16, 2024
LM
Lezhi Ma
🏛️ Nanjing University | Nanyang Technological University | Singapore Management University

Formal program specifications are notoriously difficult, error-prone, and inefficient to write manually. To address this, we propose a two-stage LLM-driven approach: dialogue-guided specification synthesis followed by mutation-based verification. First, multi-turn dialogues model complex semantic requirements; second, four mutation operators—insertion, replacement, deletion, and reordering—enable verifiability-driven selection, eliminating reliance on rigid templates or syntactic grammars. Our method integrates code understanding, prompt engineering, and heuristic verifiability assessment. Evaluated on SV-COMP and a custom Java benchmark comprising 385 programs, it generates 279 verifiable specifications. These achieve significantly higher completeness and accuracy than pure-LLM baselines and classical tools (e.g., Houdini, Daikon). To our knowledge, this is the first approach to achieve both high coverage and formal verifiability in fully automated specification generation.

Automated generation of formal program specificationsLeveraging LLMs for code comprehensionOvercoming limitations of predefined templates

Latest Papers

What's happening recently
View more

This work addresses key limitations in existing large language model (LLM)-based evolutionary search, which struggles to distinguish semantically equivalent yet syntactically diverse programs and fails to effectively preserve strategic potential or detect saturation within strategy families. To overcome these challenges, the authors propose introducing a strategy-space layer into program evolution, elevating natural language strategy descriptions to first-class evolutionary states. By integrating strategy representation, hierarchical experience retrieval, and strategy-landscape navigation, the method enables explicit organization, memory, and exploration at the strategy level. Combining LLMs with evolutionary algorithms, strategy clustering, behavior-complementarity-based retrieval, and summarization mechanisms, the approach significantly outperforms baseline methods across tasks in mathematical algorithm discovery, system optimization, and agent framework design, achieving a relative improvement of 21% in open-ended system optimization.

algorithm discoveryevolutionary searchLLM-guided optimization

This work addresses the problem of syntactic ambiguity in context-free grammars, where ambiguities can lead to unintended scoping, operator precedence, and associativity that deviate from language design intent. To resolve this, the authors propose an example-based disambiguation method that synthesizes user-preferred disambiguation rules from programming examples and the original grammar using a novel tree automaton learning algorithm. They further introduce an efficient tree automaton intersection algorithm that significantly compresses the resulting specification, ensuring both readability and compatibility with mainstream parser generators. The implemented tool, Greta, successfully eliminates ambiguities across multiple case studies, producing unambiguous, canonical grammars suitable for standard parser generators, while the approach is theoretically guaranteed to be correct.

associativitycontext-free grammarsgrammar ambiguity

This work addresses the limitations of existing large language model (LLM)-driven heuristic design methods in combinatorial optimization, which often rely on manual trial-and-error or domain-specific knowledge and lack a systematic mechanism for improvement. To overcome this, the authors propose a structured framework that formalizes heuristic discovery as a language-guided program optimization process, comprising three modular phases: forward evaluation, backward feedback, and program update. This design enables an iterative and composable optimization workflow, unifying and generalizing prior approaches while allowing flexible enhancements through modularity. Empirical evaluation across four real-world combinatorial optimization tasks demonstrates that the proposed method significantly outperforms baseline techniques, achieving up to a 0.17 improvement in the QYI metric on unseen test instances.

Automated Heuristic DesignCombinatorial OptimizationHeuristic Search

This work addresses key limitations in existing large language model (LLM)-based automated program repair methods, particularly their shortcomings in repair diversity, semantic relationship modeling, partial repair composition, and utilization of failure feedback. To overcome these challenges, the paper proposes EvolRepair, a novel framework that introduces a semantic evolution mechanism into LLM-driven program repair for the first time. EvolRepair leverages behaviorally consistent repair populations, semantic-aware genetic operators, and structured execution feedback to enable family-based repair inference, cross-individual complementary synthesis, and dynamic search redirection guided by failure patterns. Experimental results demonstrate that EvolRepair significantly outperforms current LLM-based repair approaches in both repair success rate and solution quality.

automated program repairrepair diversityrepair families

This work addresses the challenge of consistently generating effective and adaptive executable trading strategies in noisy, non-stationary, and highly discontinuous algorithmic trading environments. The authors propose a two-level evolutionary framework: at the inner level, a large language model (LLM) serves as a semantic mutation operator to iteratively generate and refine Python-based trading strategies; at the outer level, a meta-evolutionary mechanism automatically optimizes prompting instructions, autonomously discovering program synthesis heuristics that outperform human-designed ones. This approach represents the first integration of LLMs into the strategy evolution process for algorithmic trading, combining evolutionary algorithms with meta-learning. Rigorous backtesting demonstrates that the system adaptively responds to market regimes, dynamically switches trading logic, significantly reduces zero-trade failures, and consistently outperforms baseline strategies guided by manually crafted prompts.

algorithmic tradingcontinual learningnon-stationary environment

Hot Scholars

TW

Taro Watanabe

Nara Institute of Science and Technology
Machine TranslationMachine Learning
YS

Yusuke Sakai

Nara Institute of Science and Technology
natural language processing
TG

Takumi Goto

NARA Institute of Science and Technology
EL

Eric Laporte

Université Gustave Eiffel
Linguistic description for language processingInformation retrieval