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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2ca464c92c72e0e9 X-Google-Attributes: gid103376,public From: "Ira D. Baxter" Subject: Re: Ada grammar Date: 2000/05/10 Message-ID: #1/1 X-Deja-AN: 621576364 References: <07a73f60.478cecce@usw-ex0102-015.remarq.com> <8euivq$qso$1@nnrp1.deja.com> <004d942d.2e326cd2@usw-ex0104-026.remarq.com> Organization: Posted via Supernews, http://www.supernews.com X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Newsgroups: comp.lang.ada X-Complaints-To: newsabuse@supernews.com Date: 2000-05-10T00:00:00+00:00 List-Id: Ray Blaak wrote in message news:m366sn2h95.fsf@ns55.infomatch.bc.ca... > bradders writes: > > I need to be able to Parse Ada code ... > > Everyone is telling you to use ASIS, but I think you should go for it and parse > the sources directly. > Certainly if one is reverse engineering Ada code, there is bound to be an Ada > compiler nearby, but that is not reason enough to require it. > The main reasons you want your own parser are: > > - You can do tricks that a normal parser cannot do, like play games with > whitespace, reconstructing comments, etc. (How good is ASIS at getting > perfect reconstruction of the source)? > > Consider, for example, that your tool might require all sources of a project > to be loaded simultaneously (i.e. if one is doing "interactive" > forward/reverse engineering from UML to code and vice versa). With your own > parser and parse trees you can optimize things to reduce space cost > (e.g. loading on the fly, indirect token references to the source file > instead of actually having contents in memory, etc.). The DMS Reengineering Toolkit has an Ada95 parser automatically builds compact ASTs that captures whitespace and comments "perfectly", and has built in prettyprinters for arbitrary reformatting and "fidelity printing", reproducing the original layout, or a mixture of the two. It can apply source-to-source transforms directly to the tree. The ASTs are cache-line aligned, typically occupy one cache-line per node, eliminate non-value bearing tokens and useless unit-reductions eliminated, list nodes for sequences, etc.) While we have not done this for Ada, we have read 3500 Java files (some 1.1 million lines) into a 1Gb address space under Windows/NT for analysis, and similar scale sources in COBOL, and don't see any reason why DMS can't do the same for large Ada suites. See http://www.semdesigns.com/Products/DMS/DMSToolkit.html. -- Ira Baxter, Ph.D., CTO idbaxter@semdesigns.com 512-250-1018x140 Semantic Designs, Inc., www.semdesigns.com FAX 512-250-1191 12636 Research Blvd #C214, Austin, Texas 78759