Table of Contents Previous Chapter 6 Verifying a System

6 Verifying a System

Verifying a system means checking that its SDL description obeys the syntax and semantic rules as defined in the Z.100 recommendation (some syntax checking is performed by the SDL Editor at editing time). The SDT Analyzer tool allows you to perform a complete syntactic and semantic check of an SDL system. This chapter describes the Analyzer and how you may use it to verify an SDL system. For a reference to the Analyzer commands and the Analyzer functionality and restrictions, see chapter 31, The Analyzer.

General Description

The Analyzer's main task is to perform syntactic and semantic analysis of SDL-92 definitions and diagrams. You may perform full syntactic and nearly full semantic analysis of complete system definitions.

Analysis of separate units (block, process, substructure, service, and procedure) is also supported.

Syntactic analysis may be performed on a unit, while restricted semantic analysis of a unit may only be performed if the context of the unit is provided. The context is the enclosing units and their definitions (for a detailed description, see the section "Separate Analysis" on page 1562 in chapter 31, The Analyzer).

The Analyzer works in a number of passes:

Figure 156 : Analyzer Passes. 
-----
(fig)  
       
-----
  1. GR to PR conversion. This pass is needed when input is SDL-GR diagrams. The result is a PR file with a "raw" layout, that is submitted as input the next pass. This file is not intended to be read by the human.
  2. Macro expansion. This pass is needed when input contains references to macros (which need to be expanded). The result is a PR file where SDL macros are expanded.
  3. Lexical and syntactic analysis. This pass checks that the input follows the SDL definition with respect to syntactic rules. During this pass, the Analyzer builds an abstract syntax tree that is stored in main memory and that is used by the following passes.
  4. Pretty-printer. This optional pass produces an SDL-PR file with a nice layout, suitable for reading and understanding by the human.
  5. PR to GR conversion. The input PR files are translated to SDL-GR diagrams, that you may open in an SDL Editor. This pass allows you to for instance import PR files from other tools than SDT.
  6. Semantic analysis. During this pass, the Analyzer checks that your SDL diagrams obey the semantic rules as defined in the Z.100 recommendation.
  7. After the semantic analysis pass, you may optionally generate cross-references listings of SDL entities. The result from this pass is a file which contents may be displayed graphically in the Cross Reference Viewer tool.
  8. If your configuration includes a Code Generator(1) you may include:

Analyzer Input and Output

The input to the Analyzer consists of SDL-92 specifications, that is, SDL-GR diagrams that are stored using SDT's storage format, or SDL-PR files, or a combination of both.

The output consists mainly of PR files, error and warning messages. These messages are presented on the screen in a log window and may be stored on file.

It is also possible to obtain a pretty printed SDL-PR file of the input and to transform SDL-PR files into SDL-GR diagrams.

The Analyzer Modes

The Analyzer can be run in one of two modes:

Graphical Mode

When started from the SDT Organizer with the Analyze command, the Analyzer takes advantage of SDT's graphical user interface and integration mechanism.

For instance:

Stand-alone Mode (Textual Mode)

When started up from the OS prompt, the Analyzer will operate in stand-alone mode. The Analyzer uses the input and output devices currently defined on your computer, which provide a textual, command-line based user interface.

No graphical support is provided when running the Analyzer in this mode.

More about the Analyzer Tools

This section provides additional information about the functionality in the various Analyzer tools.

The GR to PR Converter

The GR to PR converter obtains graphical information (SDL-GR) from the Organizer and translates it to text form (SDL-PR). The PR is stored on a text file which is later on read by the parser during the macro expansion or the lexical analysis pass. This PR file is not intended to be read by humans. It is not formatted for that purpose. See "The GR to PR Converter" on page 1557 in chapter 31, The Analyzer in the Reference Manual for a more thorough description.

A number of checks are performed during the GR-PR conversion pass. Many of these are actually syntactic in their nature. They may result in error messages. See "Error and Warning Messages" on page 1579 in chapter 31, The Analyzer.

The Macro Expander

The Macro Expander reads the input file, replaces all macro calls with the corresponding macro definitions and generates a text file containing the expanded specification. The macro expansion is only necessary if the SDL specification contains macro calls and macro definitions. All macro definitions referenced in macro calls within the specification must be present in the file that is to be expanded. See page 1560 in chapter 31, The Analyzer for a more complete description of the Macro Expander.

The syntax checks made in the macro parser are entirely specific to macros since no other checks are possible prior to expanding all macro calls. Some semantic checks are performed already during the expansion. These may produce error messages. See"Error and Warning Messages" on page 1579 in chapter 31, The Analyzer.

The Lexical and Syntactic Analyzer

The scanner (lexical analyzer) reads the input file and passes on lexical units to the parser. The parser checks the syntax and builds an internal representation (an abstract syntax tree) for the SDL specification.

The lexical and syntactic analysis may be performed not only on complete system definitions, but also on the following SDL units:

If no errors are found during the syntactic analysis, the syntax tree can be passed to the pretty-printer and, if the input is a system definition, to the semantic analyzer. Additional description is provided in the sections "The GR to PR Converter" on page 1557 in chapter 31, The Analyzer. For a description of the errors that can produced, see "Error and Warning Messages" on page 1579.

The PR to GR converter

The PR to GR converter transforms SDL phrasal form (SDL-PR) into SDL graphical form (SDL-GR). The result is stored on files which contents can be accessed by and displayed in the SDL Editor. See also section "The PR to GR converter" on page 1564 in chapter 31, The Analyzer and "Automatic Layouting of Diagrams" on page 1269 in chapter 23, The SDL Editor.

The PR to GR converter requires syntactically correct PR files as input.

The Semantic Analyzer

The semantic analyzer checks that the specification, which must be a system or a package definition, obeys the static semantic rules of SDL. During this analysis phase, the analyzer builds and uses a symbol table which can also be used later on by the Code Generators. The errors that are detected during this pass are described in section "Error and Warning Messages" on page 1579.

As another result of the semantic analysis, reports that contain textual lists of definitions of SDL entities and references to these entities can be produced. These listings hold information about where the entities are defined in an SDL system, and where they are used (referred). Furthermore, they can be processed and displayed by a graphical viewing tool, The Cross Reference Viewer.

The Pretty Printer

The pretty-printer uses the abstract syntax tree to generate a text file containing the SDL specification in pretty printed PR form, easy to read and understand by the human. The generated text file contains the original SDL specification formatted according to the layout rules in the pretty-printer. Macros are expanded however.

Code Generators

The C Code Generator

The C Code Generator (which may be included in your SDT configuration or not) translates the information produced by the Analyzer into a C program, which can be compiled with a compiler (preferably) supporting ANSI-C. Precompiled libraries are delivered together with the C Code Generator, allowing you to use the generated C code for various purposes, such as simulation of the dynamic behavior of your SDL system, generation of applications on your host computer and generation of applications running on host or target computers.

The C Code Generator is technically a part of the Analyzer's binary file. It is however managed as a separate tool in SDT and its functionality is documented in dedicated chapters in this manual.

The SDL to CHILL Translator

The SDL to CHILL Translator, (which may or may not be included in your SDT configuration), translates the information produced by the Analyzer into a CHILL program, which you compile with a CHILL compiler. A precompiled library is delivered together with the CHILL Translator, allowing you to use the generated CHILL Code for generation of applications.

The C Code Generator is technically implemented as a module contained in the Analyzer's binary file. It is however managed as a separate tool in SDT and its functionality is described in chapter 38, The SDL to CHILL Translator.

The Cmicro Code Generator

The Cmicro Code Generator translates your SDL system into an optimized "C" program with a compact code size and highly reduced memory requirements. This is made possible by imposing a few restrictions on the use of SDL. The restrictions are acceptable in the application area, which covers the small to mid-range microcomputer controlled applications.

The Cmicro Code Generator is technically implemented as a module in the Analyzer's binary file. It is however managed as a separate tool in SDT and its functionality is thus described in a dedicated chapter in this manual; see chapter 44, The Cmicro Generator.

The CSDL Code Generator(2)

The CSDL Code Generator translates your SDL system into a CSDL program that you can use as input to the CSDL tool. The CSDL Code Generator is designed to make it possible to simulate the same SDL system with SDT, that later is translated to an application using CSDL.

The X Code Generator

The Analyzer is prepared to support additional code generators. The X Code Generator is a generic name for these future extensions.

The X Code Generator has no meaning in a standard SDT configuration.

Using the Analyzer

This section describes how you operate the Analyzer from the Organizer, in an SDT-3 environment. We will discuss topics related to the various ways you may analyze an SDL structure. With SDT, you may for instance perform syntax check on an SDL structure or check an entire SDL system with respect to the semantic rules.

Analyzing using Default Options

To analyze an SDL structure using default options:

  1. In the Organizer Diagram Structure area, select the root node for the subtree that is the subject to be input to the Analyzer.
  2. Click the quick button for Analyze. The Organizer first checks if there are any unsaved diagrams; if any, the Organizer will prompt you to save these before analyzing them (since the Analyzer operates on the latest saved copy of a diagram).

  3. The Organizer determines what diagrams need to be analyzed and what passes need to be run, by looking at the time the diagrams were saved on file and by monitoring the Analyzer's work. In the case no analysis is needed, you will be informed of this and the operation is cancelled:
    Figure 157 : No Analysis is Needed. 
    -----
    (fig)  
           
    -----
    
  4. The analysis job is submitted the to the Analyzer, using the options as they are currently defined in the Analyzer options dialog (see Figure 158 on page 312).
  5. From now on, the status bar reads "Analyzer working". When done, the status bar will read "Analyzer ready".

Analyzing using Customized Options

To analyze an SDL structure with

  1. In the Organizer Diagram Structure area, select the root node for the subtree that is the subject to be input to the Analyzer.
  2. From the Organizer's Generate menu, select the Analyze command. The Analyzer Options dialog is displayed.
    Figure 158 : The Analyzer Dialog. 
    -----
    (fig)  
           
    -----
    
  3. Adjust, if required, some of the Analyzer options to their required values. These options govern what passes should be performed by the Analyzer, see Figure 156 on page 303, and what output should be produced by the Analyzer. (The code generation pass options are however not controlled from this dialog.)
  4. Click the Analyze button. First, the Organizer checks if there are any unsaved diagrams; if any, the Organizer will prompt you to save these before analyzing them (since the Analyzer operates on the latest saved copy of a diagram).
  5. The Organizer determines what diagrams need to be analyzed and what passes need to be run, by looking at the time the diagrams were saved on file and by monitoring the Analyzer's work. In the case no analysis is needed, you will be informed of this and the operation is cancelled:
    Figure 159 : No Analysis is Needed. 
    -----
    (fig)  
           
    -----
    
  6. The Analyzer is initialized and starts executing (this is indicated in the Organizer status bar which now reads "Analyzer working").
  7. When the Analyzer has analyzed the input as specified in the options, the Organizer status bar reads "Analyzer ready". The results of the analysis are reported in the Organizer log window.

Performing Syntax Check

  1. If the input contains SDL macros, you should expand these before proceeding with the syntax analysis. in the resulting SDL-PR file.
  2. Turn the Syntax check button on to include the syntax checking pass.
  3. Click the Analyze button.

Performing Semantic Check

Turn the Semantic check button on to include the semantic check pass. This option cannot be turned on unless you the Syntax check pass is enabled. The semantic checker may be set up with by a number of options, each one individually activated by a toggle button.

Checking Output Semantics

The Check output semantics option controls whether to issue warnings when SDL signal sendings, where the semantics is different in SDL-88 and in SDL-92, are detected. These warnings are particularly valuable when the input consists of SDL diagram that were designed in SDL-88 (for instance with SDT 2.X).

Detecting Not Used Definitions

The Check unused definitions option, when turned on, orders the Analyzer to report definitions that are not used (for instance variables that are declared but neither written or read).

Checking Unique References

When the Check references option is activated, the Analyzer will check that each remote definition is referred only once. Turn this button off to disable this check.

Generating a Cross Reference File

Turn the Generate a cross reference file option on to have the Analyzer generate a file with a list of definitions and references to SDL entities, as an supplementary result from the semantic pass. You may also want to specify another file name than the suggested one. The contents of this file may be read and visualized graphically with the Cross References Viewer tool.

Checking for Deep Expressions

Adjust the Expression depth parameter to specify the depth limit that the Analyzer should check for when evaluating expressions. Expressions which depth exceed the specified limit will be reported. Where possible, try to break down deep expressions since they require advanced calculations and slow down the Analyzer.

Specifying the Error Limit

Adjust the Error limit parameter to an adequate value (drag the slider for coarse adjustments, click left or right on the bar for fine adjustments). The Analyzer will stop its execution once this error limit has been reached.

Specifying a System Instance

You may specify the appropriate definition of the blocks contained in the system you are analyzing.

One definition indicates that a block contains process definitions. The other definition indicates that a block contains a block substructure definition. If a system contains any block with two versions, several system instances exist, and before interpretation a selection between the two versions must be made for each such block in the system.

The System instance field allows you to enter the SDL qualifier of your choice, as illustrated in the following example:

Example 9 : A System Instance  
  

Locating and Correcting Analysis Errors

The results of the Analyzer are appended to the Organizer Log Window. (You may save the window contents on any file at any time). The results of the last run are also saved on a file with the predefined name analyzer.err

SDT provides a nice feature for displaying the source of an analysis error:

  1. Locate the Organizer Log window (use the Organizer Log command to raise the log window if required).
  2. Select the error (or warning) message by dragging the mouse.
    Figure 160 : Selecting an Error Message. 
    -----
    (fig)  
           
    -----
    
  3. Select the menu choice Show Error from the Tools menu.
  4. The symbol where the error has been detected is displayed in an SDL Editor window. When the reference also contains a line and a column reference, the text cursor is placed on the line and column of text where the error was detected.
  5. If additional explanations are needed to understand the error message, select the Help on Error command from the Tools menu to display the manual page where to read about the error and the probable cause.

Producing a Pretty-Printed SDL-PR File

You may produce a pretty-printed PR file with the Analyzer, with a single command. The layout used by this PR makes it easy to read by the human. You may either submit SDL diagrams or SDL-PR files as input to the pretty-printer.

To be able to pretty-print SDL-PR, SDT requires that the input must be syntactically correct. If the input does not fulfil this requirement, SDT will however produce a PR file with a "raw" layout. This file is used by SDT as a temporary file and is does not address the human reader.

  1. In the Organizer Diagram Structure area, select the root node of the SDL structure to be pretty-printed (this node may be another one than the root node in the Diagram Structure).
  2. From the Generate menu, select the Convert to PR menu choice. The Convert to PR dialog is displayed:
    Figure 161 : The Convert to PR dialog. 
    -----
    (fig)  
           
    -----
    
  3. Adjust, if required, the conversion options:
  4. An output file where the resulting SDL-PR code will be stored is suggested. You may specify any other file to store the results on in the Destination PR file name text field.
  5. If the input contains SDL macros, you may want to expand these in the resulting SDL-PR file.
  6. Click the Convert button to close the dialog and have the Analyzer start the conversion to SDL-PR.

Converting SDL-PR to SDL-GR

You may convert SDL-PR files to SDL-GR diagrams, storing them on files using SDT's native format. Once converted, these SDL descriptions may be managed, edited and printed by SDT's graphical tools as if they were created using SDT.

To convert an SDL-PR file to SDL-GR diagrams:

  1. From the Organizer's Generate menu, select the command Convert to GR. A dialog is displayed:
    Figure 162 : The Convert PR to GR Dialog. 
    -----
    (fig)  
           
    -----
    
  2. Specify the PR file to convert from. You may either type the file specifier or click the folder button to issue a Standard File Selection Dialog.
  3. Specify the destination directory, where to store the results of the conversion. You may either type the name of a directory or click the folder button to issue a directory selection dialog.
  4. You may specify other options:
  5. If required, click the Analyze Options button to modify the Analyze options (typically, you may need to turn the Macro Expansion option on). Close the Analyze Options dialog with the Set button (see Figure 158 on page 312).
  6. Click the Convert button to order the conversion. The Organizer's status bar reads "Analyzer ready" when the conversion is completed.
  7. To look at the resulting diagrams, you may either open the resulting files in the SDL Editor.

Importing SDT-2 Analyzer Options Files

In SDT-2, the Analyzer options were stored on dedicated Analyzer options files (the files with the default file extension .san). In SDT-3, the Analyzer options are stored on a System File.

When you familiarized yourself with SDT-3, it is likely that you (or one of your colleagues) did import SDT-2 diagrams to build an SDL structure that can be managed by the Organizer.

When importing diagrams into the Organizer, an option, titled Import SDT-2 Analyzer options file controls whether or not to import (when applicable) the contents of an SDT-2 Analyzer options file into a system file.

Figure 164 
-----
(fig)  
       
-----

Footnotes

(1)
Although technically built into the Analyzer binary executable (sdtsan), the Code Generators are additional optional tools that are licensed separately.
(2)
CSDL is a trademark of Italtel. The CSDL Code Generator is not available in standard SDT configurations and is just mentioned for the sake of completeness.
 
Table of Contents Next Chapter