Title :
A Pattern Search Method for Unpreprocessed C Programs Based on Tokenized Syntax Trees
Author :
Yoshida, Atsushi ; Hachisu, Yoshinari
Author_Institution :
Fac. of Sci. & Eng., Nanzan Univ., Seto, Japan
Abstract :
Pattern search of programs is a fundamental function for supporting programming. In this paper, we propose a search method for unpreprocessed programs, which are difficult to parse. Our parser directly parses them by rewriting token sequences, and allows minor errors in syntax trees. The search tool takes queries that are the same as the format of program fragments. By using the same parser for both queries and target programs, programmers have no need to describe the detail structures of syntax trees in queries. To support accurate search, we also show an alignment tool for branch directives, which converts undisciplined directives to discipline ones, and a reverse macro expansion tool, which integrates the use of macro calls. Finally, we present some experiments in which we have applied the tools to an open source application, and discuss how to improve our tools.
Keywords :
C language; program compilers; programming language semantics; public domain software; query processing; tree data structures; alignment tool; branch directives; discipline directives; macrocalls; minor errors; open source application; program fragments; program parsing; program pattern search method; query processing; reverse macroexpansion tool; target programs; token sequence rewriting; tokenized syntax tree structures; undisciplined directives; unpreprocessed C programs; Context; Pattern matching; Search methods; Syntactics; Vectors; White spaces; XML; parser; pattern search; rewrite rule; unpreprocessed C program;
Conference_Titel :
Source Code Analysis and Manipulation (SCAM), 2014 IEEE 14th International Working Conference on
Conference_Location :
Victoria, BC
DOI :
10.1109/SCAM.2014.16