home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / fortran / 3045 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  6.0 KB

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!uw-beaver!zephyr.ens.tek.com!ogicse!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!burley
  2. From: burley@geech.gnu.ai.mit.edu (Craig Burley)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: What extensions do you use?
  5. Message-ID: <BURLEY.92Aug14160602@geech.gnu.ai.mit.edu>
  6. Date: 14 Aug 92 20:06:02 GMT
  7. References: <1992Aug13.004448.4409@ccu1.aukuni.ac.nz> <1992Aug14.101208.5407@aero.org>
  8. Sender: news@ai.mit.edu
  9. Organization: Free Software Foundation 545 Tech Square Cambridge, MA 02139
  10. Lines: 97
  11. In-reply-to: langer@aero.org's message of 14 Aug 92 10:12:08 GMT
  12.  
  13. In article <1992Aug14.101208.5407@aero.org> langer@aero.org (John V. Langer) writes:
  14.  
  15.            I hope and pray Craig Burley will include it in his new
  16.            compiler.
  17.  
  18. It [support for hollerith] is in the new compiler.  It pretty much went in
  19. from the beginning.  What I'm unsure of is just how much support for
  20. hollerith I have vs. how much is needed.  It's there for DATA, and for
  21. some other places as well.  I guess that's what the upcoming alpha test
  22. will do, among other things: help find what needs to be added to make
  23. the compiler useful.  (For example, it doesn't yet support IMPLICIT
  24. UNDEFINED, because that isn't the extension I'm familiar with.  It does
  25. support IMPLICIT NONE.  Presumably if somebody wants the former, they'll
  26. be willing to send me a detailed spec on how it works so I can implement
  27. it _once_.  :-)
  28.  
  29. However, GNU Fortran currently doesn't try and support any "reserved name"
  30. extensions with one exception (selectable when compiling it) -- DEC's
  31. weird PARAMETER statement (what does "PARAMETER X = 3.0" mean?).  That is,
  32. disambiguation via the technique "gee, it _looks_ like an XYZ statement,
  33. so I'll assume it's that instead of an assignment or whatever" isn't in
  34. GNU Fortran.  It's easy to add, but I think for now it is even easier to
  35. just see whether people are able to change code so their programs start
  36. out with "REAL FUNCTION FOO()" rather than "REAL FUNCTION FOO" (GNU Fortran
  37. will assume the latter is a type declaration of a REAL variable named
  38. FUNCTIONFOO) and so on, _then_ decide what kinds of reserved-name
  39. disambiguations are really needed.  (Of course, the standard reserved name
  40. of "END" in a particular context is _always_ detected by GNU Fortran, since
  41. at its heart, it really wants to be a standard-conforming compiler. :-)
  42.  
  43. One of the problems of all these extensions is that the vendors who supplied
  44. them didn't do a very good job of describing, in detail, just how they fit
  45. into the language, and without their compilers available to me to attempt
  46. to figure it out, I can only guess.
  47.  
  48. For example, what does the following statement do?
  49.  
  50.       REWIND 2H=X
  51.  
  52. Since a unit number corresponding to hollerith "=X" seems absurd, I'm
  53. assuming it's an assignment statement.  But it could be a REWIND statement.
  54.  
  55. Also, some compilers (and GNU Fortran) support typeless constants of the
  56. form 'nnnn'O (for Octal).  They also support inline comments.  What is
  57. to be made of a statement like:
  58.  
  59.       X = '200   ! Is this a comment or part of a char string?
  60.      &   'O
  61.  
  62. The GNU Fortran front end has to decide as soon as it sees a given token
  63. whether the next token will be "literal" (as in character-string) or
  64. "normal" (ignore spaces and comments).  If comments are supported within
  65. typeless constants as they are (at least in GNU Fortran) in constants of
  66. the form O'nnnn', GNU Fortran wouldn't be able to figure all cases out
  67. properly.  And I don't know what various vendors would do.  The above
  68. case is fairly easy to guess (though GNU Fortran complains because the
  69. comment is considered an invalid part of an octal number), but what about:
  70.  
  71. C                                                                   column
  72. C                                                                      72
  73. C                                                                       |
  74. C                                                                       |
  75. C                                                                       v
  76.       CALL                                                       FOO('1!'
  77.      &'O)!')
  78.  
  79. Is this "CALL FOO('1'O)" or "CALL FOO('1!''O)!')" (the latter passing a
  80. character string with the value "1!'O)!")?  GNU Fortran currently always
  81. chooses the latter, since it lexes what comes after the first apostrophe
  82. as a character string and doesn't try and relex if that produces a parsing
  83. or semantic error.
  84.  
  85. As you can see, this is the kind of thing that drives me straight up the
  86. wall, and that's why, aside from the extensions I had decent (yet not entirely
  87. adequate) specs on, I have so far avoided adding things willy-nilly until I
  88. can really _see_ just how they fit into the language.  (This gets back to the
  89. precisionless constant controversy as well, since I know of no completely
  90. detailed spec for how precisionless constants work, and don't want to attempt
  91. to do _my_ version of them without knowing what others who say they want the
  92. feature _mean_ by saying that -- in precise terms.  And I'd much prefer to get
  93. paid for that work anyway, since I don't particularly like the feature yet.)
  94.  
  95. Even supporting pure ANSI FORTRAN 77 has its difficulties.  I uncovered bugs
  96. not only in my front end when I started integrating with the GNU back end but
  97. also in AT&T's f2c program, especially in regards to the fifty different ways
  98. to parse a READ statement, depending on things like the phase of the moon,
  99. whether you use a 1040, 1040A, or 1040EZ tax form, etc.  :-)  Add vendor
  100. extensions to the mix, especially given that most of them seem to have been
  101. hastily added (syntactically speaking) to address a short-term need and got
  102. ensconsed as long-term solutions because of "compatibility", and things get
  103. really hairy.  I don't want to even _think_ about things like CRAY pointers
  104. and Fortran 90 just yet.  I'll probably feel better about things once a
  105. beta release happens.  (Don't ask me when that'll happen, just send cash. :-)
  106. --
  107.  
  108. James Craig Burley, Software Craftsperson    burley@gnu.ai.mit.edu
  109. Member of the League for Programming Freedom (LPF)
  110.