comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Text parsing package
Date: Mon, 28 Mar 2011 10:15:52 +0200
Date: 2011-03-28T10:15:52+02:00	[thread overview]
Message-ID: <1j2rym8p7nnpr$.6ov97ypbvrfe$.dlg@40tude.net> (raw)
In-Reply-To: op.vs01n5xgule2fv@index.ici

On Mon, 28 Mar 2011 02:15:31 +0200, Yannick Duchêne (Hibou57) wrote:

> Le Wed, 23 Mar 2011 09:32:10 +0100, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a écrit:
>> 1. Don't use unbounded strings. That is an unnecessary overhead.
> Yes, better limit the maximum size of literals.

The literal size is limited by the maximal line length

>> 3. As others have mentioned, it is a good idea to abstract the source
>> formats in order to be able to parse files, strings, streams etc.
> And Ada already provides a root for that: Ada.Streams.Root_Stream_Type

Unfortunately Root_Stream_Type is not an interface and string cannot be
inherited from. So in the effect you would need a special root.

>> 6. You should decide what drives the parser. In your case it is the caller.
>> That is not a good idea in most cases, because the caller rarely knows what
>> to expect next. A better choice is semantic call-backs from the parser to
>> the caller. Abstract primitive operations is IMO the best implementation of
>> such callbacks.

> What “drives”, is not just a question rising with parsers, it is rising  
> every where. Here, if Ada had something like a Yield, this would be nice  
> too.

Yes, it would be nice to have structured multiple co-routines as an
alternative to FSM. There are some cases where tasks look like an overkill.

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



  reply	other threads:[~2011-03-28  8:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 23:34 Text parsing package Syntax Issues
2011-03-23  3:01 ` Shark8
2011-03-23  6:29 ` Alex Mentis
2011-03-23  6:36 ` J-P. Rosen
2011-03-23  8:32 ` Dmitry A. Kazakov
2011-03-23 11:19   ` Syntax Issues
2011-03-28  0:15   ` Yannick Duchêne (Hibou57)
2011-03-28  8:15     ` Dmitry A. Kazakov [this message]
2011-03-28 10:18       ` Yannick Duchêne (Hibou57)
2011-03-28 12:08         ` Dmitry A. Kazakov
replies disabled

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