Code Comments
Programming Forum and web based access to our favorite programming groups."William M. Klein" <wmklein@nospam.netcom.com> schrieb im Newsbeitrag news:GE4Bi.188127$jE4.178252@fe12.news.easynews.com... > Karl and Roger, > OK - I see your problem. There is the IMPLICATION that literals in the > "text manipulation stage" may not be constants, but it certainly isn't > explict. (I am more than happy to do a "defect report" on this - if > neither of you do.) > > The IMPLICATION is on page 31 where it is describing "text words" (what > the text manipulation stage deals with) where it says, > > "2) an alphanumeric, boolean, or national literal including the opening > and closing delimiters that bound the literal;" > > Therefore, (unlike numeric literals) I would INFER that something without > literal delimiters is NOT a "valid" literal in the text manipulation > stage. > > I believe that rule 10 on page 40 should be "expanded" to exclude > constant-names - and the same restriction should be applied to COPY and > REPLACE statements. Bill, Roger and all others, please accept my excuses to have troubled you all with the directives + constants problem - someone has already tackeled it: my colleague Susanne Hinz found, that in the WD1.7 for the next standard, syntax rule 2 of the constant entry has been refined to: "Constant-name-1 may be used anywhere, EXCEPT IN A COMPILER DIRECTIVE, that a format specifies a literal of the class and category of constant-name-1" This solves the problem at least partly, but I fully agree with Bill, that the same restriction should be applied to COPY! Pete, for understanding the problem, I can offer my personal interpretation of the standard: the standard defines only 2 stages of compilation, the 'text manipulation' followed by the 'compilation' - but these are not bindingly for a compiler, but rather a means for description of the COBOL language and a basis for the various rules. Nevertheless for me they define a natural separation: 1) the very first thing, before starting the real compilation, is to establish the source that is to be compiled; this is the only task of the 'text manipulation', especially selecting parts that are to be excluded from compilation due to directives, including/resolving COPY elements and performing the various replacements. 2) afterwards the real compilation can start working on this source and may be structured as various steps/passes beginning with a lexical analysis, followed by syntax analysis and so on - just as described in the 'dragon book'. Even though similar tasks are to be performed in both stages (some sort of lexical and syntax analysis is needed in the text manipulation stage in order to recognize directives, COPY and REPLACE statements), I think it is helpful to keep these stages separated, for instance to reduce complexity of tasks - but the standard does not force this separation upon a compiler! Karl Kiesel Fujitsu Siemens Computers, München
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.