halley has asked for the wisdom of the Perl Monks concerning the following question:
My task is to do a bunch of UCA (unfamiliar code analysis) on several huge repositories of Ada95 and GNAT source code files. In UCA cases, we often don't know what a given program does, or what it might depend on, or even if it will build successfully. Rarely is there documentation to be found.
A very helpful technique I've employed in UCA missions involving FORTRAN and C++ is to partially parse each source file, and generate a call-tree graph. I then pump that graph through a color-coded GraphViz template. Some hand-tweaking of that graph can bring order from chaos, at least enough to figure out the scope of complexity and interaction in a given codebase.
I am not very familiar with Ada code in practice, but most of it can be read for the basics after a one-day primer on the web. The real and complete Ada language appears to be pretty darn tricky to parse, however, when you get into all of the various historical tweaks. The best LALR grammar I've found is Ada Home's Ada95 LALR Grammar. It's not complete, though, since some of the rule names are not actually defined here.
Before I go through the trouble of converting that LALR grammar to something that Parse::RecDescent can parse, even partially, I ask if anyone else has something better than the aforementioned grammar, for use with Perl. Even if it's not RecDescent, anything Perl would help immensely.
I'll publish the working PRD version if I have to build it myself. I wish there were a central place where people could publish useful PRD grammars, besides maybe the CPAN Inline:: namespace.
--
[ e d @ h a l l e y . c c ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parse::RecDescent Ada95 Grammar?
by Corion (Patriarch) on Mar 10, 2004 at 16:19 UTC | |
|
Re: Parse::RecDescent Ada95 Grammar?
by flyingmoose (Priest) on Mar 10, 2004 at 15:57 UTC | |
|
Re: Parse::RecDescent Ada95 Grammar?
by stvn (Monsignor) on Mar 10, 2004 at 19:02 UTC | |
|
Re: Parse::RecDescent Ada95 Grammar?
by Heretyk (Scribe) on Mar 11, 2004 at 00:28 UTC | |
|
Re: Parse::RecDescent Ada95 Grammar?
by Anonymous Monk on Mar 10, 2004 at 23:58 UTC | |
by ascetic (Novice) on Mar 11, 2004 at 00:15 UTC |