Re: LL Parser problem

"Nick Roberts" <nick.roberts@acm.org>
13 Aug 2004 17:31:26 -0400

          From comp.compilers

Related articles
LL Parser problem jdlessl@yahoo.com (2004-08-09)
Re: LL Parser problem jdlessl@yahoo.com (2004-08-10)
Re: LL Parser problem wyrmwif@tsoft.org (SM Ryan) (2004-08-11)
Re: LL Parser problem nick.roberts@acm.org (Nick Roberts) (2004-08-13)
Re: LL Parser problem cfc@shell01.TheWorld.com (Chris F Clark) (2004-08-15)
Re: LL Parser problem nick.roberts@acm.org (Nick Roberts) (2004-08-23)
Re: LL Parser problem rich@pennware.com (Richard Pennington) (2004-08-25)
Re: LL Parser problem vbdis@aol.com (2004-09-03)
Re: LL Parser problem cfc@shell01.TheWorld.com (Chris F Clark) (2004-09-07)
| List of all articles for this month |

From: "Nick Roberts" <nick.roberts@acm.org>
Newsgroups: comp.compilers
Date: 13 Aug 2004 17:31:26 -0400
Organization: Compilers Central
References: 04-08-060 04-08-063
Keywords: parse, comment
Posted-Date: 13 Aug 2004 17:31:26 EDT

On 11 Aug 2004 12:53:27 -0400, SM Ryan <wyrmwif@tsoft.org> wrote:


> jdlessl@yahoo.com (Jared Lessl) wrote:
> # > [Special case the lexer to return a mutant < token after an array
> # > name. -John]
> #
> # Except that in AREV, any variable or function return value can be an
> # array of this type. The only assurance I can have that a '<' is not
> # an array index is if it immediately follows a literal or numerical
> # value.
>
> If you have two different derivations
>
> Z -> X -> A<B>
> and Z -> Y -> A<B
>
> where B has an unbounded expansion, then it isn't LL(k). To be LL(k) you
> have to be able choose X or Y by left context + at most k symbols. In
> this case you have traverse the entire expansion of B which can be more
> than k symbols.


I humbly suggest, if you have the option, that you switch to using a
backtracking parser (as hinted at by your own comment). It may not be
so quick, but I suspect that's not likely to be a problem.


It seems to raise a bigger question, to my mind. Are, perhaps, all
these limited grammar parsers (parser generators) -- LL(1), LL(k),
LALR, and so on -- losing their relevance these days (at least with
regards to programming language compilers and similar tools)?
--
Nick Roberts
[Good question. C++ needs a backtracking parser, but I get the impression
that was a mistake. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.