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: 103376,a9bab26b6fe54a36 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!87.79.20.105.MISMATCH!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Pondering what rationale behind record type Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <90148303-4dc4-4c05-882f-88dd69a95494@z13g2000prk.googlegroups.com> <92quueFnsfU1@mid.individual.net> <4dc864b9$0$6890$9b4e6d93@newsspool2.arcor-online.net> <4dc90f7a$0$7659$9b4e6d93@newsspool1.arcor-online.net> <11dlfbvj00hru$.7zkw6im0a7gj$.dlg@40tude.net> <4dc92d14$0$6776$9b4e6d93@newsspool3.arcor-online.net> <14o3gst7h97px$.g6k9bn5b3p4q$.dlg@40tude.net> <9543fcbd-9035-45d3-8a5b-45592f927685@w10g2000yqa.googlegroups.com> Date: Wed, 11 May 2011 09:32:12 +0200 Message-ID: NNTP-Posting-Date: 11 May 2011 09:32:13 CEST NNTP-Posting-Host: beed5cce.newsspool3.arcor-online.net X-Trace: DXC=A]^AP>@QO1G78PK[oJ2ng@McF=Q^Z^V3H4Fo<]lROoRA8kFOW4edINK[6LHn;2LCVN7enW;^6ZC`D\`mfM[68DCCIL7_oDgOCII X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:19224 Date: 2011-05-11T09:32:13+02:00 List-Id: On Tue, 10 May 2011 19:28:16 -0700 (PDT), Shark8 wrote: > On May 10, 7:50�am, "Dmitry A. Kazakov" > wrote: >> >> What is the reason to name statements? > > Simple: to aid in readability. > I have a few rather deeply nested items where I'm tokenizing > PostScript > (due the rules of the language) and it is handy to have things like > -- Case C, When C '<' => > Read_Character( C, Input ); > HANDLE_LT: -- less than > if C = '<' then > Return Dictionary_Type; > elsif C = '~' then > Return String_Type; > else > Unread_Character( C, Input ); > Return -- I forgot what the last case, just '<', was... > end if HANDLE_LT; The above should have been a "case", or better matching the input against a token table with semantic callbacks doing things. > There's even a few in blocks where I handle things like > names ['identifiers'] vs. numbers; the PLRM defines a name > as a string of "regular characters which cannot be interpreted > as a string." This means that 23E4 is a number while 24F4 is > a name as are $4, 2i3, @, 2^4 and so forth. That is semantic analysis to me. No need to burden parser with that. You parse 23E4 as a token and later interpret it as an identifier or number. > It REALLY does help in sorting where you are in the decoding. I don't think that large "if"s is a good style. No names may help that. BTW, in your case "then", "else", "elsif" must carry the name of the "if" they belong. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de