Toward a Language-Agnostic, Syntactic Representation for Preprocessed Code

Jeffrey L. Overbey, Matthew Michelotti, Ralph E. Johnson · 2009

Preprocessors complicate refactoring because refactoring tools must manipulate unpreprocessed code. Working forward from Garrido’s work on refactoring preprocessed C [1], we propose a general means by which preprocessor directives can be represented in a syntax tree for an arbitrary language. The representation is simple but general, based on the notions of token-whitetext affixes and substitution tokens. Moreover, we suggest that a preprocessing infrastructure can be completely independent of the language being preprocessed, allowing a single preprocessor to be reused among several refactoring tools and allowing numerous preprocessors to be plugged into a single refactoring tool.

Read the paper · More papers on PaperTik