Re: flex scanner too huge, suggestions?

olsenc@ichips.intel.com (Clint Olsen)
25 Feb 2001 10:50:40 -0500

          From comp.compilers

Related articles
flex scanner too huge, suggestions? troy@bell-labs.com (Troy Cauble) (2001-02-17)
Re: flex scanner too huge, suggestions? tej@melbpc.org.au (Tim Josling) (2001-02-23)
Re: flex scanner too huge, suggestions? snicol@apk.net (Scott Nicol) (2001-02-23)
Re: flex scanner too huge, suggestions? rkrayhawk@aol.com (2001-02-23)
Re: flex scanner too huge, suggestions? olsenc@ichips.intel.com (2001-02-25)
Re: flex scanner too huge, suggestions? Ron@Profit-Master.com (Ron Pinkas) (2001-02-25)
Re: flex scanner too huge, suggestions? troy@bell-labs.com (Troy Cauble) (2001-03-01)
| List of all articles for this month |

From: olsenc@ichips.intel.com (Clint Olsen)
Newsgroups: comp.compilers
Date: 25 Feb 2001 10:50:40 -0500
Organization: Intel Corporation, Hillsboro, OR
References: 01-02-097
Keywords: lex
Posted-Date: 25 Feb 2001 10:50:40 EST

I strongly suggest you try using re2c instead of flex. I just converted a
flex scanner over to re2c, and the size difference is stunning.


Re2c can also easily generate reentrant C lexers which is great. Re2c
requires you to write your own buffer management, but I copied the example
they provided for a C scanner and it was terrific.


re2c -b : c file size: 25470 (!!)
flex -f (%option align): c file size: 421804


Executable with re2c: 106252 bytes
Executable with flex: 325850 bytes


Re2c has some limitations on regular expression support, but the most
important features are there. The examples provided are very helpful.


Typically re2c generates faster and smaller parsers than flex. In my case,
the speed was about on par with flex. However, I got line and column
information support in the re2c scanner.


I wish I had found re2c sooner.


-Clint


re2c
----


Version 0.9.1
Originally written by Peter Bumbulis (peter@csg.uwaterloo.ca)
Currently maintained by Brian Young (bayoung@acm.org)


The re2c distribution can be found at:


        http://www.tildeslash.org/re2c/index.html


The source distribution is available from:


        http://www.tildeslash.org/re2c/re2c-0.9.1.tar.gz


>Made with LFLAGS = -Cfe, size gives
>42068(.text) + 24(.data) + 60(.bss) + 1687886(.rodata) = 1730038
>
>Made with LFLAGS = -Cem, size gives
>42496(.text) + 24(.data) + 60(.bss) + 508326(.rodata) = 550906
>
>This is still pretty large for some of our target environments.


Post a followup to this message

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