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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.34.1 with SMTP id i1mr19740323ioi.117.1514311561302; Tue, 26 Dec 2017 10:06:01 -0800 (PST) X-Received: by 10.157.12.185 with SMTP id b54mr1178017otb.1.1514311561186; Tue, 26 Dec 2017 10:06:01 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!g80no2720416itg.0!news-out.google.com!b73ni10411ita.0!nntp.google.com!i6no2724141itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 26 Dec 2017 10:06:00 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=155.148.6.150; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 155.148.6.150 References: <2d87298a-4d1f-446a-9d46-d4f03879246b@googlegroups.com> <285de3c1-6c16-47b3-83b7-ec3419c8d324@googlegroups.com> <2c3f6378-1ec4-4128-ad61-a3bcdde49614@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Writing a scanner and parser in Ada From: Shark8 Injection-Date: Tue, 26 Dec 2017 18:06:01 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 3921590326 X-Received-Bytes: 3244 Xref: reader02.eternal-september.org comp.lang.ada:49647 Date: 2017-12-26T10:06:00-08:00 List-Id: On Monday, December 25, 2017 at 12:19:29 PM UTC-7, Dmitry A. Kazakov wrote: >=20 > The rationale is this. More powerful the formal language of patterns is,= =20 > more difficult it becomes for the user to foresee and understand what=20 > the pattern will match and what not. Regular expressions are already too= =20 > complex. SNOBOL patterns are even more powerful, so that anything beyond= =20 > trivial quickly becomes not understandable. I'm not sure that's true. Chapter 7 of "A Snobol4 Tutorial" from snobol4.or= g -- http://www.snobol4.org/docs/burks/tutorial/ch7.htm -- has as its first= example matching a list. ------------------------------------------------ Let's consider a simple example. We want to write a pattern to test for a l= ist. We'll define a list as being one or more numbers separated by comma, a= nd enclosed by parentheses. Use CODE.SNO to try this definition: ? ITEM =3D SPAN('0123456789') ? LIST =3D POS(0) '(' ITEM ARBNO(',' ITEM) ')' RPOS(0) ? '(12,345,6)' LIST Success ? '(12,,34)' LIST Failure ARBNO is retried and extended until its subsequent, ')', finally matches. P= OS(0) and RPOS(0) force the pattern to be applied to the entire subject str= ing.=20 Alternation may be used within ARBNO's argument. ------------------------------------------------ The above seems quite straightforward, and IMO, easier to comprehend than a= n equivalent regular expression. Especially because breaking out of the rea= lm of regular languages simply by making the definition recursive [LISTs th= at can contain LISTs] can be achieved simply by appending " | *LIST" to the= definition of ITEM. So, IMO, SNOBOL itself proves as a counterexample to your claim.