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

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Sun, 29 Mar 2009 20:24:07 +0200

          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: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Sun, 29 Mar 2009 20:24:07 +0200
Organization: Compilers Central
References: 09-03-105
Keywords: lex
Posted-Date: 29 Mar 2009 18:39:58 EDT

Eric Fowler schrieb:


> I am working on a little project in which I have redefined YYINPUT to
> take input from an ASCII string. I need to parse and break down
> strings of the form:
>
> $FOOBAR, some data, more data*XX<CRLF>
>
> The *XX field is a single byte checksum calculated from the rest of
> the string up to that point.


The format looks like the checksum can and has to be checked indepently
from the contents of the line. When the input is garbled, somehow, this
can be determined from the checksum, *before* processing the contents in
detail.


In transport protocol terms: The checksum is part of some low level
protocol, and should be removed before processing the payload
information in the higher levels (lexer, parser).




> By the way, I have presented a simplified version of the real problem,
> so the trivial solution of calculating sum when I first see the string
> will not work.


Please specify.


DoDi



Post a followup to this message

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