Exploring Commonalities Across Programming Languages Using Intermediate Representation-Based Semantic Graphs

Cross-language code-to-code search has significant potential to enhance software development and maintenance by helping developers implement specific functionalities or migrate code between programming languages. Existing approaches, however, have notable limitations: static approaches relying on textual or syntactic information often lack effectiveness due to significant cross-language differences, while dynamic approaches relying on input-output behavior have limited applicability as they require executable code, which is difficult to guarantee in real-world projects.In this paper, we introduce CRDSER, a fully static cross-language code searcher designed to address these challenges. Our key insight is that, while code snippets in different languages may vary considerably in token sequences or syntactic structures, those with identical functionality can still share similarities in their Intermediate Representations (IRs). To capture this, we build a semantic graph that effectively models code semantics across languages by leveraging data flow and control flow information from IRs. We further design a hierarchical pooling mechanism to represent this graph structure, inspired by the way human developers hierarchically understand code snippets. Our large-scale evaluation demonstrates that CRDSER achieves both scalability (applicable to any code snippet) and high effectiveness, outperforming the best existing static approaches by up to 20% in Mean Reciprocal Rank. Additionally, ablation studies confirm that each module in our approach contributes substantially to CRDSER ’s overall effectiveness.

Authors

Institutions

Publication Details

Published
2024-11-22
DOI
https://doi.org/10.1109/icicml63543.2024.10958089
Primary Topic
Natural Language Processing Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Exploring Commonalities Across Programming Languages Using Intermediate Representation-Based Semantic Graphs

Hongyang Chen, Bo Duan, Bo Liu, Yunlong Guo et al.
Natural Language Processing Techniques
article

Exploring Commonalities Across Programming Languages Using Intermediate Representation-Based Semantic Graphs

Hongyang Chen, Bo Duan, Bo Liu, Yunlong Guo, Zhenshun Shi, Mingyang Geng
article en

Abstract

Cross-language code-to-code search has significant potential to enhance software development and maintenance by helping developers implement specific functionalities or migrate code between programming languages. Existing approaches, however, have notable limitations: static approaches relying on textual or syntactic information often lack effectiveness due to significant cross-language differences, while dynamic approaches relying on input-output behavior have limited applicability as they require executable code, which is difficult to guarantee in real-world projects.In this paper, we introduce CRDSER, a fully static cross-language code searcher designed to address these challenges. Our key insight is that, while code snippets in different languages may vary considerably in token sequences or syntactic structures, those with identical functionality can still share similarities in their Intermediate Representations (IRs). To capture this, we build a semantic graph that effectively models code semantics across languages by leveraging data flow and control flow information from IRs. We further design a hierarchical pooling mechanism to represent this graph structure, inspired by the way human developers hierarchically understand code snippets. Our large-scale evaluation demonstrates that CRDSER achieves both scalability (applicable to any code snippet) and high effectiveness, outperforming the best existing static approaches by up to 20% in Mean Reciprocal Rank. Additionally, ablation studies confirm that each module in our approach contributes substantially to CRDSER ’s overall effectiveness.

Xichang University (CN)
Quality Education
Openalex Percentile: Top 73%
Natural Language Processing Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.