comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Text parsing package
Date: Mon, 28 Mar 2011 02:15:31 +0200
Date: 2011-03-28T02:15:31+02:00	[thread overview]
Message-ID: <op.vs01n5xgule2fv@index.ici> (raw)
In-Reply-To: v6w93r8pxrcx$.b590s9zimz0o$.dlg@40tude.net

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.

> 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

> 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. Otherwise, yes, the callback is a good choice and may allow  
optimization, especially if some kind of seeking into the source is an  
expected option (the parser can then efficiently skip what is not  
relevant; on the opposite, if the caller drives, then no such optimization  
is possible).


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.
“ c++; /* this makes c bigger but returns the old value */ ” [Anonymous]



  parent reply	other threads:[~2011-03-28  0: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) [this message]
2011-03-28  8:15     ` Dmitry A. Kazakov
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