Newsgroups: | comp.compilers |
From: | adrian@platon.cs.rhbnc.ac.uk (A Johnstone) |
Keywords: | parse, errors, LL(1), LR(1) |
Organization: | Univ. of London, Royal Holloway College. |
References: | 94-09-142 94-09-180 |
Date: | Tue, 4 Oct 1994 08:28:29 GMT |
: (You'll have to excuse me, but I'm an unabashed believer in both automated
: techniques, e.g. LALR parser generators, and in formality when it comes
: to grammar specifications... and I have been for a long long time. These
: days however, everyone seems to be saying that recursive descent is better
: for error recovery, and that's rather disconcerting to me. I mean... I mean...
I just wanted to comment on the implied suggestion that RD parsers
militate against formality. Just because RD parsers are simple enough
to write by hand doesn't mean that ll(1) and ll(k) parser generators
don't exist (cf RDP and especially PCCTS). Personally I have always
been an RD convert for the very simple reason that debugging output
from LALR generators is a nightmare. When you are developing a new
language, as opposed to hacking in someone else's C grammar this is a
real issue.
IMHO LALR was originally justified because LALR grammars are `easier'
to write, not requiring left factoring. However, the advantages
disappear PDQ when you need to start adding semantic actions, which
often ends up requiring factoring... In addition, error recovery
certainly is a whole lot easier in RD parsers. On top of all that,
YACC's basic BNF syntax makes grammars much larger than they need to
be anyway.
Perhaps LALR became so popular simply because YACC was always there, free
with Unix, itself a free (once, to academia) operating system. My motto
has always been `beware de facto standards'.
Adrian (biased author of an RD parser generator)
--
Dr Adrian Johnstone, Computer Science Dept, Royal Holloway, University of London
Email: adrian@dcs.rhbnc.ac.uk Tel: +44 (0)784 443425 Fax: +44 (0)784 443420
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.