RE2C: A More Versatile Scanner Generator PETER BUMBULlS University and DONALD D. COWAN of Waterloo It is usually claimed that lexical analysis routines are still coded by hand, despite the widespread availability of scanner generators, for efficiency reasons. While efficiency is a consideration, there exist freely available scanner generators such as GLA [Gray 19881 that can generate scanners that are faster than most hand-coded ones. However, most generated scanners are tailored for a particular environment, and retargeting these scanners to other environments, if possible, is usually complex enough to make a hand-coded scanner more appealing, In this paper we describe RE2C, a scanner generator that not only generates scanners that are faster (and usually smaller) than those produced by any other scanner generator known to the authors, including GLA, but that also adapt easily to any environment. Categories and Subject Descriptors: D.3.2 [Programming Languages]: Language Classitlcations specialized application languages; D.3.4 [Programming Languages]: Processors General Additional Terms: Algorithms, Languages, Performance analysis, scanner generator Key Words and Phrases: Lexical 1. INTRODUCTION Lexical analysis routines are still often coded by hand despite the widespread availability of scanner generators. have a scanner generator installed 1988]), few UNIX applications For example, while most
/lp/association-for-computing-machinery/re2c-a-more-versatile-scanner-generator-VC2Dvuihfe