home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!rutgers!cmcl2!acf3!schonber
- From: schonber@acf3.NYU.EDU (Ed Schonberg)
- Newsgroups: comp.lang.ada
- Subject: Re: GNU-NYU Ada project
- Message-ID: <61990006@acf3.NYU.EDU>
- Date: 23 Nov 92 01:22:00 GMT
- References: <1992Nov19.184504.22639@coe.montana.edu>
- Sender: notes@cmcl2.nyu.edu (Notes Person)
- Organization: New York University
- Lines: 39
- Nntp-Posting-Host: acf3.nyu.edu
-
- A few words of explanation about the figures in the GNAT progress
- report.
-
- The quoted performance (1,000,000 lines/min on a 16 mhz PC) is correct,
- but it is the performance of a syntax checker, not a parser, i.e. the
- recognizer does not build a parse tree. Apart from the parsing algorithm
- (more of that below) what is critical to this performance is the coding
- of the lexical scanner. It seems clear that this performance is not
- achievable with a table-driven system.
-
- Robert Dewar wrote the syntax checker precisely to compare the
- performance of a top-down parser with that of an LALR parser (in this
- case, a highly optimized system written by Philippe Charles, with table
- compression, and very effective error recovery). In addition to the
- more than order-of-magnitude performance gain, the top-down parser is
- much smaller (i.e. the total code is smaller than the LALR tables),
- and its error recovery of comparable quality.
-
- So why do people insist on the superiority of LALR methods? For one,
- because tools allow anyone to produce working parsers with relatively
- little effort. For another, because the Aho-Ullman text has been touting
- the advantages of LALR for a decade, mostly out of fondness for what are
- obviously very elegant algorithms. It is also said that error recovery
- methods are easier to build into LALR parsers, but this is obviously not
- the case: when parsing top-down you have a much better idea of what you
- are looking for, and it is easier to resynchronize. Finally, in the case
- of a language such as Ada, with a high density of keywords, it is very
- easy to write a top-down parser, and the actions per token are few,
- which explains the overall performance.
-
- Of course, writing a top-down parser by hand still requires reasonable
- skill and a close examination of the grammar of the language. but it
- nowhere as fraught with peril as the Dragon book makes it sound.
-
- Ed Schonberg
- GNAT project
- New York University
-
- schonberg@nyu.edu
-