comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Blaak <blaak@infomatch.com>
Subject: Re: Ada grammar
Date: 2000/05/09
Date: 2000-05-09T00:00:00+00:00	[thread overview]
Message-ID: <m366sn2h95.fsf@ns55.infomatch.bc.ca> (raw)
In-Reply-To: 004d942d.2e326cd2@usw-ex0104-026.remarq.com

bradders <bradNObrSPAM@england.com.invalid> writes:
> My company produces a UML based Real-time modelling tool. We
> generate and reverse engineer code for C, C++ and Java and soon
> we will be supporting Ada 95. Basically I need to be able to
> Parse Ada code to build up a symbol table and populate a class
> model.

Everyone is telling you to use ASIS, but I think you should go for it and parse
the sources directly. I have written both Ada parsers and UML reverse
engineering tools, and in my opinion things are a lot more manageable if your
tool does not require an ASIS-compliant Ada compiler to be installed.  Your
tool is more stand-alone and can work anywhere with a minimum of fuss (no
configuration issues to interface to a client's existing Ada compiler) if it
has minimal external dependencies.

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. A designer
playing with a UML model is not necessarily the same person as the programmer
compiling the Ada program.

The main reasons you want your own parser are:

- For design purposes you are interested a subset of the language and so can
  cut corners when parsing the uninteresting stuff (e.g. perhaps parsing
  routine bodies just enough to find the correct "end" token, but otherwise
  ignoring statements).

- 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)?

- Even if ASIS is "perfect" with regards to giving access to absolutely every
  character of the source, having your own parser gives you the freedom to
  tailor your parsing to fit the design of your tool, so you can get access to
  the desired source information in the most natural way.

  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.).

  This freedom of design is *the* reason to write your own parser.

An Ada parser is non-trivial, but its not *that* hard. Tedious maybe, but not
hard. The benefits are worth it, in my opinion, for a tool such as you are
describing.

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@infomatch.com                            The Rhythm has my soul.




  parent reply	other threads:[~2000-05-09  0:00 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-05  0:00 Ada grammar bradders
2000-05-05  0:00 ` Gautier
2000-05-05  0:00 ` Robert Dewar
2000-05-08  0:00   ` bradders
2000-05-08  0:00     ` Robert Dewar
2000-05-08  0:00       ` Ted Dennison
2000-05-08  0:00         ` Robert Dewar
2000-05-08  0:00           ` Ted Dennison
2000-05-09  0:00         ` Pascal Obry
2000-05-09  0:00           ` Samuel T. Harris
2000-05-08  0:00       ` baysinger
2000-05-08  0:00       ` Samuel T. Harris
2000-05-08  0:00     ` Ted Dennison
2000-05-08  0:00     ` David C. Hoos, Sr.
2000-05-08  0:00       ` Ted Dennison
2000-05-08  0:00         ` Tucker Taft
2000-05-09  0:00     ` Ray Blaak [this message]
2000-05-10  0:00       ` Ira D. Baxter
2000-05-11  0:00       ` Geoff Bull
2000-05-10  0:00         ` Ken Garlington
2000-05-11  0:00           ` dale
2000-05-11  0:00             ` Ken Garlington
2000-05-13  0:00           ` Robert Dewar
2000-05-11  0:00         ` Ray Blaak
2000-05-11  0:00           ` Ted Dennison
2000-05-13  0:00             ` Robert Dewar
2000-05-12  0:00           ` Geoff Bull
2000-05-12  0:00             ` Robert A Duff
2000-05-13  0:00               ` Robert Dewar
2000-05-30  0:00                 ` bradders
2000-05-30  0:00                   ` Robert A Duff
2000-05-12  0:00             ` Ray Blaak
2000-05-12  0:00               ` Samuel T. Harris
2000-05-05  0:00 ` tmoran
2000-05-05  0:00 ` Ira D. Baxter
2000-05-08  0:00 ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
1999-01-07  0:00 ADA grammar JamesO
1999-01-08  0:00 ` Tucker Taft
1999-01-08  0:00   ` Tucker Taft
1999-01-08  0:00     ` JamesO
1999-01-11  0:00     ` Tom Moran
1991-06-10 14:30 Orsi Jean-Christophe
1990-12-14 20:08 Ada grammar sivesh pradhaan
1990-09-06 21:03 ada grammar gene
1990-07-05 16:26 Ada Grammar Rindert Schutten
1988-02-04 19:57 ADA grammar Joe Gallagher
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox