Chapter 1: Introduction

This manual describes flexc++, a tool which can generate lexical scanners: programs recognizing patterns in text. Usually, scanners are used in combination with parsers, which in turn can be generated, by bisonc++ for example.

Flexc++ reads a lexer file, containing rules: pairs of regular expressions and C++ code. A number of files are then generated, defining a class (Scanner by default). The member function lex() is used to analyse input for occurrences of the regular expressions. Whenever it finds one, it executes the corresponding C++ code.

Flexc++ is highly comparable to the programs flex and flex++, written by Vern Paxson. The goal was to create a similar program, but to completely implement it in C++. Most flex / flex++ grammars should be usable with flexc++, with minor adjustments (see also the differences with flex / flex++ 3).

This edition of the manual documents version 0.5.3 and provides detailed information on how to use flexc++ and how flexc++ works. Some texts are adapted from the flex manual. The manual page flexc++(1) offers a quick overview of the command line options and option directives.

The most recent version of both this manual and flexc++ itself can be found on our website http://flexcpp.org/. If you find a bug in flexc++ or mistakes in the documentation, please report it using our bug tracker.

Flexc++ was built by Richard Berendsen, Frank B. Brokken and Jean-Paul van Oosten.