Fast, flexible syntactic pattern matching and processing
- 23 December 2002
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- No. 10928138,p. 144-153
- https://doi.org/10.1109/wpc.1996.501129
Abstract
Program understanding can be assisted by tools that match patterns in the program source. Lexical pattern matchers provide excellent performance and ease of use, but have a limited vocabulary. Syntactic matchers provide more precision, but may sacrifice performance, retargetability, ease of use, or generality. To achieve more of the benefits of both models, we extend the pattern syntax of AWK to support matching of abstract syntax trees, as demonstrated in a tool called TAWK. Its pattern syntax is language-independent, based on abstract tree patterns. As in AWK, patterns can have associated actions, which in TAWK are written in C for generality, familiarity, and performance. The use of C is simplified by high-level libraries and dynamic linking. To allow processing of program files containing non-syntactic constructs, mechanisms have been designed that allow transparent matching in a syntactic fashion. So far TAWK has been retargeted to the MUMPS and C programming languages. We survey and apply prototypical approaches to concretely demonstrate the tradeoffs. Our results indicate that TAWK can be used to quickly and easily perform a variety of common software engineering tasks, and the extensions to accommodate non-syntactic features significantly extend the generality of syntactic matchers.Keywords
This publication has 12 references indexed in Scilit:
- The design of whole-program analysis toolsPublished by Institute of Electrical and Electronics Engineers (IEEE) ,2002
- A*: a language for implementing language processorsPublished by Institute of Electrical and Electronics Engineers (IEEE) ,2002
- A program transformation approach to automating software re-engineeringPublished by Institute of Electrical and Electronics Engineers (IEEE) ,2002
- A*: a language for implementing language processorsIEEE Transactions on Software Engineering, 1995
- Lightweight source model extractionPublished by Association for Computing Machinery (ACM) ,1995
- Managing design trade-offs for a program understanding and transformation toolJournal of Systems and Software, 1995
- Programmable syntax macrosPublished by Association for Computing Machinery (ACM) ,1993
- GENOA - A Customizable, Language- And Front-end Independent Code AnalyzerPublished by Institute of Electrical and Electronics Engineers (IEEE) ,1992
- Pattern Matching in StringsPublished by Elsevier ,1980
- Awk — a pattern scanning and processing languageSoftware: Practice and Experience, 1979