Browse Prior Art Database

Method for Analyzing Abbreviated Combined Relational Expressions in COBOL

IP.com Disclosure Number: IPCOM000117584D
Original Publication Date: 1996-Apr-01
Included in the Prior Art Database: 2005-Mar-31
Document File: 4 page(s) / 101K

Publishing Venue

IBM

Related People

Kleon, GC: AUTHOR [+2]

Abstract

The COBOL programming language allows the abbreviation of combined conditional expressions under a set of well-defined rules. Parsing and analyzing logical expression thus becomes a more difficult task than in other programming languages, require more contextual inferences.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Method for Analyzing Abbreviated Combined Relational Expressions
in COBOL

      The COBOL programming language allows the abbreviation of
combined conditional expressions under a set of well-defined rules.
Parsing and analyzing logical expression thus becomes a more
difficult task than in other programming languages, require more
contextual inferences.

      Previous solutions to the problem of abbreviated combined
conditional expressions have been awkward and thus difficult to
understand, debug and maintain.  By marking a missing subject for a
relational operator, the semantics is keyed to search for a specific
subject.  If the relational operator is also missing, the semantics
is keyed by the value of the lone operand and then searches for both
the subject operand and operator.

      The proposed solution is to use an LL(k)-based parsing strategy
where the tool supports semantic hooks being added to the grammar.
Expression formation and precedence are then augmented to handle the
abbreviated expressions, producing trees which can be transformed by
semantic operations unrelated to the parsing action itself.  This is
far simpler than other methods in use and has proven to be easy to
implement, maintain, and document.

      The proposed solution is based on a parsing strategy centered
around the Syntax/Semantics Language tool for use in compiler
products.  S/SL provides a data-free method of specifying LL(k)
grammars and for tying semantic actions to specific points in the
parse.

      The specific grammar developed for the ILE COBOL/400 V3R1
compiler uses only minor modifications to the standard parsing
algorithms to capture the context-sensitive syntax of abbreviated
combined conditional expressions and to produce parse trees for
further semantic analysis and code generation.

      Expression precedence grammars are well understood.  The
general solution is to define levels of rules.  Thus, an expression
can be divided into one or more terms which can only be joined by
addition or subtraction operators to form the complete expression.
The term is similarly composed of one or more factors joined by
multiplication or division (or modulus) operators.  Factors are
further decomposable, and so on until a primary element is reached
which is either a value, a variable or a parenthesized expression.

      Grammars that allow cond...