Latra: A Template-Based Language-Agnostic Transformation Framework for Program Reduction

Loading...
Thumbnail Image

Date

2025-04-29

Advisor

Sun, Chengnian

Journal Title

Journal ISSN

Volume Title

Publisher

University of Waterloo

Abstract

Essential for debugging compilers and interpreters, existing reduction tools face a fundamental trade-off. Language-specific reducers, such as C-Reduce and ddSMT, offer highly effective reductions but require substantial engineering effort for each target language. Conversely, language-agnostic reducers, like Vulcan, sacrifice effectiveness for broad applicability. To bridge this gap, we present Latra, a novel template-based framework that balances both aspects, enabling general, effective, targeted program reduction. Latra combines language-agnostic reduction with user-defined, language-specific transformations. It facilitates user-defined transforms through a user-friendly domain-specific language based on simple matching and rewriting templates. This minimizes the need for deep formal grammar knowledge. Latra empowers users to tailor reductions to specific languages with reduced implementation overhead. Evaluation shows that Latra significantly outperforms Vulcan. It reduces 33.77% more tokens in C and 9.17% more tokens in SMT-LIB, with 32.27% faster execution in SMT-LIB. Notably, Latra closely matches the effectiveness of language-specific reducers C-Reduce and ddSMT (89 vs. 85, 103 vs. 109 tokens), while significantly reducing engineering effort (167 vs. 5,508, 62 vs. 118 lines of code). We strongly believe that Latra provides a practical and cost-efficient approach to program reduction, effectively balancing language-specific effectiveness with language-agnostic generality.

Description

Keywords

LC Subject Headings

Citation