Unparsed patterns: easy user-extensibility of program manipulation tools

  • Authors:
  • Nic Volanschi;Christian Rinderknecht

  • Affiliations:
  • mygcc, Poissy, France;Konkuk University, Seoul, South Korea

  • Venue:
  • PEPM '08 Proceedings of the 2008 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Pattern matching in concrete syntax is very useful in program manipulation tools. In particular, user-defined extensions to such tools are written much easier using concrete syntax patterns. A few advanced frameworks for language development implement support for concrete syntax patterns, but mainstream frameworks used today still do not support them. This prevents most existing program manipulation tools from using concrete syntax matching, which in particular severely limits the writing of tool extensions to a few language experts. This paper argues that the major implementation obstacle to the pervasive use of concrete syntax patterns is the pattern parser. We propose an alternative approach based on ''unparsed patterns'', which are concrete syntax patterns that can be efficiently matched without being parsed. This lighter approach gives up static checks that parsed patterns usually do. In turn, it can be integrated within any existing parser-based software tool, almost for free. One possible consequence is enabling a widespread adoption of extensible program manipulation tools by the majority of programmers. Unparsed patterns can be used in any programing language, including multi-lingual environments. To demonstrate our approach, we implemented it both as a minimal patch for the gcc compiler, allowing to scan source code for user-defined patterns, and as a stand alone prototype called matchbox.