|Why is Cobol ignored in compiler textbooks? firstname.lastname@example.org (Trevor Jenkins) (1992-04-20)|
|Re: Why is Cobol ignored in compiler textbooks? nickh@CS.CMU.EDU (1992-04-21)|
|Re: Why is Cobol ignored in compiler textbooks? email@example.com (1992-04-22)|
|Re: Why is Cobol ignored in compiler textbooks? firstname.lastname@example.org (1992-04-22)|
|Cobol picture data email@example.com (Eric Jacobsen) (1992-04-22)|
|Re: Why is Cobol ignored in compiler textbooks? firstname.lastname@example.org (1992-04-23)|
|Re: Cobol picture data email@example.com (1992-04-23)|
|Re: Why is Cobol ignored in compiler textbooks? firstname.lastname@example.org (1992-04-23)|
|Re: Why is Cobol ignored in compiler textbooks? email@example.com (1992-04-24)|
|[4 later articles]|
|From:||firstname.lastname@example.org (Preston Briggs)|
|Organization:||Rice University, Houston|
|Date:||Wed, 22 Apr 1992 00:58:51 GMT|
Trevor Jenkins <email@example.com> writes:
>Taking a survey of the compiler text books I have on my shelf I noticed
>that none discussed the problems of compiling Cobol.
Are there any problems that are unique to COBOL? Most compiler texts pick
a representative language and use it as a running example. A few pick
features from different languages and try to cover the problem space. I
didn't know COBOL offered any especially different problems.
>Some specific problems which compiling Cobol raises are the possiblity
>that sections and paragraphs may be executed sequentially or may be
>PERFORMed as if subroutines.
I guess I'd always compile them (sections and paragraphs that are the
target of a PERFORM) as if they were nested subroutines (a la Pascal or
Algol). That is, never flow directly in and out; instead always call
them. If loss of optimization becomes an issue, duplicate the code,
compiling one chunk inline and one as a subroutine. Probably have to be
careful to avoid excessive code growth.
>Also, the _problem_ of the ALTER verb changing the target of a GO TO.
This is the same problem (I think) as the ASSIGNED GOTO in Fortran. Of
course, that's not much help since most people don't discuss that either!
To us (optimizer people at Rice), the problem is that ASSIGNED GOTO can
make it difficult to construct an accurate control-flow graph. The
situation can be improved by noting which labels are ASSIGNED. Additional
precision might be obtained by using a variant of Wegman and Zadeck's
constant propagation algorithms, modified to propagate lists of labels.
>There are others to do with data representation which go beyond any
>representational problem that might arise with Algol-related languages.
I'm suprised, but perhaps I'm just ignorant of the subject. It looks like
a lot of tedious (but conceptually simple) handling of nested structures.
What are the problems?
>This surely is not a good state of affairs given the major investment in
>programs written in Cobol throughout the world. Or is it that I am missing
>a textbook or two in which Cobol IS discussed in the same detail as
I think the point of textbooks is to introduce compiler writing, not to
show to write a compiler for any particular language. There are some
counter-examples; but I think they're wrong-headed. A good compiler jock
should be able to build a compiler for whatever language or machine comes
along. Sometimes (usually?) it will be difficult and there may be tough
problems. I guess you either find them in the literature (usually
specific papers rather than general books) or you solve them yourself.
Papers I can recall about COBOL include
Design of a separable transition diagram compiler
CACM 6(6) 1963 (mostly parsing?)
Experience with porting techniques on a COBOL 74 compiler
Proceedings of the Sigplan '72 Symposium on Compiler Construction
(mostly portability problems, including EBCDIC and ASCII)
and the COBOL chapter in the History of Programming Languages. This is
mostly history, but includes a large bibliography that you may want to
[One issue I haven't seen addressed is Cobol picture data, which has a
numeric value in a numeric context and a string value in a string context.
Do you keep two copies, one copy and convert on demand, or what? -John]
Return to the
Search the comp.compilers archives again.