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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a270a1fc28d4f812 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-26 11:17:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr13.news.prodigy.com.POSTED!3bae8248!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: OOD in Ada? References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 67.115.106.18 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr13.news.prodigy.com 1025115380 ST000 67.115.106.18 (Wed, 26 Jun 2002 14:16:20 EDT) NNTP-Posting-Date: Wed, 26 Jun 2002 14:16:20 EDT Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: [[PGGTSDZRRQBQH]]RKB_UDAZZ\DPCPDLXUNNHLIWIWTEPIB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN Date: Wed, 26 Jun 2002 18:16:20 GMT Xref: archiver1.google.com comp.lang.ada:26719 Date: 2002-06-26T18:16:20+00:00 List-Id: > ... build my class heierarchy all deriving from a single base class > ... Note that this pretty much circumvents any type safety ... I can't phrase it well, but this bother me. In parsing, you have a bunch of terminals and non-terminals and a base non-terminal (something like "program"). So make a base class of Non_Terminal with children like "Declarative_Part", "Expression", "Term", etc. That's the general paradigm for a parser. Then you have a particular grammar that says that an Expression can have a Statement as a constituent (in the OP's case), or that a Term can be followed by an Adding_Operator, and so forth. It seems to me overdoing things to try to use the Ada type system to encode particular syntax rules, especially when you consider that a particular grammar may change due to changes in the language, or to arrange to call semantic routines at more convenient times, or whatever.