|Re: Is C++ LL(k)? email@example.com (Lin Gu) (2001-07-23)|
|Re: Is C++ LL(k)? firstname.lastname@example.org (2001-07-27)|
|Re: Is C++ LL(k)? email@example.com (Mike Dimmick) (2001-07-27)|
|Re: Is C++ LL(k)? firstname.lastname@example.org (2001-08-06)|
|From:||"Lin Gu" <email@example.com>|
|Date:||23 Jul 2001 23:26:05 -0400|
|Posted-Date:||23 Jul 2001 23:26:05 EDT|
Thanks for the clear elumination.
Your example also reminds me the 'if...if...else' ambiguation. Surely it is
However, I may have to use an LL(k) compiler generator (Antlr) to
write a compiler for it. Is it difficult? It is expected that I need
to add some rules to disambiguate, but I want to know whether this is
"Kaz Kylheku" <firstname.lastname@example.org> wrote in message
> In article <email@example.com>, Lin Gu wrote:
> >I think C++ is LR(1). But is it LL(k)?
> >I am to write a compiler for a C++ like language and get confused with
> The C++ grammar is not LR(1) or LL(k), because it contains ambiguities
> that are resolved by dynamically determining the lexical category of an
> identifier, based on the semantics of an earlier declaration. Is X(Y)
> a function call, or a declaration that Y is of type X? Depends on what
> X is, of course.
> I believe the C++ grammar can be factored to eliminate left recursion,
> and subsequently can be parsed by a recursive descent parser with
> only one token of lookahead.
Return to the
Search the comp.compilers archives again.