Re: How to get at the entire input buffer string from inside lexer?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Sun, 29 Mar 2009 19:34:24 +0000 (UTC)

          From comp.compilers

Related articles
How to get at the entire input buffer string from inside lexer? eric.fowler@gmail.com (Eric Fowler) (2009-03-28)
Re: How to get at the entire input buffer string from inside lexer? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-03-29)
Re: How to get at the entire input buffer string from inside lexer? m.helvensteijn@gmail.com (2009-03-29)
Re: How to get at the entire input buffer string from inside lexer? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-03-29)
Re: How to get at the entire input buffer string from inside lexer? eric.fowler@gmail.com (Eric Fowler) (2009-03-30)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Sun, 29 Mar 2009 19:34:24 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 09-03-105
Keywords: lex
Posted-Date: 29 Mar 2009 18:40:39 EDT

Eric Fowler <eric.fowler@gmail.com> wrote:
(snip)


> The *XX field is a single byte checksum calculated from the rest of
> the string up to that point.


> I am looking for a nice clean way of checking the sum within either
> the parser or the lexer, that is, calculating the checksum from the
> whole string and comparing it to the value I got embedded in the
> string itself.


Many checksums are designed such that, when computed over
the whole string including the checksum character,
the result is a known constant, usually zero or ~0.


That avoids the need for a special check for the last
character and a compare operation, but it may or
may not help in your caes.


-- glen



Post a followup to this message

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