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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Thu, 12 Aug 2010 21:59:44 +0200 Organization: A noiseless patient Spider Message-ID: <878w4blhzj.fsf@ludovic-brenta.org> References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <87aap6wcdx.fsf@ludovic-brenta.org> <87vd7jliyi.fsf@ludovic-brenta.org> <699464f5-7f04-4ced-bc09-6ffc42c5322a@w30g2000yqw.googlegroups.com> <87k4nylb8c.fsf@ludovic-brenta.org> <4c617774$0$6765$9b4e6d93@newsspool3.arcor-online.net> <2610d347-27cf-4c88-ac18-84f73c7da858@h32g2000yqm.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 12 Aug 2010 19:59:44 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="79l6+2iEBh3kHi3l3eyPTw"; logging-data="21704"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19daM79knZcEnvJXNP1CaW0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:3Mw5lmipaYtxN2eO2jr00SEcTaI= sha1:ykQMOyPQangfpd/jA+5eIFHMkhg= Xref: g2news1.google.com comp.lang.ada:13189 Date: 2010-08-12T21:59:44+02:00 List-Id: Jeffrey Carter writes: > On 08/12/2010 12:53 AM, Ludovic Brenta wrote: >> * the parser also supports lists of the form (a b c) (more than 2 >> elements) and properly translates them to (a (b c)). The Append() >> procedure that does this is also public and available to clients. > > The example was something like > > (TCP-something (host abc) (port 42) ) > > So I think the grammar is > > S-expression = '(' Element {' ' Element} ')' > > Element = Atom | S-expression > > and you've implemented something slightly different. If I understand your quasi-BNF correctly, an S-Expression in your grammar can have only one or two, but not three elements. This contradicts the "(TCP-something (host abc) (port 42) )" example, which has three elements. In reality, an S-Expression (a "cons pair" in Lisp parlance) can indeed not have three elements; the notation (a b c) is, really, shorthand for (a (b c)); I was keen to implement that in my parser. See http://en.wikipedia.org/wiki/S-expression#Definition -- Ludovic Brenta.