[Flex-devel] Suggestions for improvement
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Joe K. <kr...@ni...> - 2008-09-29 18:32:09
|
Here are some suggestions for updating Flex. Is it good to mail patches to this list? Several newer(?) functions should probably be included in the options for not generating code, such as "%option noyyget_column noyyset_column" When the option is used to generate a public header, the scanner source file should #include that header rather than duplicating the contents in the source file. Otherwise, user code that include that header (directly or indirectly) gets duplicate declarations. At the very least, generated source should pre-define the header's include guard macro. Flex has functions yyset_lval() and yyset_lloc() so that the scanner globals can be set in reentrant mode, without having to pass them as arguments on every call to yylex(). Unfortunately, those functions are generated ONLY with bison-bridge options, which also forces them to be yylex arguments. My suggestion is to always generate the lval and lloc set/get functions in reentrant mode, unless options noyyset_lval, etc., are given. The main reason Flex has memory allocation wrappers seems to be to avoid errors for older standards that use (char*) for memory pointers. Why not include a flag to directly use malloc, etc.? Or maybe an option to define them as inline, to get the same effect? Joe Krahn |