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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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 Path: g2news1.google.com!postnews.google.com!l20g2000yqm.googlegroups.com!not-for-mail From: Natacha Kerensikova Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Thu, 12 Aug 2010 13:11:48 -0700 (PDT) Organization: http://groups.google.com Message-ID: <10780482-22ed-400b-9aaa-a498f39c9d95@l20g2000yqm.googlegroups.com> 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> NNTP-Posting-Host: 95.152.65.220 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1281643908 7253 127.0.0.1 (12 Aug 2010 20:11:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 12 Aug 2010 20:11:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l20g2000yqm.googlegroups.com; posting-host=95.152.65.220; posting-account=aMKgaAoAAAAoW4eaAiNFNP4PjiOifrN6 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.3) Gecko/20100524 Firefox/3.6.3,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13190 Date: 2010-08-12T13:11:48-07:00 List-Id: On Aug 12, 8:55=A0pm, Jeffrey Carter wrote: > The example was something like > > (TCP-something (host abc) (port 42) ) > > So I think the grammar is > > S-expression =3D '(' Element {' ' Element} ')' > > Element =3D Atom | S-expression Actually a S-expression list can be empty, and a S-expression can be a single atom, or a list of atom, without parentheses. The grammar would be more something like: SP =3D TAB | SPACE | CR | LF -- whitespace S-expression =3D SP* (Atom | List)* SP* List =3D '(' S-expression* ')' Atom =3D Token-Atom | Quoted-String-Atom | Hexadecimal-Atom | Base64- Atom | Verbatim-Atom And the rest I'm not sure can be described by a grammar (especially verbatim encoded atoms), and that's without entering into details like brace encoding or display hints (which sucks anyway). The whitespace being optional because generally atoms don't need separators, token- encoded atoms being the exception (unfortunately all atoms from my example are token-encoded). Hoping it helps, Natacha