Welcome to version 0.2.1 of the SA (static analysis) system for Erlang. The system can be used in two modes; 1) to match specifications against Erlang modules and give warnings for potential errors, and 2) to extract type information from Erlang modules (without relying on specifications). Since the system uses some modules written by Richard Carlsson for reading and traversing Core Erlang code, I have included two of his files in the distribution. Unfortunately, due to various compatibility problems the system is not guaranteed to work with all versions of OTP. The most recent version of OTP that the system has been tested on is R13B-0. Please let me know if you run into trouble when running the system on a more recent version of OTP. To install, unpack and type 'make' inside the sa directory. To run the analysis you must first: 1) Start the Erlang system. 2) Make sure that the directory sa/ebin is included in the path, for example code:add_path("ebin"). if directory 'sa' your current directory. 3) Tell the analysis where the Erlang modules and the specification modules are. If directory 'sa' is your current directory, and any Erlang module you want to analyze is there, just write analyze:set_path([".", "standard-spec"]). (Now the analyzer will look for files in your current directory and in standard-spec.) If you want to extract type information from a module foo, write analyze:type_module(foo). This will create a file named foo.acc in the first directory mentioned in the analyze:set_path command. The file will contain entries of the form {function, {module, name, arity}, {, [, ..., ]}, }. Indicating the types of arguments and results of calls to this function. The last field , is used in case any of the types are complex (in particular, a recursive structure). If you want to check a module against a specification file, write analyze:check_module(foo). This assumes that there is 1) an Erlang file foo.erl, 2) a specification file foo.spec 3) specification files *.spec for each external module. Checking a module will give you a list of errors, if the analysis thinks (for example) that + an external function is called with the wrong arguments + a function in the module you are checking returns the wrong value + a function throws an exception Unfortunately, the system produces many warnings about exceptions. If you want to avoid these, use analyze:check_module(foo,[{quiet, true}]). The analysis will also give a presentation of what it has determined to be the possible values of arguments and results of functions mentioned in the foo.erl file, One day I will document the syntax used in the specification files. Until then, please refer to directories standard-spec (which contains specifications for some standard libraries) and SA/sa/Spec (which contains specifications for some modules of the analysis) for examples. Comments and questions are welcome. Sven-Olof Nystrom svenolof@it.uu.se