From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a3b1adae5552af6d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Text parsing package Date: Mon, 28 Mar 2011 02:15:31 +0200 Organization: Ada @ Home Message-ID: References: <4fa6c081-910a-4e62-928a-0f6cdd1da951@l18g2000yqm.googlegroups.com> NNTP-Posting-Host: V1OIK4q3suj5TMnLVMs0MA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.01 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news1.google.com comp.lang.ada:18529 Date: 2011-03-28T02:15:31+02:00 List-Id: Le Wed, 23 Mar 2011 09:32:10 +0100, Dmitry A. Kazakov = a =C3=A9crit: > 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 implementati= on = > of > such callbacks. What =E2=80=9Cdrives=E2=80=9D, is not just a question rising with parser= s, 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 optimizati= on = is possible). -- = Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es= t pas pour = les chiens. =E2=80=9C c++; /* this makes c bigger but returns the old value */ =E2=80= =9D [Anonymous]