COBOL Compilers Using Yacc

cosivax! (Brian Renaud)
Wed, 25 Mar 87 13:50:33 est

          From comp.compilers

Related articles
COBOL Compilers Using Yacc cosivax! (1987-03-25)
| List of all articles for this month |

Date: Wed, 25 Mar 87 13:50:33 est
From: cosivax! (Brian Renaud)

In the UNICOM Conference Proceedings of January, 1983, there is an article
by Robert E. Conant and Herbert G. Mayer of Burroughs on their experiences
in implementing a COBOL compiler using lex and yacc. Many of their problems
were with lex (not surprisingly). Their summary of their parser problems

The first problem is that there is NO statement terminator.
How do you recover gracefully after finding an error? How do
you find the next statement? This problem was solved with
a simple heuristic which involves using a global variable for
communication between yacc and lex. A flag is set by yacc
which tells lex to deviate from its normal mode of operation
in which line terminators are ignored and tossed away, and
instead watch out for an end-of-line, and, when found, turn
the error state off and continue scanning.

Other things that needed to be dealt with included `dangling
else' (and `dangling other things') problems, and COBOL
lists (some types of which can have zero elements, some require
at least one element, and some require two or more!).

Basically, they said that yacc works reasonably well. The article is
29 pages long and probably worth reading before anyone attempts to do
the same thing themselves.

(UNICOM was a joint meeting of the Software Tools Users Group, the USENIX
Association and /usr/group.)

Brian Renaud, COSI, Inc.

uucp: ...!ihnp4!umich!cosivax!bdr
USmail: 313 N. First Street, Ann Arbor, MI 48103
voice: (313) 665-8778

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.