From: | SM Ryan <wyrmwif@tsoft.org> |
Newsgroups: | comp.compilers |
Date: | 24 Jun 2005 09:55:16 -0400 |
Organization: | Quick STOP Groceries |
References: | 05-06-111 |
Keywords: | parse, LALR |
Posted-Date: | 24 Jun 2005 09:55:16 EDT |
Chris F Clark <cfc@shell01.TheWorld.com> wrote:
# Vit wrote:
# > I only wonder, have not languages designers become cleverer in the
# > recent decades to invent languages that do not require the full
# > strength of LR(k)?
#
# SM Ryan:
# > Why not just use LR(k)? Inertia? Methods to avoid the combinatorial
# > explosion of lookaheads have been known for years.
#
# Many practical languages are both LALR(1) and nearly LL(1) (LL(k <=
# ~4) with some hacks to handle nested if-then-else). It doesn't
# generally buy one much to go to full LR(k).
Peruse past posting about people struggling to make a grammar LALR(1).
Or struggling with yacc's various "improvements" to overcome LALR
problem. You can continue to patch a broken program, or start over and
do it right.
# However, that said many recent languages: C++, Perl, (I believe also
C++ is ambiguous. It carries forward C's NIH arrogrance (who else
remembers the =+ fiasco before Ritchie realised why Algol 68 used +:=
instead of :=+) of not understanding why other languages are the way
they are. I don't know, but I wonder if C++ ambguities came about
because of yacc's willingness to resolve SR and RR conflicts instead
of demanding a proper grammar.
Part of the reason for yacc rules is because LALR is a pain in the
butt.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
Return to the
comp.compilers page.
Search the
comp.compilers archives again.