|[20 earlier articles]|
|Re: Programming language and IDE design email@example.com (George Neuner) (2013-11-19)|
|Re: Programming language and IDE design firstname.lastname@example.org (Jonathan Thornburg) (2013-11-19)|
|Re: Programming language and IDE design email@example.com (2013-11-22)|
|Re: Programming language and IDE design firstname.lastname@example.org (robin) (2013-11-25)|
|Re: Programming language and IDE design email@example.com (Martin Ward) (2013-12-03)|
|Re: Programming language and IDE design DrDiettrich1@aol.com (Hans-Peter Diettrich) (2013-12-05)|
|Re: Programming language and IDE design firstname.lastname@example.org (2014-03-02)|
|Re: LL vs LR, was Programming language and IDE design email@example.com (Ivan Godard) (2014-03-01)|
|Re: Programming language and IDE design firstname.lastname@example.org (George Neuner) (2014-03-02)|
|Re: LL vs LR, was Programming language and IDE design email@example.com (Kaz Kylheku) (2014-03-02)|
|Date:||Sun, 2 Mar 2014 00:03:18 +0000 (UTC)|
|Posted-Date:||01 Mar 2014 22:58:04 EST|
George Neuner <firstname.lastname@example.org> wrote:
>On Sat, 16 Nov 2013 15:55:10 +0000, Martin Ward <email@example.com>
>>On Friday 08 Nov 2013 at 21:04, George Neuner <firstname.lastname@example.org> wrote:
>>> The majority of successful languages are LL(k) for small k. It's hard
>>> to get much simpler than that for parsing.
>>C is not LL(K), neither is COBOL, nor C++, nor I think is Java.
>>That probably covers the majority of successful languages:
>>if "success" is defined as "total lines of code in production".
>They _all_ are LL(k). More specifically, I believe all of your
>examples are, at most, LL(2).
I don't think C++ is LL(2).
(Example from n3485, page 131).
The former is a statement, while the latter is a declaration, and you
can decide this only very late. As the first four tokens are the same,
C++ can't be LL(4), at least.
As you can substitute '('^n x ')' ^n for a in this example (i.e. enclose
that identifier in any number of parentheses), C++ isn't LL(n) for any n.
(In the first case, "a" is a subexpression, that can be parenthesized,
while in the second case, it's the declarator-id that can also be
Then, in C99, in function parameter declarations
(i.e. parameter-type-list, then in the single parameter-declaration,
after declaration-specifiers, even if you left-factor those), you have
to decide whether you're to descend into declarator or into
FIRST_k(declarator), however, includes "("^k, as does
The former via k recursions of declarator -> direct-declarator -> ( declarator )
the latter via k recursions of
abstract-declarator -> direct-abstract-declarator -> ( abstract-declarator )
So the C grammar is not LL(k) for any k, either. You can probably parse
that particular part of the C/C++ grammar easily using LR.
Return to the
Search the comp.compilers archives again.