analysis

Current release: analysis 0.1.7 (requiring CMDsyntax 0.91)

Note

This project has been discontinued. Further work in this area has been carried out as part of the development of the micropython source code analysis and compilation toolchain.

Introduction

The analysis distribution is primarily a package containing code which performs source code analysis on Python programs. In addition, a number of tools are supplied which can produce program summaries and programs in other languages. The process of source code analysis typically involves the following steps:

  1. The acquisition of an abstract syntax tree (AST) using the compiler package.
  2. The annotation of the AST through the propagation of object type information and the specialisation of functions.

Whilst function specialisation is done in a more naive fashion than other, similar packages (notably Shed Skin), the results of an analysis activity may still describe a program's run-time behaviour fairly accurately. However, in order to limit the complexity of the analysis process as well as any generated programs, certain restrictions may be imposed which could cause certain Python programs either to be modelled differently or be regarded as inappropriate for analysis/specialisation; such restrictions may be similar to, although potentially narrower in scope than, those in other projects (particularly Shed Skin and RPython).

Copyright and Licence

The analysis software is licensed under the GPL. See the file COPYING.txt and LICENCE.txt files in the docs directory in the distribution.

Examples

The tests directory in the distribution contains a number of Python source files. By running the tools/docgen.py program on these files, a collection of HTML summaries is obtained.

Note that many Web browsers are unable to display the interesting part of the summaries: the pop-up elements which describe the types and invocation targets associated with various nodes. Currently, only Konqueror 3.4.0 (from KDE 3.4.0) actually displays such elements properly.