Mining Idioms from Source Code
Not on the map. Why?
Abstract (arXiv)
We present the first method for automatically mining code idioms from a corpus of previously written, idiomatic software projects. We take the view that a code idiom is a syntactic fragment that recurs across projects and has a single semantic role. Idioms may have metavariables, such as the body of a for loop. Modern IDEs commonly provide facilities for manually defining idioms and inserting them on demand, but this does not help programmers to write idiomatic code in languages or using libraries with which they are unfamiliar. We present HAGGIS, a system for mining code idioms that builds on recent advanced techniques from statistical natural language processing, namely, nonparametric Bayesian probabilistic tree substitution grammars. We apply HAGGIS to several of the most popular open source projects from GitHub. We present a wide range of evidence that the resulting idioms are semantically meaningful, demonstrating that they do indeed recur across software projects and that they occur more frequently in illustrative code examples collected from a Q&A site. Manual examination of the most common idioms indicate that they describe important program concepts, including object creation, exception handling, and resource management.
Key facts. Cited by 19 papers in the map (data through 13 Oct 2026). First posted on arXiv 1 Apr 2014.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 4; 2022: 3; 2023: 5; 2024: 2; 2025: 3; 2026: 2.
19 papers.
Sort:
By area:
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 743
- 2024A Survey on Large Language Models for Code Generationcited by 656
- 2022Large Language Models Meet NL2Code: A Surveycited by 137
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 111
- 2022Top-Down Synthesis for Library Learningcited by 57
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequencescited by 50
- 2023LILO: Learning Interpretable Libraries by Compressing and Documenting Codecited by 47
- 2024An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detectioncited by 39
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugscited by 29
- 2021Learning to Complete Code with Sketchescited by 23
- 2021Neural Program Generation Modulo Static Analysiscited by 13
- 2023R-U-SURE? Uncertainty-Aware Code Suggestions By Maximizing Utility Across Random User Intentscited by 10
7 more
- 2025Generating Planning Feedback for Open-Ended Programming Exercises with LLMscited by 4
- 2025Fully Autonomous Programming using Iterative Multi-Agent Debugging with Large Language Modelscited by 3
- 2025Bringing Structure to Naturalness: On the Naturalness of ASTscited by 1
- 2026Compiling Large Multi-Modal Requirement Documents into Runnable Software Systems: From an Agentic Test-Driven Perspectivecited by 1
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automationcited by 0
- 2023CodeScholar: Growing Idiomatic Code Examplescited by 0
- 2026On Device Agentic Operation Caches -- Classifier-Centric NL-to-Action Generationcited by 0
- 2026On Device Agentic Operation Caches -- Classifier-Centric NL-to-Action Generation27 Sep 2026
- 2026Compiling Large Multi-Modal Requirement Documents into Runnable Software Systems: From an Agentic Test-Driven Perspective14 Feb 2026
- 2025Generating Planning Feedback for Open-Ended Programming Exercises with LLMs11 Apr 2025
- 2025Bringing Structure to Naturalness: On the Naturalness of ASTs11 Apr 2025
- 2025Fully Autonomous Programming using Iterative Multi-Agent Debugging with Large Language Models10 Mar 2025
- 2024An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detection10 Jun 2024
- 2024A Survey on Large Language Models for Code Generation1 Jun 2024
- 2023CodeScholar: Growing Idiomatic Code Examples23 Dec 2023
- 2023LILO: Learning Interpretable Libraries by Compressing and Documenting Code30 Oct 2023
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completion26 Jun 2023
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugs6 Jun 2023
- 2023R-U-SURE? Uncertainty-Aware Code Suggestions By Maximizing Utility Across Random User Intents1 Mar 2023
7 more
- 2022Large Language Models Meet NL2Code: A Survey19 Dec 2022
- 2022Top-Down Synthesis for Library Learning29 Nov 2022
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequences14 Feb 2022
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automation2 Dec 2021
- 2021Neural Program Generation Modulo Static Analysis26 Oct 2021
- 2021Learning to Complete Code with Sketches18 Jun 2021
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generation9 Feb 2021
- 2025Fully Autonomous Programming using Iterative Multi-Agent Debugging with Large Language Modelscited by 3
- 2026Compiling Large Multi-Modal Requirement Documents into Runnable Software Systems: From an Agentic Test-Driven Perspectivecited by 1
- 2026On Device Agentic Operation Caches -- Classifier-Centric NL-to-Action Generationcited by 0
- 2026On Device Agentic Operation Caches -- Classifier-Centric NL-to-Action Generation27 Sep 2026
- 2026Compiling Large Multi-Modal Requirement Documents into Runnable Software Systems: From an Agentic Test-Driven Perspective14 Feb 2026
- 2025Fully Autonomous Programming using Iterative Multi-Agent Debugging with Large Language Models10 Mar 2025
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 743
- 2024A Survey on Large Language Models for Code Generationcited by 656
- 2022Large Language Models Meet NL2Code: A Surveycited by 137
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 111
- 2022Top-Down Synthesis for Library Learningcited by 57
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequencescited by 50
- 2023LILO: Learning Interpretable Libraries by Compressing and Documenting Codecited by 47
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugscited by 29
- 2021Learning to Complete Code with Sketchescited by 23
- 2021Neural Program Generation Modulo Static Analysiscited by 13
- 2023R-U-SURE? Uncertainty-Aware Code Suggestions By Maximizing Utility Across Random User Intentscited by 10
- 2025Generating Planning Feedback for Open-Ended Programming Exercises with LLMscited by 4
12 most cited of 15 All 15 (JSON)
- 2025Generating Planning Feedback for Open-Ended Programming Exercises with LLMs11 Apr 2025
- 2025Bringing Structure to Naturalness: On the Naturalness of ASTs11 Apr 2025
- 2024A Survey on Large Language Models for Code Generation1 Jun 2024
- 2023CodeScholar: Growing Idiomatic Code Examples23 Dec 2023
- 2023LILO: Learning Interpretable Libraries by Compressing and Documenting Code30 Oct 2023
- 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completion26 Jun 2023
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugs6 Jun 2023
- 2023R-U-SURE? Uncertainty-Aware Code Suggestions By Maximizing Utility Across Random User Intents1 Mar 2023
- 2022Large Language Models Meet NL2Code: A Survey19 Dec 2022
- 2022Top-Down Synthesis for Library Learning29 Nov 2022
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequences14 Feb 2022
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automation2 Dec 2021
12 newest of 15 All 15 (JSON)