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,4cb1f8d1c17d39a8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.43.48.202 with SMTP id ux10mr19191951icb.6.1320409090653; Fri, 04 Nov 2011 05:18:10 -0700 (PDT) Path: p6ni70135pbn.0!nntp.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada 'hello world' for Android; success! References: <8239efcjuw.fsf@stephe-leake.org> <98ca5430-aa52-4e39-b789-70d0dd6adb46@d33g2000prb.googlegroups.com> <824nyrq5p6.fsf@stephe-leake.org> <4eac1ca1$0$7625$9b4e6d93@newsspool1.arcor-online.net> <82mxciogt0.fsf@stephe-leake.org> <4eafbc25$0$6575$9b4e6d93@newsspool3.arcor-online.net> <82mxcemscg.fsf@stephe-leake.org> <4eb1e241$0$7627$9b4e6d93@newsspool1.arcor-online.net> <8239e5mo9q.fsf@stephe-leake.org> <4eb31240$0$6549$9b4e6d93@newsspool4.arcor-online.net> Date: Fri, 04 Nov 2011 08:18:15 -0400 Message-ID: <82ty6kkrnc.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (windows-nt) Cancel-Lock: sha1:CUwf4Gbw2PYexBnXB1hCI1GyVQw= MIME-Version: 1.0 X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 672764eb3d802e029e66103252 Xref: news1.google.com comp.lang.ada:18826 Content-Type: text/plain; charset=us-ascii Date: 2011-11-04T08:18:15-04:00 List-Id: Georg Bauhaus writes: > On 03.11.11 12:36, Stephen Leake wrote: > >> In my opinion, this recursive descent style is much harder to >> understand. In particular, it is very difficult to see that the program >> structure matches the grammar structure. > > Yes, recursion does take getting used to. I am sketching a generator > that will remove the burden of writing the recursive subprograms. That would help a lot. I much prefer debugging tools to debugging individual applications; my effort is magnified by the number of times the tool is used. > Its input will be compatible with OpenToken's operator based notation. Excellent! > Example : constant Example_Rules.Grammar := Example_Rules.Null_Grammar and > S_Prime <= S and > S <= L & Equals & R and > S <= R and > L <= Asterisk & R and > L <= ID and > R <= L; > > procedure Produce_Subprograms (Position: Lists_of_Rules.Cursor); In current OpenToken, we have 'procedure Parse' instead of 'procedure Produce_Subprograms'; the rest is the same. I gather 'Produce_Subprograms' generates Ada code, that must then be compiled. I'm not clear what the benefit of this is over the current OpenToken approach. It avoids the run-time allocation currently in OpenToken, but since that's hidden from the user, and (presumably) fully tested/debugged, why does that matter? On the other side, LR parsing is much more efficient than recursive descent (except in special cases). One thing in OpenToken that really needs improving is the lexer. It is horribly inefficient compared to Lex. It does have the advantage of being much simpler to implement and test. -- -- Stephe