Copyright © 2007-2013


General Language Features

Programs

The principal ProSpecs components are Programs, which are independently executable units. Several programs can be simultaneously executed, although the way that execution proceeds is as a managed set of threads. Thread management is specially organised so that a group of interacting systems can be simulated in a repeatable manner described later under the Simulation sub-heading of the Special Language Features heading.

An individual program consists of one or more Structures consisting of Members and Procedures. Procedures consist of variables, Blocks and Statements (which can include embedded Blocks). The first procedure definition of the first structure definition of a program identifies the entry point for execution of the program.

Statements may require expression evaluations which can make use of one or more of the Built-in Functions available to the ProSpecs programmer, provided that the function used returns a value of the required type or one which can be converted to the required type.

An important feature of the language is that, with the exception of message fields, all its simple variables are untyped – i.e. can hold either a numeric or string value or a database record reference. Expression evaluations infer the expression type at compile time.

Messages and database references are described under Special Language Features.

Structures

A structure consists of member and procedure definitions and allows a simple inheritance capability between structures. A structure definition can specify parameters for which values must be supplied when an instance is created. A structure's members are unreachable if it does not contain at least one procedure definition.

A structure's procedures are the means by which its member values can be accessed – either to assign values or use existing values.

Members

The members of a structure consist of either named items passed in as structure parameters or local data names. Each parameter or local member name must be unique within that structure, although the same name can appear in different structure definitions. Members names can be defined to be arrays of values and as instances or arrays of other structures.

A structure's member values are globally visible within all procedure definitions for that structure. None of them are visible from another structure unless they are passed as parameters to the other structure or via a value returned by a procedure of the structure in which they are defined.

Procedures

A procedure is defined as a name, an optional parameter list and a block of statements. A statement may be a simple statement such as an assignment of a value or an embedded, conditional block of statements.

A procedure may use its members and the supplied procedure parameter values to perform computations which update member values and/or  return a value to the calling procedure. The parameters to a procedure and any return value can contain only simple values.

If a procedure call uses an expression as the actual parameter then a copy of its value is passed to that instance of the procedure execution. If it uses a variable then a reference to that variable is passed to that instance. In either case the local value in that instance can be modified, but on return only the case of pass by reference causes a change to the variable in the calling procedure.

Blocks

A block is a set of statements to be executed conditionally. There are several types of conditional block. The most conventional (i.e. like other programming languages) are if-then-else blocks, while blocks and case blocks. There are a few types of block definition specific to the ProSpecs Special Language described later.

A procedure call is a special case of causing a block of statements to be executed, in that it is executed unconditionally, it doesn't require the statements to be executed to appear immediately after the call and it can be passed an optional list of parameters.

Statements

ProSpecs provides a number of statements, categorised here into related groups.

Input/Output Control Statements allow loading and saving of grid and diagram files, saving or transmission of messages (see Special Language Features) and output of general report data..

Control Flow Statements allow statement execution to depart from sequential order of appearance (equivalent to break and return statements in other languages).

Data Change Statements allow modification of built-in global data values – e.g. initialisation the built-in random number sequence generator or selection of an open database source.

View Control Statements control diagram, grid and user input dialog parameters.

Trace Control Statements allow control of program trace facilities and data inspection for executing programs.

Built-in Functions

ProSpecs provides a large number of built-in functions, most of which are similar to built-in functions in other languages (mathematical, string and boolean functions).

There are in addition a number of special built-in functions specific to the ProSpecs Special Language Features like grids, databases, messages and diagrams

Includes

A ProSpecs include statement allows a definition file to be used (included) in more than one program. It identifies the name of a definition file which contains one or more complete structure or message definitions. It can appear wherever a structure or message definition is expected.

Trace Facilities

Prospecs provides a programmer specified pause, traceOn and traceOff statements.

A pause statementspecifies a pause number which helps the program user (usually a program developer seeking to test or debug a program) to inspect relevant grid, structure and message data fro that case, when the pause is executed.

The traceOn and traceOff statements delimit output to a trace report file of information about the execution path from the point where the traceOn is executed until the point where the traceOff statement is executed. The output identifies each pass through an iterative block and the actually executed sub-block of an if-then-else or case block.

The ProSpecs user specifies whether s/he wants trace output to be produced – and if it is not selected, traceOn and traceOff statements are ignored.

top of page