[antlr-interest] DFAC: very-fast lexer generator for C/C++

Paul B Mann paul at paulbmann.com
Mon Jul 26 22:56:08 PDT 2010


Hi, 

I have released DFAC, a DFA lexer generator for C/C++. 
It is freeware. 

It should work with ANTLR, however, I have not tried it yet to 
see if the generated lexers actually compile and run with ANTLR 
parsers.  Why?  Because I am not an ANTLR user at this time. 
I'm an LALR kind of guy working with Microsoft Visual C++. 

My testing of DFAC against 'flex' and 're2c' has shown that DFAC
creates lexers that are 2.1 times the speed of 'flex' lexers and 1% 
faster than 're2c' lexers.  DFAC lexers are 25% smaller than 're2c'
lexers for the C language and 50% smaller for the DB2 language 
(when having the lexer do keyword recognition). 

That brings up a nice feature of DFAC.  It recognizes keywords 
and identifiers at the same time (faster than having the symbol table 
recognize the keywords).  Also, you don't have to be concerned 
about the order of the rules in the lexical grammar input to DFAC.  
It solves the keyword-identifier ambiguity problem. 

Yes, DFAC reads a real lexical BNF grammar notation which
is actually more powerful than regular expressions (or at least
more readable).  If you have ever tried to define a C-like 
comment with regular expressions, you might appreciate the
way DFAC lets you do it. 

DFAC works very well with Microsoft Visual C++ 2008, 
by providing VS type error messages.  Just click on the error
message and it takes you to the source line causing the error. 

You can download DFAC at CompilerWare for FREE:
http://compilerware.com 

You are welcome to send comments or questions to me at
support at compilerware.com 

I never get tired of talking about this subject, and I've been
doing this since 1978.  I must be nuts, huh? 

Regards, 

Paul B Mann
















More information about the antlr-interest mailing list