Re: predictive parsing and non-recursive predictive parsing

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Sat, 28 Jun 2008 22:53:42 +0200

          From comp.compilers

Related articles
[6 earlier articles]
Re: predictive parsing and non-recursive predictive parsing gene.ressler@gmail.com (Gene) (2008-06-25)
Re: predictive parsing and non-recursive predictive parsing unix.sh@gmail.com (2008-06-25)
Re: predictive parsing and non-recursive predictive parsing ang.usenet@gmail.com (Aaron Gray) (2008-06-27)
Re: predictive parsing and non-recursive predictive parsing torbenm@pc-003.diku.dk (2008-06-27)
Re: predictive parsing and non-recursive predictive parsing kamalpr@hp.com (kamal) (2008-06-27)
Re: predictive parsing and non-recursive predictive parsing max@gustavus.edu (Max Hailperin) (2008-06-28)
Re: predictive parsing and non-recursive predictive parsing DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-06-28)
Re: predictive parsing and non-recursive predictive parsing ang.usenet@gmail.com (Aaron Gray) (2008-06-28)
Re: predictive parsing and non-recursive predictive parsing max@gustavus.edu (Max Hailperin) (2008-06-28)
Re: predictive parsing and non-recursive predictive parsing torbenm@pc-003.diku.dk (2008-06-30)
Re: predictive parsing and non-recursive predictive parsing ang.usenet@gmail.com (Aaron Gray) (2008-06-30)
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Sat, 28 Jun 2008 22:53:42 +0200
Organization: Compilers Central
References: 08-06-053 08-06-055 08-06-061 08-06-071 08-06-074
Keywords: parse, design
Posted-Date: 28 Jun 2008 17:54:13 EDT

Max Hailperin schrieb:


> Consider for example the following situation:
>
> A -> B c
> A -> D e
[...]
> In fact, given that there is some lookahead, the LR parser can do even
> more. Suppose we complete the grammar with
>
> B -> f f f f f
> D -> f f f f f


IMO this is an example of a bad language design, which I encounterd
already in many languages. The fact, that a parser generator can handle
such a grammar, is not an excuse for a thoughtless language design. No
offense on you, your example is a very practical one <sigh>.


When we have an look at any application, using the above grammar for
e.g. serializing data, a possibly huge amount of input must be kept in
the stack, before any action can be taken. And more memory is wasted for
the automaton tables. When the language, and consequently also the
grammar is converted into LL(1), by swapping the terms in A, no special
amount of time or memory has to be wasted in the analysis of the input.


DoDi


Post a followup to this message

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