Precise and Scalable Querying of Syntactical Source Code Patterns Using Sample Code Snippets and a Database

O. Panchenko, J. Karstens, H. Plattner, A. Zeier
{"title":"Precise and Scalable Querying of Syntactical Source Code Patterns Using Sample Code Snippets and a Database","authors":"O. Panchenko, J. Karstens, H. Plattner, A. Zeier","doi":"10.1109/ICPC.2011.31","DOIUrl":null,"url":null,"abstract":"While analyzing a log file of a text-based source code search engine we discovered that developers search for fine-grained syntactical patterns in 36\\% of queries. Currently, to cope with queries of this kind developers need to use regular expressions, to add redundant terms to the query or to combine searching with other tools provided by the development environment. To improve the expressiveness of the queries, these can be formulated as tree patterns of abstract syntax trees. These search patterns can be expressed by using query languages, such as XPath. However, developers usually do not work with either XPath or with AST. To shield developers from the complexity of query formulation we propose using sample code snippets as queries. The novelty of our approach is the combination of a query language that is very close to the surface programming language and a special database technology to store a large amount of abstract syntax trees. The advantage of this approach over existing source code query languages and search engines is the performance of both query formulation and query execution. This paper describes the technical details of the method and illustrates the value of this approach with performance measures and an industrial controlled experiment. All developers were able to complete the tasks of the experiment faster and more accurately by using our tool (ACS) than by using a text-based search engine. The number of false positives in the result lists was significantly decreased.","PeriodicalId":345601,"journal":{"name":"2011 IEEE 19th International Conference on Program Comprehension","volume":"16 15","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-06-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"11","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2011 IEEE 19th International Conference on Program Comprehension","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ICPC.2011.31","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 11

Abstract

While analyzing a log file of a text-based source code search engine we discovered that developers search for fine-grained syntactical patterns in 36\% of queries. Currently, to cope with queries of this kind developers need to use regular expressions, to add redundant terms to the query or to combine searching with other tools provided by the development environment. To improve the expressiveness of the queries, these can be formulated as tree patterns of abstract syntax trees. These search patterns can be expressed by using query languages, such as XPath. However, developers usually do not work with either XPath or with AST. To shield developers from the complexity of query formulation we propose using sample code snippets as queries. The novelty of our approach is the combination of a query language that is very close to the surface programming language and a special database technology to store a large amount of abstract syntax trees. The advantage of this approach over existing source code query languages and search engines is the performance of both query formulation and query execution. This paper describes the technical details of the method and illustrates the value of this approach with performance measures and an industrial controlled experiment. All developers were able to complete the tasks of the experiment faster and more accurately by using our tool (ACS) than by using a text-based search engine. The number of false positives in the result lists was significantly decreased.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
使用示例代码片段和数据库的精确和可伸缩的语法源代码模式查询
在分析一个基于文本的源代码搜索引擎的日志文件时,我们发现开发人员在36%的查询中搜索细粒度语法模式。目前,为了处理这类查询,开发人员需要使用正则表达式,在查询中添加冗余项,或者将搜索与开发环境提供的其他工具结合起来。为了提高查询的表达性,可以将它们表述为抽象语法树的树模式。这些搜索模式可以通过使用查询语言(如XPath)来表示。但是,开发人员通常既不使用XPath也不使用AST。为了使开发人员避免查询公式的复杂性,我们建议使用示例代码片段作为查询。我们的方法的新颖之处在于,它结合了一种非常接近表面编程语言的查询语言和一种特殊的数据库技术来存储大量抽象语法树。与现有的源代码查询语言和搜索引擎相比,这种方法的优势在于查询表述和查询执行的性能。本文描述了该方法的技术细节,并通过性能测量和工业控制实验说明了该方法的价值。通过使用我们的工具(ACS),所有开发人员都能够比使用基于文本的搜索引擎更快、更准确地完成实验任务。结果表中的假阳性数量明显减少。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Precise and Scalable Querying of Syntactical Source Code Patterns Using Sample Code Snippets and a Database Comparison of a Visual and a Textual Notation to Express Data Constraints in Aspect-Oriented Join Point Selections: A Controlled Experiment Trustrace: Improving Automated Trace Retrieval through Resource Trust Analysis Generating Parameter Comments and Integrating with Method Summaries The NiCad Clone Detector
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1