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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 5b1e799cdb,3ef3e78eacf6f938 X-Google-Attributes: gid5b1e799cdb,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.modula3,comp.lang.pascal.misc,comp.programming User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Sat, 25 Jul 2009 20:12:02 +0200 Message-ID: <16rswm4pb6uii.10jxcz4hoph5o.dlg@40tude.net> NNTP-Posting-Date: 25 Jul 2009 20:11:59 CEST NNTP-Posting-Host: c11d1860.newsspool3.arcor-online.net X-Trace: DXC=:X`40foY;RoUoRk[hk2WalMcF=Q^Z^V3h4Fo<]lROoRa^YC2XCjHcbi9W17=RC[jSaDNcfSJ;bb[eIRnRBaCd On Sat, 25 Jul 2009 13:39:49 -0400, Frank J. Lhota wrote: > Dmitry A. Kazakov wrote: >> On Fri, 24 Jul 2009 00:26:11 -0700 (PDT), tm wrote: >> >>> On 20 Jul., 17:14, Jean-Pierre Rosen wrote: >>>> Parsing is not the difficult part of an Ada compiler. >>> I once met somebody, who wrote the front end of an Ada compiler, and >>> he told me a different story. E.g.: He said that a special function >>> needs to read ahead just to find out the semantic of a parenthesis. >> >> There is no need to know the semantics of parenthesis in order to parse >> them. Semantic analysis is anther compilation phase. >> >> The only moderately difficult part of Ada that requires short look ahead >> are digraphs like "and then" (overloaded with "and"). There can be comments >> and new lines between "and" and "then" in the digraph. However it does not >> require any roll backs. > > IIRC "and then" is not that big an issue. The bigger issue is the two > uses of single quotes: they delimit character constants, and they are > used for qualified expressions. Consider an expression such as > > Foo'(',',',',',' ... ) The context where the apostrophe introduces a character literal is where an expression operand is expected, i.e. *before* an operand. The context where the apostrophe starts an attribute is always *after* an operand. If the parser is aware of the context there is no any problem at all, because only the infix operations switch the context and they are all fixed (+, -, *, / etc). No look ahead is needed, not in my parser of Ada 95. (Well, I forgot to mention another minor case of short look ahead. When matching integer literals the base may precede the value: 10#10#. I am too lazy to verify if _ is legal in the base specification, i.e. whether 1_0#10# is OK. If not then that might be also a negligible problem.) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de