Re: Can (f)lex handle the NULL character?

rkrayhawk@aol.com (RKRayhawk)
9 May 1999 16:01:28 -0400

          From comp.compilers

Related articles
Can (f)lex handle the NULL character? dcardani@totalint.com (1999-05-07)
Re: Can (f)lex handle the NULL character? rkrayhawk@aol.com (1999-05-09)
Re: Can (f)lex handle the NULL character? dcardani@totalint.com (1999-05-16)
Re: Can (f)lex handle the NULL character? rkrayhawk@aol.com (1999-05-20)
| List of all articles for this month |
From: rkrayhawk@aol.com (RKRayhawk)
Newsgroups: comp.compilers
Date: 9 May 1999 16:01:28 -0400
Organization: AOL http://www.aol.com
References: 99-05-018
Keywords: lex

Could you maybe share some of the flex code you are having problems
with here. It is possible that you are not having trouble in your
regular expression code or the flex rules.


Instead, you may be having problems passing NULL as a token. You did
not state that you are, but at the risk of taking too obvious an
approach on this, let me state that lex and its progeny can not pass
NULL (as a single byte token). This is because that is reserved as the
handshake value between the lexer and parser to, in fact, signal end
of file.


So depending on the version of lex, any attempt to violate this rule
drives (f)lex wild or the parser wild.


If this is your problem, then you may have some genuine interest in
gabbing this one byte text and passing it as a token. You can do
that, just don't try to send it literally. Instead, set up a %token in
your parser declarations and pass the NULL token symbolically. If
needed, you can still pass the hex zeroes as the lexeme value in the
state variable. You just can not pass token zero.


Best Wishes,


Robert Rayhawk
RKRayhawk@aol.com


Post a followup to this message

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