This is a pretty complete "sketch" of how to do COBOL in precc. There's
not much missing but it is not intended to be a working grammar either.
This is a technical example.  If you csn compile it it passes the test.
The grammar is an IEEE standard - or at least that is what I was
following when I wrote it.

Beware - this dates from about 92/93.  What's more, I had to hack it
about now to remove irrelevant features.  It uses a lex generated lexer
instead of the default one that comes with precc and I found a layer
missing from the lex file; low-level non-terminals like "file_name" were
undefined.  I guessed plausibly and put the extras required into a
lex.y file.  I can't see anything very wrong, but no guarantees.  Check
it out.  I don't know COBOL.

The organisation of the grammar follows the natural style of the
language.  There is one file for each COBOL "divison"; ENVIRONMENT,
IDENTIFICATION and so on.  There is a also a file defining expressions.

You should also see from this how to join lex lexers up to a precc
grammar.  One or two functions like yywrap() may need to be defined
explicitly if lex doesn't generate them automatically - it varies with
the version of lex - along with some variables like yylval and yylen.  I
had to do that here.  If you don't define them the linker will
eventually try and get them from libcc1.a, with bad results if the
linker can't pick and choose from within a single object file within the
archive.  Mine can't.  If it gets one variable it tries to link in the
whole object, which locks out or "doubly defines" the functions like
yylex() that I wanted to replace with local versions generated by lex.

By the way, this parser doesn't actually DO anything. I don't even
have any business-oriented scripts to try it on. But it should compile.

PTB
