DFAC, DFA lexer generator for C/C++

Paul Mann <paul@paulbmann.com>
Thu, 13 May 2010 10:58:56 -0700 (PDT)

          From comp.compilers

Related articles
DFAC, DFA lexer generator for C/C++ paul@paulbmann.com (Paul Mann) (2010-05-13)
Re: DFAC, DFA lexer generator for C/C++ paul@paulbmann.com (Paul Mann) (2010-07-01)
Re: DFAC, DFA lexer generator for C/C++ paul@paulbmann.com (Paul Mann) (2010-07-07)
| List of all articles for this month |

From: Paul Mann <paul@paulbmann.com>
Newsgroups: comp.compilers
Date: Thu, 13 May 2010 10:58:56 -0700 (PDT)
Organization: Compilers Central
Keywords: lex, available
Posted-Date: 14 May 2010 10:21:33 EDT


I'm releasing a new lexer generator that reads an LALR lexical grammar
notation, which is a full LALR(1) grammar type of input. It generates
C/C++ code -- one switch statement for each state in the DFA. See:

The generated lexers are running about 1% faster than RE2C lexers and
are about 25% smaller. DFAC lexers are mostly for use in building
compilers and translators. They are not general-purpose lexers with
look-ahead, backtracking, and non-greedy properties.

I also did a comparison of direct-code lexers versus table-driven
lexers and posted some graphs on the website: http://highperware.com.

Of course, if your input lexical grammar requires a PDA type of
pattern recognizer, DFAC will tell you about the cycles in your
grammar. It only generates DFA lexers because they are 5.5 times the
speed of PDA lexers.

DFAC runs on Windows XP at this time. The download is an evaluation
package (without the dfac.exe program) that provides a C-subset
grammar, test program and lexer in C. You can compile the test case
and check the speed on your computer.

The lexers are processing C/C++ tokens at a rate on 34,620,000 tokens
per second on a single CPU 3-GHz computer. Compilation was done with
Visual C/C++ 2008.

Table-driven lexers can reach a speed of 44,031,000 tokens per second,
but their size needs to be quite large to get that speed. Compressed
table- driven lexers were about 2 times the speed of FLEX lexers and
nearly equal in size.

Any comments or feedback is welcome.

Paul B Mann

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.