comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: OpenToken: Parsing Ada (subset)?
Date: Wed, 17 Jun 2015 12:38:38 -0500
Date: 2015-06-17T12:38:38-05:00	[thread overview]
Message-ID: <85pp4u8cbl.fsf@stephe-leake.org> (raw)
In-Reply-To: mlpasc$r4m$1@dont-email.me

"G.B." <bauhaus@futureapps.invalid> writes:

> On 16.06.15 15:24, Dmitry A. Kazakov wrote:
>>> It does not enforce all the lexical rules for numbers; it allows
>>> repeated, leading, and trailing underscores; it doesn't enforce pairs of
>>> '#'.
>> That is exactly the point. It does not parse literal right and you have to
>> reparse the matched chunk of text once again. What was the gain? Why
>> wouldn't do it right in single step?
>
> (I believe the use case here permits simplifications,
> meaning that REs are not being used for meticulous, final
> parsing of Ada.)

Yes, my examples are drawn from a parser for the indentation/navigation
engine in Emacs Ada mode, which is actually required to be looser about
Ada syntax rules than an Ada compiler.

Adding an "enforce strict rules" requirement could change the
lexer/parser design, especially if you place an emphasis on
good/helpful/useful error messages.

In addition, OpenToken (and FastToken) are intended for writing
grammar-based parsers quickly, not for getting the best possible
performance, or meeting other project-specific requirements. So the
design priorizes minimizing the amount of new code that must be written
for a new language.

> But '_' seems missing from "[-+0-9a-fA-F.]+". 

Oops; good catch. I would have found that in an ada-mode test,
but I'm not actually planning on using the Aflex lexer in Emacs.

> (And obsolete Ada syntax, i.e. substitutes for '#'. Which makes a CFG
> parser more desirable if '#' or ':' should have matching occurrences.
> ;-)

Emacs ada-mode explicitly ignores such things (at least until someone
asks for it).

-- 
-- Stephe

  reply	other threads:[~2015-06-17 17:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 13:08 OpenToken: Parsing Ada (subset)? Jacob Sparre Andersen
2015-06-02 22:12 ` Stephen Leake
2015-06-03  1:43   ` Shark8
2015-06-03  7:36     ` Dmitry A. Kazakov
2015-06-05  9:03       ` Stephen Leake
2015-06-05  9:23         ` Georg Bauhaus
2015-06-05 20:49           ` Shark8
2015-06-05 23:52             ` Dennis Lee Bieber
2015-06-05 12:20         ` Dmitry A. Kazakov
2015-06-16 12:43           ` Stephen Leake
2015-06-16 13:24             ` Dmitry A. Kazakov
2015-06-16 14:13               ` G.B.
2015-06-17 17:38                 ` Stephen Leake [this message]
2015-06-17 17:29               ` Stephen Leake
2015-06-17 17:42                 ` Shark8
2015-06-17 19:03                 ` Dmitry A. Kazakov
2015-06-05 20:53         ` Shark8
2015-06-16 14:46           ` Stephen Leake
2015-06-16 15:31             ` G.B.
2015-06-17 17:44               ` Stephen Leake
2015-06-16 21:34             ` Randy Brukardt
2015-06-17 17:58               ` Stephen Leake
2015-06-17 20:44                 ` Randy Brukardt
2015-06-18  7:51                 ` AdaMagica
2015-06-18  9:12                 ` Georg Bauhaus
2015-06-17 17:50 ` AdaMagica
replies disabled

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