Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!think.com!mintaka!spdcc!iecc!compilers-sender From: henry@zoo.toronto.edu (Henry Spencer) Newsgroups: comp.compilers Subject: Re: Recursive Descent Parsers and YACC Keywords: yacc, parse, design Message-ID: <1990Nov17.220536.24965@zoo.toronto.edu> Date: 17 Nov 90 22:05:36 GMT References: Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: henry@zoo.toronto.edu (Henry Spencer) Organization: U of Toronto Zoology Lines: 26 Approved: compilers@iecc.cambridge.ma.us In article melling@psuvax1.cs.psu.edu (Michael D Mellinger) writes: >Can someone give me an estimate on how much faster parsing can be made by >writing a recursive-descent parser instead of using Yacc and Lex? Is there >enough of a difference to consider using a RDP in a commercial C compiler? >... >[It is my distinct impression that yacc parsers work fairly quickly. >Particularly on machines with slow procedure calls, they can be faster than >recursive descent... Of note here is the recent EUUG paper from Ken Thompson on the Plan 9 C compiler. (This is a small, fast compiler generating quite good code.) He uses a yacc parser, but says that the compiler spends a lot of time parsing and he thinks a recursive-descent parser would be substantially faster, now that the compiler and the language (which has some changes from orthodox C) have settled down. He also notes that using the manufacturer's fancy "call" instruction is usually a bad idea, since a stripped-down one (fortunately both the VAX and the NS32k series have such) is generally much faster. His assessment of relative speeds probably assumes an efficient call sequence. -- Henry Spencer at U of Toronto Zoology henry@zoo.toronto.edu utzoo!henry -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.