home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume07 / yaccnots < prev    next >
Encoding:
Internet Message Format  |  1988-09-11  |  4.9 KB

  1. From emoryu1!arnold Tue Dec 16 10:42:42 1986
  2. Received: by mirror.TMC.COM (4.12/UUCP-Project/rel-1.0/08-20-86)
  3.     id AA27208; Tue, 16 Dec 86 10:42:32 est
  4. Received: by emoryu1.eu (5.51/5.6)
  5.     id AA29446; Mon, 15 Dec 86 11:02:20 EST
  6. Date: Mon, 15 Dec 86 11:02:20 EST
  7. From: emoryu1!arnold (Arnold D. Robbins)
  8. Message-Id: <8612151602.AA29446@emoryu1.eu>
  9. To: ejp@ausmelb.oz
  10. Subject: Re:  fyi (restarting yacc)
  11. Cc: arnold, mirror!rs
  12. Status: R
  13.  
  14. Mr. Pitt,
  15.     Rich Salz forwarded me a copy of your note, apparently in the
  16. spirit of technical correspondence where authors usually reply to questions
  17. on their published works.
  18.  
  19.     You raise some very valid points which I will address below. However,
  20. I should state that the posting was made with no surrounding context, largely
  21. due to the backlog in mod.sources -- the yacc stuff was sent to Rich several
  22. *months* ago. Had such context been available, many of your objections would
  23. have been answered.
  24.  
  25.     A while back on mod.compilers there was a discussion about restarting
  26. yacc; I volunteered to post the code that I had to do so, and to send it to
  27. mod.sources, which is the appropriate place to post sources; the posting just
  28. now made it out.
  29.  
  30. > Date: Fri, 12 Dec 86 11:22:56 est
  31. > From: Esmond Pitt <ejp@ausmelb.OZ>
  32. > To: mirror!sources-request
  33. > Subject: Re: v07i086:  Tools to restart YACC parses
  34. > In article <770@mirror.TMC.COM> you write:
  35. > >Submitted by: linus!gatech!emory!arnold (Arnold D. Robbins {EUCC})
  36. > >Mod.sources: Volume 7, Issue 86
  37. > >Archive-name: yacchacks
  38. > >
  39. > >
  40. > >[  The tools here provide a way to restart YACC parses to handle
  41. > >   conditional-compilation directives, include directives, and
  42. > >   from error states.  Good luck.  The "kclose" routine herein
  43. > >   can probably be more portable written with a dup()/fclose/fdopen
  44. > >   set of calls.  --r$  ]
  45. > >
  46. > >Arnold Robbins
  47. > >CSNET:    arnold@emory    BITNET:    arnold@emoryu1
  48. > >ARPA:    arnold%emory.csnet@csnet-relay.arpa
  49. > >UUCP:    { akgua, decvax, gatech, sb1, sb6, sunatl }!emory!arnold
  50.  
  51. Note that nothing of any mail that I sent to Rich was actually published,
  52. just his comments and my signature. That's probably ok, as I don't remember
  53. verbatim what I had sent him.
  54.  
  55. > I am puzzled by this posting.
  56. > Why on earth interrupt and restart a parser?
  57. > It is all most unnecessary.
  58. > Compiler-writers without such baroque minds have the lexical analyser
  59.                 ^^^^^^^
  60. No real need to be insulting. See my reasons, below.
  61.  
  62. > recognize and process include directives and conditional-compilation directives,
  63. > the latter by simply continuing to read through conditioned-out bits.
  64. > There is no need to consult, interrupt or deceive the parser at all.
  65.  
  66. There is indeed at least one quite valid reason: a cross referencer. I wrote
  67. a yacc-based cross referencer for a very extended version of Pascal that had
  68. conditional compilation; clearly the use of an identifier inside both halves
  69. of a conditional must be noted. In this case, the parse must be restarted
  70. when the other half of the condtional is seen.
  71.  
  72. I agree that for a real compiler it should indeed be done by the lexer, and
  73. the parser should never know about it.
  74.  
  75. > The only advantage of Robbins' scheme is that conditioned-out code
  76. > still gets parsed, so any errors are reported.
  77. > This is not stated anywhere in the posting,
  78. > nor the consequence that each grammar action, or the rest of the compiler,
  79. > needs to somehow ignore conditioned-out code.
  80. > Nothing in the posting implements such a control.
  81.  
  82. Again, the original code was not part of a real compiler; it grew out of
  83. a discussion in an entirely different newsgroup. All that was asked for
  84. was a way to restart a yacc parser; the unspoken assumption is that a compiler
  85. writer who is playing such a trick knows the consequences of what he's doing.
  86. Your point is valid; but I never claimed to be providing tools to do a whole
  87. job, just a certain, *specialized* piece of code.
  88.  
  89. > [ further discussion of the consequences if not done right ]
  90. > Robbins also does not sufficiently indicate the control syntax which
  91. > is implemented by his scheme.
  92.  
  93. Sorry; the syntax is in the lex code if you study it. It was:
  94.  
  95. {$ifc <conditon> then}
  96.     <pascal code>
  97. [ {$else}
  98.     <pascal code> ]        (* else part optional, of course *)
  99. {$endc}
  100.  
  101. > The whole thing is most unimpressive.
  102. > I thought moderators were supposed to moderate.
  103.  
  104. Again, really no need to be insulting; it is just a posting that was
  105. out of context and not a complete tool. I am sorry you weren't impressed,
  106. but I post source code to help out others who may find it useful, not
  107. to impress people with my wizardliness (or possible lack thereof).
  108.  
  109. > Esmond Pitt,                ACSnet: ejp@ausmelb.oz
  110. > Austec International Ltd,        UUCP: ...!seismo!munnari!ausmelb.oz!ejp
  111. > 344 St Kilda Rd,            ARPA: ejp%ausmelb.oz@SEISMO.CSS.GOV
  112. > Melbourne, 3004, AUSTRALIA.        Phone: +61 3 699 4511; Telex: AA38559
  113.  
  114. Arnold Robbins
  115. Emory University Computing Center
  116. UUCP:    seismo!akgua!emoryu1!arnold
  117. ARPA:    arnold%emoryu1@relay.cs.net
  118. Phone:    +1 404 727 4785
  119.  
  120.