comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Practicalities of Ada for app development
Date: Wed, 13 Jun 2012 10:37:54 +0200
Date: 2012-06-13T10:37:54+02:00	[thread overview]
Message-ID: <4fd85162$0$9515$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <89e137c8-45b1-48a3-8d15-3a15d8796af0@googlegroups.com>

On 13.06.12 02:04, Adam Beneschan wrote:

> Maybe this should be a challenge to the Ada community to come up with some common package specification (or set of packages) that would be sufficient to meet those needs, so that users wouldn't feel a need to switch to Perl to get the same kind of expressive power.  Offhand, I don't think it would need to become part of the official language standard (the letters I, S, and O are not a magical incantation that automatically makes software more trustworthy).  We've had working groups in the past that have developed standard packages that weren't part of the language (although some of them became part of later versions of the language, like Ada.Numerics).  What does anyone else think?  Does this seem worthwhile?  I have to admit, I've sometimes been frustrated when I need to work with text, although not enough to get me to use Perl for more than smallish programs, so off the top of my head this seems like it might be useful.

I like the "sufficient for most needs" part very much. It allows
going back to just regular languages.


This is my wishlist for a framework supporting regular languages
built around language features familiar to Ada programmers:

1. The building blocks in Ada.Strings.Maps, Ada.Strings.Maps.Constants
etc seem to correspond to character classes in POSIX REs:

   Hexadecimal_Digit_Set ~[0-9A-Fa-f]

Yet, the set operations of Maps exceed what I get in RE packages
of languages that start from version 7 regexp. Good!

So, alternation is presently possible for single characters.
Need groups and sequencing, expressed in the type system.

2. The container mechanics (Ada STL) offer one possible approach
to handling the set of matches:
The matching process results in an object of type that supports
iteration.  Perhaps not just Cursors, but also Extended_Index
like in Vectors, because programmers will expect that
groups in patterns are indexed by number.

3. The pattern matching facilities need not go beyond
regular languages. Provide some frequently used constant
patterns, such as end-of-line, start-of-string, word-boundary.

4. Add a single, read-only feature for RE inspection. It allows
observing the scanning process:

For example, given (ABC|BCD)E, and a function "&" returning
a pattern type,

   Alternation'(To_Set ("ABC") & To_Set ("BCD"))
      & To_Pattern ("E");

Here, it might be helpful to see the backtracking (if any) triggered
when the scanner is about to hit "E". Therefore, allow programmers
to implement an abstract pattern type that matches the empty
string. The scanner will call its primitive subprogram,
thus

   Alternation'(To_Set ("ABC") & To_Set ("BCD"))
     & user_defined_empty_1
     & To_Pattern ("E");

5. Define a small set of well chosen operators that reduce
verbosity.  (GNAT's Spitbol.Patterns has quite a lot of them.)

6. Producing new text from input text should not physically rely
on Ada.Strings.Unbounded. Instead, allocate new strings that can
clean up after themselves.


In conclusion, programmers would rely on Ada's type system when expressing
a pattern. They would not be forced to write in yet another macro
language in strings, as is required by most scripting languages.
Access to matched portions of input uses a familiar framework.



  parent reply	other threads:[~2012-06-14 20:43 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 20:48 Practicalities of Ada for app development wrp
2012-06-08 21:35 ` Jeffrey Carter
2012-06-09  0:40   ` Adam Beneschan
2012-06-09  6:38     ` Jeffrey Carter
2012-06-21 17:14       ` Randy Brukardt
2012-06-21 18:16         ` Adam Beneschan
2012-06-21 19:18           ` J-P. Rosen
2012-06-21 20:30             ` Adam Beneschan
2012-06-21 21:09               ` Randy Brukardt
2012-06-22  4:59                 ` Simon Wright
2012-06-22  5:32                   ` Tero Koskinen
2012-06-22 19:51                     ` Randy Brukardt
2012-06-21 21:15               ` J-P. Rosen
2012-06-22 10:43               ` Tero Koskinen
2012-06-21 21:00           ` Randy Brukardt
2012-06-21 21:18             ` J-P. Rosen
2012-06-22 19:55               ` Randy Brukardt
2012-06-23  6:43                 ` J-P. Rosen
2012-06-09  4:30   ` BrianG
2012-06-09  7:11   ` Georg Bauhaus
2012-06-13 10:20   ` quiet_lad
2012-06-09  6:55 ` gautier_niouzes
2012-06-09  7:04 ` Georg Bauhaus
2012-06-09  9:25 ` Nomen Nescio
2012-06-09  9:36   ` Dmitry A. Kazakov
2012-06-10  3:46     ` Yannick Duchêne (Hibou57)
2012-06-12 20:10     ` i3text
2012-06-13  7:55       ` Dmitry A. Kazakov
2012-06-21 17:21         ` Randy Brukardt
2012-06-13 10:28     ` quiet_lad
2012-06-13 13:07       ` Dmitry A. Kazakov
2012-06-09 16:09   ` tmoran
2012-06-13 10:29     ` quiet_lad
2012-06-09 23:18   ` darkestkhan
2012-06-10  3:56     ` Yannick Duchêne (Hibou57)
2012-06-10 14:04     ` Dmitry A. Kazakov
2012-06-10 16:51       ` Yannick Duchêne (Hibou57)
2012-06-10 17:00         ` Dmitry A. Kazakov
2012-06-10 17:18           ` Yannick Duchêne (Hibou57)
2012-06-10 19:33             ` Dmitry A. Kazakov
2012-06-10 21:36               ` Nomen Nescio
2012-06-11  8:22                 ` Dmitry A. Kazakov
2012-06-11 14:27                   ` Georg Bauhaus
2012-06-11 14:43                     ` Dmitry A. Kazakov
2012-06-11 16:19                       ` Jacob Sparre Andersen
2012-06-11 18:38                         ` Dmitry A. Kazakov
2012-06-11 17:14                       ` Georg Bauhaus
2012-06-11 18:38                         ` Dmitry A. Kazakov
2012-06-11 20:50                           ` Georg Bauhaus
2012-06-11 21:43                             ` Yannick Duchêne (Hibou57)
2012-06-12  7:55                             ` Dmitry A. Kazakov
2012-06-12  9:48                               ` Georg Bauhaus
2012-06-12 11:44                                 ` Dmitry A. Kazakov
2012-06-12 12:17                                   ` Georg Bauhaus
2012-06-12 12:18                                     ` Dmitry A. Kazakov
2012-06-11 18:29                 ` Adam Beneschan
2012-06-11 19:16                   ` Jeffrey Carter
2012-06-11 21:47                   ` Yannick Duchêne (Hibou57)
2012-06-21 17:39                     ` Randy Brukardt
2012-06-21 17:34                   ` Randy Brukardt
2012-06-10 18:15       ` darkestkhan
2012-06-10 19:25         ` Dmitry A. Kazakov
2012-06-11  6:34         ` Jacob Sparre Andersen
2012-06-21 17:41         ` Randy Brukardt
2012-06-10 15:49   ` Shark8
2012-06-10 17:04     ` Yannick Duchêne (Hibou57)
2012-06-10 19:47       ` Dmitry A. Kazakov
2012-06-11  0:37         ` Nasser M. Abbasi
2012-06-11  8:37           ` Dmitry A. Kazakov
2012-06-12  6:24             ` Yannick Duchêne (Hibou57)
2012-06-12  7:59               ` Dmitry A. Kazakov
2012-06-13 10:35         ` quiet_lad
2012-06-13 13:09           ` Dmitry A. Kazakov
2012-06-14  3:21             ` quiet_lad
2012-06-14  7:58               ` Dmitry A. Kazakov
2012-06-14  8:39                 ` Yannick Duchêne (Hibou57)
2012-06-14  9:26                   ` Dmitry A. Kazakov
2012-06-21 17:51                   ` Randy Brukardt
2012-06-11  0:00     ` Nasser M. Abbasi
2012-06-11  3:23       ` Jeffrey Carter
2012-06-11 21:10         ` Nomen Nescio
2012-06-11 21:55           ` Adam Beneschan
2012-06-12  8:07             ` Nomen Nescio
2012-06-12 15:28               ` Fritz Wuehler
2012-06-12 21:34                 ` Nomen Nescio
2012-06-14 11:12                   ` Nomen Nescio
2012-06-21 18:01                   ` Randy Brukardt
2012-06-12 21:12             ` Nomen Nescio
2012-06-13  0:04               ` Adam Beneschan
2012-06-13  3:04                 ` Shark8
2012-06-13  8:21                   ` Dmitry A. Kazakov
2012-06-13 18:21                     ` Shark8
2012-06-13 19:11                       ` Dmitry A. Kazakov
2012-06-13 22:01                         ` Yannick Duchêne (Hibou57)
2012-06-14  8:02                           ` Dmitry A. Kazakov
2012-06-14  9:10                             ` Yannick Duchêne (Hibou57)
2012-06-14  9:33                               ` Dmitry A. Kazakov
2012-06-21 18:10                                 ` Randy Brukardt
2012-06-13  8:35                 ` Yannick Duchêne (Hibou57)
2012-06-13  8:37                 ` Georg Bauhaus [this message]
2012-06-13 10:14                   ` Georg Bauhaus
2012-06-11 22:49           ` Jeffrey Carter
2012-06-13 10:31     ` quiet_lad
2012-06-13 12:57       ` Maciej Sobczak
2012-06-14  4:18         ` quiet_lad
2012-06-14  7:35           ` Ludovic Brenta
2012-06-14 10:02             ` Georg Bauhaus
2012-06-12 19:17 ` i3text
2012-06-12 19:52 ` Vadim Godunko
2012-06-27 18:39 ` Eryndlia Mavourneen
2012-06-27 18:46 ` Eryndlia Mavourneen
2012-06-28 13:23   ` Simon Wright
replies disabled

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