Re: Several flex scanners share common rules/definitions?

Hans Aberg <haberg@matematik.su.se>
28 Jun 2004 20:04:57 -0400

          From comp.compilers

Related articles
Several flex scanners share common rules/definitions? markus.cl@gmx.de (2004-06-26)
Re: Several flex scanners share common rules/definitions? cbarron413@adelphia.net (Carl Barron) (2004-06-28)
Re: Several flex scanners share common rules/definitions? snicol@apk.net (Scott Nicol) (2004-06-28)
Re: Several flex scanners share common rules/definitions? haberg@matematik.su.se (Hans Aberg) (2004-06-28)
Re: Several flex scanners share common rules/definitions? clint@0lsen.net (Clint Olsen) (2004-06-30)
Re: Several flex scanners share common rules/definitions? johnmillaway@yahoo.com (John Millaway) (2004-06-30)
Re: Several flex scanners share common rules/definitions? sjohnson@mathworks.com (Steve Johnson) (2004-07-13)
| List of all articles for this month |

From: Hans Aberg <haberg@matematik.su.se>
Newsgroups: comp.compilers
Date: 28 Jun 2004 20:04:57 -0400
Organization: Compilers Central
References: 04-06-102
Keywords: lex
Posted-Date: 28 Jun 2004 20:04:57 EDT

>, markus.cl@gmx.de (Markus Dehmann) wrote:


>I have two scanners that use basically the same regular expressions
>and differ only in a few details. How can I write the two lex files so
>that I don't have to write the common things twice?


Using a scanner like Flex, the only viable way is probably to write a
common file for some text-processing program (say Perl, M4), that then
generates two .l files. The thing is that the lexer regular expression
grammar is transformed into a DFA, and (I suspect) two quite similar
grammars can result in quite different DFA's. You might inquiry further in
the Help-flex mailing list
    help-flex@gnu.org
    http://mail.gnu.org/mailman/listinfo/help-flex


    Hans Aberg


Post a followup to this message

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