CPSC 681 seminar, Spring 1997

Monday, February 24, 1997
The GRAD System, Legacy Languages and Python OO Language
Dr. Charlie Fly, Rockwell
The Grammar-based Rapid Application Development (GRAD) system is an interface
generator between Python and Legacy Languages.

The key concepts used in the development of GRAD are:

   1) The interface is based upon a grammar for the legacy language.

      This makes the interface generator language independent.  It is possible
      to build interfaces to multiple languages.  It is also possible to run
      multiple languages from one application (say C++ and FORTRAN together)

   2) The Legacy code does not have to be modified in order for the interface
      to work.

      No superclasses or include files are added to the legacy code.  This has
      a long term effect.  The legacy code is not dependent (directly) on the
      interface.  Consequently, changes in the interface generator do not
      require changes in the legacy code.

      Changes to the legacy code require the regeneration of the interface.

   3) The interface is automatically generated.

      No manual editing of the generated interface is needed.  So the interface
      generation can be made a part of the make process.

      When the legacy code changes, the interface to it changes.  A side effect
      of this is the Python script which utilizes the altered interface needs
      changing also.  The GRAD system ultimately will provide a processor to
      locate Python scripts on the system, find the lines which are affected
      and notify the owner of the script of the change.

   4) The interface is interactive and interpretive even though the legacy
      system is not.

      Objects can be created on the fly from the Python command line.  The net
      result is a new object in the legacy language environment and a shadow
      object in Python which is named and holds the address of its counterpart.

   5) The generated interface eliminates the need for most application-specific
      I/O schemes.

      Direct creation of legacy objects from the Python command line or script,
      means that most input schemes to initialize a system can be replaced by
      a set of Python statements which accomplish the initialization providing
      a standard interface across a user's applications.

GRAD is implemented in Python.  It consists of two major components:

   1) A compiler generator which builds a parser for a legacy language.

   2) A compiler/interface generator which parses legacy code using the parser
      provided the compiler generator producing the `glue code' to effect the

When the interface is ready, it utilized by importing the python interface
module which in turn loads the object code and legacy language interface code.

As part of the testing of GRAD, a set of classes, called PATHS, has been
created to model the paths found in most languages.  The parser created by the
compiler generator is used by the PATHS classes to build a tree of path objects
corresponding to the logic of the legacy code.  Currently the C++ parser
implemented for GRAD only processes declarations but work to begin in the near
future will extend the parser to full C++ grammar coverage. The generated Paths
tree can generate a near-minimum set of test specifications that cover 100% of
the paths.  These specifications can be used to manually generate tests that
provide 100% path coverage.

The PATHS classes also provide a scheme for instrumenting the legacy code to
track path coverage.  So existing test cases can be run on the legacy system
showing the paths hit by the tests.

PATHS is being extended with Value Dependency Graphs.  VDGs were origionally
developed for compiler optimization, but are being used to accomplish the
restatement of expressions in a Legacy language in terms of the external
driving data.

The combination of Paths with Value Dependency Graphs provides the information
necessary to generate test cases automatically.  A set of conditional
expressions constitute a set of simultaneous equations which are solved to
provide a set of external driving values that cause the conditionals to be
evaluated to TRUE or FALSE as necessary to follow the logical path.

Finally, GRAD is to be utilized as the underlying test bed allowing automatic
access to all publically accessible attributes and methods.  This simpifies the
generation of the test cases which are emitted in Python.  The test suite can
be built early in the development cycle and evolved as the code matures.

Please note that everyone is invited and welcome to attend the seminars in this series