home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / compiler / 1405 < prev    next >
Encoding:
Text File  |  1992-08-18  |  2.5 KB  |  57 lines

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
  3. From: ejy@hrmsc.att.com (Eugene Yurek)
  4. Subject: Re: A Non-LALR(1) Parser Generator
  5. Reply-To: ejy@hrmsc.att.com (Eugene Yurek)
  6. Organization: AT&T
  7. Date: Tue, 18 Aug 1992 17:50:36 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-08-104@comp.compilers>
  10. References: <92-08-090@comp.compilers>
  11. Keywords: LR(1)
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 42
  14.  
  15. bromage@mullauna.cs.mu.oz.au (Andrew Bromage):
  16. >[are there non-LALR parser generators?]
  17. > D Pager has produced a few algorithms which may be of some use.
  18. >    ...
  19. > The first (ie simpler) algorithm was used in a parser compiler called
  20. > "LR", the availability of which I know nothing about.
  21. > It was reviewed in:
  22. > Wetherell and Shannon, "LR - automatic parser generator and LR(1) parser",
  23. > IEEE Transactions on Software Engineering, SE-7, pp 274-278, 1981.
  24.  
  25. I, at one time (I may still have the source laying around somewhere)
  26. played with a copy of the LR parser generator.  It is all written in
  27. Fortran (as I remember).  It accepts a somewhat preprocessed BNF
  28. (cannibalized) notation.
  29.  
  30. Charlie Wetherell originally wrote LR along with Shannon for some
  31. government entity they were either employed for or were working on a
  32. contract for, so, consequently, the entire source is in the public domain.
  33.  
  34. The source tape is available from the government (some program repository,
  35. though I can't remember which one).  It comes with a sample parser for the
  36. tables it generates.
  37.  
  38. This generator is not easy to use compared to YACC.  You cannot provide
  39. semantic actions within the grammar.  They must be handled in a separate
  40. source file, and manually tied back to the productions in the BNF (yuk!!).
  41. Basically, I'm saying that LR works well, however, its not that easy to
  42. use (though this is a subjective observation on my part). And as I said
  43. above, you're going to need a Fortran compiler, and some patience to use
  44. it.  It is, however, the only LR(1) parser generator that I've ever come
  45. across (please, no flames!!!).
  46. --
  47. Gene Yurek
  48. ejy@hrmsg.att.com    AT&T Bell Laboratories, Middletown, NJ
  49. [One of the reasons that yacc became so popular is that it let you put the
  50. action code next to the grammar rule to which it applies.  Until then all the
  51. parser generators I knew of required that you match up the rules and the code
  52. yourself. -John]
  53. -- 
  54. Send compilers articles to compilers@iecc.cambridge.ma.us or
  55. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  56.