|Flex/yacc problems firstname.lastname@example.org (Omar Al-Kaisy) (2001-06-07)|
|Re: Flex/yacc problems email@example.com (Tom Moog) (2001-06-08)|
|Re: Flex/yacc problems firstname.lastname@example.org (Zhu Wenzhang) (2001-06-21)|
|From:||"Zhu Wenzhang" <email@example.com>|
|Date:||21 Jun 2001 03:17:41 -0400|
|Organization:||CSIS, The University of Hong Kong|
|Posted-Date:||21 Jun 2001 03:17:41 EDT|
"Omar Al-Kaisy" <firstname.lastname@example.org> wrote in message
> I am currently converting an already-existing lex program into flex,
> and have hit upon a couple of obstacles. The original lex program did
> all sorts of fancy stuff in order to determine that it had reached the
> end of the file. Due to the existence of a flex <<EOF>> token, a lot
> of this code could now be removed. However, I am encountering some
> strange situations when utilising this token. If the file being parsed
> (I use yacc with the flex) contains only one input/message then the
> EOF is recognised and can therefore be handled. However, on multiple
> messages/inputs, the program does not seem to recognise EOF at
> all. Are there any known irregularities/bugs with the EOF token in
> flex (possibly when used with yacc), or does anyone know how to
> succussfully utilise the token, or know of documentation outside of
> the man pages where I can obtain information/examples?
You can use multiple input buffers to handle multiple input stream. First
you use the first file as you input. At the <<EOF>>, you can use
fp=fopen(your next file name, ...);
yy_switch_to_buffer(yy_create_buffer(fp,YY_BUF_SIZE)); Then your yylex()
will continue on the next file. And so on...
You can download the flex & bison reference manual from the GNU's page.
> Secondly, if I attempt to process messages whose combined size is
> greater than 8KB, my program falls over. Does anyone have any idea why
> this may be? Does this have anything to do with my flex/yacc settings?
The default setting of yytext is %pointer. But if you set the option to be
"%array", then the buffer size is limited to YYLMAX(generally 8KB). You can
change this macro definition to any size you like if you use %array option.
Return to the
Search the comp.compilers archives again.