Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #6957
| From | Kaz Kylheku <221-501-9011@kylheku.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Parsing and reporting errors? |
| Date | 2016-09-30 22:50 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <20160930154423.991@kylheku.com> (permalink) |
| References | (1 earlier) <nslvlu$1md1$1@gioia.aioe.org> <20160930085057.781@kylheku.com> <nsm4rc$pi$1@gioia.aioe.org> <20160930104315.851@kylheku.com> <nsmgmk$kd0$1@gioia.aioe.org> |
On 2016-09-30, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
> On 2016-09-30 19:46, Kaz Kylheku wrote:
>> On 2016-09-30, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
>
>>> Not really, normally the parser simply matches the source against the
>>> current table of alternatives expected:
>>> switch (Statements.Match (Source))
>>> {
>>
>> "the source" constitutes lookahead: the matcher has to peek into the
>> stream a number of characters, which stay there if there is no match.
>
> In the sense that a source character might be tested several times. But
> the current line is read into memory anyway.
Yes, and that part of the current line not read into the parser's
memory is in some stream buffer, and stuff not in the stream buffer
is in the TCP windows of the network connection, etc.
Any of it is "lookahead" or none, depending on how you define
the word.
> If the table uses hash that could be counted as a look-ahead too. But
> usually look-ahead means something more substantial.
Usually "lookahead" in the context of parsing refers to something
meaningful in the parsing algorithm, irrespective of underlying
buffers and such. Specifically, "lookahead" refers to an item,
or multiple items, which are understood to have been removed from
the input stream and are under the control of the parsing algorithm.
In many circumstances when the parsing algorithm must process more
input, it must first process these lookahead items in preference to
subsequent input. (That may be done by pushing back the lookahead
items as characters back into the stream, if possible, or doing
something else.)
Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Parsing and reporting errors? "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-09-30 17:17 +0200
Re: Parsing and reporting errors? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-30 16:03 +0000
Re: Parsing and reporting errors? "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-09-30 18:45 +0200
Re: Parsing and reporting errors? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-30 17:46 +0000
Re: Parsing and reporting errors? "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-09-30 22:07 +0200
Re: Parsing and reporting errors? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-30 22:50 +0000
csiph-web