[mod.compilers] COBOL Compilers Using Yacc

johnl@ima.UUCP (03/25/87)

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
follows:

	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
net:	bdr@cosivax.umich.edu
USmail:	313 N. First Street, Ann Arbor, MI  48103
voice:	(313) 665-8778
--
Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.ARPA
Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | cca}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request