Method for Analyzing Abbreviated Combined Relational Expressions in COBOL
Original Publication Date: 1996-Apr-01
Included in the Prior Art Database: 2005-Mar-31
Kleon, GC: AUTHOR [+2]
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.
Method for Analyzing Abbreviated Combined Relational
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
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.
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.
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
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.
precedence grammars are well understood.
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...