home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / ada / 3322 < prev    next >
Encoding:
Text File  |  1992-11-20  |  2.2 KB  |  59 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!noc.near.net!inmet!spock!stt
  3. From: stt@spock.camb.inmet.com (Tucker Taft)
  4. Subject: Re: GNU-NYU Ada project
  5. Message-ID: <1992Nov20.210232.27477@inmet.camb.inmet.com>
  6. Sender: news@inmet.camb.inmet.com
  7. Nntp-Posting-Host: spock
  8. Organization: Intermetrics Inc, Cambridge MA
  9. References: <1992Nov19.184504.22639@coe.montana.edu>
  10. Date: Fri, 20 Nov 1992 21:02:32 GMT
  11. Lines: 46
  12.  
  13. In article <1992Nov19.184504.22639@coe.montana.edu> 
  14.   dpoole@hydrogen.oscs.montana.edu (David Poole) writes:
  15.  
  16. >  One of the professors at my university posted this to our local newsgroup. 
  17. >I haven't seen anything here on this, so I thought I'd post it and see if
  18. >anyone can confirm/deny this report.  
  19. >
  20. >  A few things in this report seem a mite confusing.  It mentions the parser
  21. >running around 1,000,000 lines a minute on a 16 MHz 386.  Is this realistic? 
  22.  
  23. Yes.  That implies 60 micro-seconds per line, or roughly 500
  24. 386 instructions, which is sufficient to parse the average line 
  25. of source code in a well-written parser.  And this one is.
  26.  
  27. >Also, the parser uses recursive descent.  Why?  I thought LALR was the best
  28. >possible.
  29.  
  30. LALR is easier to construct, given a tool like YACC.  However,
  31. for raw speed, a well-written recursive descent parser can be about
  32. 50% faster than YACC (or even BISON).  In general, anything table-driven
  33. has to pay some overhead relative to hand-coding.  The procedure
  34. call overhead of recursive descent is not very great if the compiler
  35. passes parameters in registers.
  36.  
  37. Of course when the parser gets this fast, it becomes a miniscule
  38. part of the time spent in the compiler, so speeding it up by
  39. 50% might not be worth the extra hassle.  However, one additional
  40. nice thing about recursive descent is that it is easy to pass
  41. data up and down during the parse, and to keep local variables.
  42. To do this in YACC or BISON requires explicit stacks and/or parse-trees,
  43. which can be more work and more error-prone.
  44.  
  45. >-----------------------------------cut here--------------------------------
  46. >
  47. >          GNAT Project
  48. >          GNU-NYU Ada Translator.
  49. >
  50. >         GNAT Report 0001-921101
  51. >
  52. >            November 1, 1992
  53.  
  54. [etc...]
  55.  
  56. S. Tucker Taft  stt@inmet.com
  57. Intermetrics, Inc.
  58. Cambridge, MA  02138
  59.