comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada standard and maximum line lengths
Date: Mon, 28 Jan 2013 16:13:42 +0100
Date: 2013-01-28T16:13:42+01:00	[thread overview]
Message-ID: <17adf7sj1i15v$.1k1xz901015cq.dlg@40tude.net> (raw)
In-Reply-To: 7e0f4106-9a87-4602-9098-125e920d9d47@googlegroups.com

On Mon, 28 Jan 2013 02:02:54 -0800 (PST), Maciej Sobczak wrote:

> W dniu poniedzia�ek, 28 stycznia 2013 09:18:43 UTC+1 u�ytkownik Dmitry A. Kazakov napisa�:
> 
>>> I was reading the Ada 2012 standard and found this, I was just wondering
>>> why there is a maximum line length, it's not like we parse the language a
>>> line at a time.
>> 
>> It is. I always accumulate a whole line before parsing it.
> 
> But it is an implementation detail of your particular parser.

As much as the reverse would be. [I answered because the OP presumed that
no parser does it this way. At least one (mine) does.]

> There is nothing in the concept of parsing itself that would require it.

Actually there is something. It is the backtracking/look-ahead, which
determines how much of the source need to be cached by the parser. One
stream element is usually not enough, at least not sufficient to generate
reasonable error messages. Lines are most natural to determine the
boundaries of backtracking/look-ahead.

>>> Why not just accept it as a stream of tokens and if there
>>> are line breaks, ignore?
>> 
>> For multiple reasons. Specifically regarding Ada, the language has syntax
>> elements bound by the line end, e.g. comments etc.
> 
> There is no problem reading the stream until some token (newline) is
> found. Especially if the whole purpose of reading is to ignore the input,
> as is the case with comments.

That would not ignore line breaks as the OP suggested.

> I do not see anything that would prevent the implementation that accepts
> potentially indefinite line lengths, while still putting arbitrary limits
> on identifiers.

+ limits on the string literal length.

Otherwise, yes, it would be possible to do, though useless. Because other
tools depend on sane line lengths even more than the parser does e.g.
editors, debuggers, documenting, addr2line after all.

> I would not be surprised if the permission to limit is a leftover from the
> ice age of line printers, without any real association with today's
> systems.

Rather the opposite. If lines are the ice arge then unget is Permian.

[ A parser like mine ensures that each lexical element in the focus is
cached. This allows to avoid secondary caches and related overhead. E.g. an
identifier or string literal is not accumulated during parsing. Rather its
starting and end positions are determined and passed further. It is all
in-place until stored. ]

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2013-01-28 15:13 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28  5:02 Ada standard and maximum line lengths Lucretia
2013-01-28  6:01 ` J-P. Rosen
2013-01-28  6:28 ` Jeffrey Carter
2013-01-28  8:05   ` Niklas Holsti
2013-01-28 16:42     ` Jeffrey Carter
2013-01-28 20:22       ` Niklas Holsti
2013-01-28 20:46         ` J-P. Rosen
2013-01-28 21:29           ` Niklas Holsti
2013-01-29  1:42             ` Randy Brukardt
2013-01-29  6:15             ` J-P. Rosen
2013-01-29 10:25               ` Niklas Holsti
2013-01-29 11:31                 ` Georg Bauhaus
2013-01-29 12:11                   ` Simon Wright
2013-01-29 12:31                   ` Niklas Holsti
2013-01-29 12:37                     ` Niklas Holsti
2013-01-29 15:29                     ` Georg Bauhaus
2013-01-29 16:58                       ` Niklas Holsti
2013-01-29 17:51                         ` Georg Bauhaus
2013-01-29 18:18                           ` Shark8
2013-01-29 19:54                           ` Niklas Holsti
2013-01-29 23:12                             ` Georg Bauhaus
2013-01-30  9:18                               ` Niklas Holsti
2013-01-30  9:51                                 ` Simon Wright
2013-01-30 15:28                                 ` Robert A Duff
2013-01-30 23:24                                   ` Randy Brukardt
2013-01-31  2:16                                     ` Robert A Duff
2013-01-31  9:10                                       ` Stefan.Lucks
2013-01-31  9:30                                         ` Niklas Holsti
2013-01-31  9:51                                           ` Simon Wright
2013-01-31 10:56                                           ` Georg Bauhaus
2013-01-31 18:02                                         ` Jeffrey Carter
2013-01-31 23:54                                       ` Randy Brukardt
2013-02-01  9:15                                         ` Niklas Holsti
2013-02-01 23:13                                           ` Randy Brukardt
2013-02-02  1:24                                             ` Lucretia
2013-02-02 14:12                                               ` Robert A Duff
2013-02-05  2:09                                               ` Randy Brukardt
2013-01-31  9:03                                   ` Dmitry A. Kazakov
2013-01-30  9:37                               ` Simon Wright
2013-01-30 12:02                                 ` Georg Bauhaus
2013-01-29 23:47                             ` Jeffrey Carter
2013-01-30  7:24                               ` Niklas Holsti
2013-01-30 10:09                                 ` J-P. Rosen
2013-01-29 20:36                 ` Niklas Holsti
2013-01-29 21:01                   ` Robert A Duff
2013-01-29 21:14                   ` Dmitry A. Kazakov
2013-01-28  8:18 ` Dmitry A. Kazakov
2013-01-28 10:02   ` Maciej Sobczak
2013-01-28 11:57     ` Georg Bauhaus
2013-01-28 13:28       ` Niklas Holsti
2013-01-28 15:14       ` J-P. Rosen
2013-01-28 16:13       ` Dmitry A. Kazakov
2013-01-28 15:13     ` Dmitry A. Kazakov [this message]
2013-01-28 13:49 ` Robert A Duff
2013-01-29  2:09   ` Randy Brukardt
2013-01-29 18:46 ` Lucretia
2013-01-29 20:53   ` Robert A Duff
2013-01-29 21:22   ` Dmitry A. Kazakov
2013-01-30  3:22     ` Lucretia
2013-01-30  9:49       ` Dmitry A. Kazakov
2013-01-30 23:28         ` Randy Brukardt
2013-02-01  1:48       ` Shark8
2013-01-29 21:29   ` Dmitry A. Kazakov
2013-01-29 21:53   ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox