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.36.36.197 with SMTP id f188mr16578392ita.37.1514228236106; Mon, 25 Dec 2017 10:57:16 -0800 (PST) X-Received: by 10.157.12.185 with SMTP id b54mr1047931otb.1.1514228236025; Mon, 25 Dec 2017 10:57:16 -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!peer03.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!g80no2479571itg.0!news-out.google.com!s63ni4384itb.0!nntp.google.com!i6no2483032itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 25 Dec 2017 10:57:15 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.114.57.218; posting-account=yfhumQoAAACUMOSAPBmheMxZJWoNg1wi NNTP-Posting-Host: 174.114.57.218 References: <2d87298a-4d1f-446a-9d46-d4f03879246b@googlegroups.com> <285de3c1-6c16-47b3-83b7-ec3419c8d324@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2c3f6378-1ec4-4128-ad61-a3bcdde49614@googlegroups.com> Subject: Re: Writing a scanner and parser in Ada From: Yves Cloutier Injection-Date: Mon, 25 Dec 2017 18:57:16 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 2983839564 X-Received-Bytes: 2462 Xref: reader02.eternal-september.org comp.lang.ada:49640 Date: 2017-12-25T10:57:15-08:00 List-Id: On Monday, December 25, 2017 at 12:08:38 PM UTC-5, Dmitry A. Kazakov wrote: > On 2017-12-25 17:35, Yves Cloutier wrote: > > > Yes my Perl version does all that in 1 pass, but one of the things I > > want to do is have it generate for different targets. Groff was my > > initial one. I wan't creating any kind of AST but I think I'll want to > > do that in my rewrite to make things simpler and allow for generating > > for other targets like maybe Latex, or epub etc... > > You don't need AST for that. Simply define code generator interface > (tagged) with abstract operations generating pieces of code. For each > target have a derived type implementing these operations. Pass a > class-wide Target object as a parameter to the parser. If the actual is > of Groff_Target the result is groff etc. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de haha I'm quite new to Ada so most of what you just explained I don't quite understand. But will get there. Baby steps. I see that you created a SNOBOL-like pattern matcher. This looks really useful for processing text.