Browse Prior Art Database

Generating Test Programs Using PL/I Macros

IP.com Disclosure Number: IPCOM000082479D
Original Publication Date: 1974-Dec-01
Included in the Prior Art Database: 2005-Feb-28
Document File: 2 page(s) / 13K

Publishing Venue

IBM

Related People

Seaman, RP: AUTHOR

Abstract

A set of macros and a random generator are provided. Any context-free grammar of a programming language expressed in Backus Normal Form (BNF) may be written as calls of these macros. Weighting factors which specify the limits of choice are included in the macro calls. The resulting macro defined program is loaded as a source into a macro preprocessor which generates a PL/I source program. The execution of this program generates random strings of text satisfying the original grammar.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 54% of the total text.

Page 1 of 2

Generating Test Programs Using PL/I Macros

A set of macros and a random generator are provided. Any context-free grammar of a programming language expressed in Backus Normal Form (BNF) may be written as calls of these macros. Weighting factors which specify the limits of choice are included in the macro calls. The resulting macro defined program is loaded as a source into a macro preprocessor which generates a PL/I source program. The execution of this program generates random strings of text satisfying the original grammar.

For performing context sensitive operations, particular PL/I logic statements can be included between macro calls.

The macros provided are named CHOSE, SEVERAL, LIST, JOIN, HEAD, ENDR, ANSWER.

The transforming of BNF rules into calls of these macros is illustrated by the following examples. Each rule is written in the following way.

1. The left-hand side of the rule is expressed in the HEAD macro, e.g., HEAD (DCLSTMT).

This is followed by the definition part of the rule using the CHOSE, LIST etc. macros. The end of the rule is indicated by the ENDR macro.

2. Where a production rule specifies alternatives, the macro CHOSE is invoked. The arguments are the various alternatives and weighting factors for each alternative, e.g., CHOSE ('DCL', 1, 'DECLARE', 1) This means DCL or DECLARE will be generated in the ratio 1:1. If it were desired to make 'DCL' twice as common in generated programs as 'DECLARE', the first 1 in the above macro call should be changed to 2.

3. Where a production rule specifies a list of items (... notation) the macro SEVERAL is invoked. The first argument is the item to be repeate...