Can this be proven for LL(1) grammars?

Lasse =?iso-8859-1?q?Hiller=F8e?= Petersen <lhp+news@toft-hp.dk>
06 Nov 2014 22:16:38 GMT

          From comp.compilers

Related articles
Can this be proven for LL(1) grammars? lhp+news@toft-hp.dk (Lasse =?iso-8859-1?q?Hiller=F8e?= Petersen) (2014-11-06)
Re: Can this be proven for LL(1) grammars? kaz@kylheku.com (Kaz Kylheku) (2014-11-07)
Re: Can this be proven for LL(1) grammars? slkpg4@gmail.com (SLK Mail) (2014-11-08)
| List of all articles for this month |

From: Lasse =?iso-8859-1?q?Hiller=F8e?= Petersen <lhp+news@toft-hp.dk>
Newsgroups: comp.compilers
Date: 06 Nov 2014 22:16:38 GMT
Organization: SunSITE.dk - Supporting Open source
Keywords: parse, theory, question, LL(1)
Posted-Date: 07 Nov 2014 13:14:12 EST

Given a context free grammar G that is LL(1), is the answer to the
following questions "yes"? I intuitively believe it is, except for (2),
but I am not sufficiently confident of my skills in proving this in full
generality, so I would much appreciate expert advice.


1. From G, for each nonterminal symbol R define a grammar GR, where the
start rule is changed to R. Rules that are no longer reachable are of
course useless and discarded. Is each GR also LL(1)?


2. From all the GR grammars from (1), define G' with a new start rule S:
GR1 | GR2 ... |GRn. Is G' also LL(1)? Given that there could be rules Gi
and Gj such that their FIRST sets intersect, I suppose the answer is no.
What if instead, S is defined only from a selection of rules with
disjoint FIRST sets?


3. From G, define a new grammar G', such that for each nonterminal R, a
rule R: "R" is added, where "R" is a new terminal symbol. Is G' also LL
(1)?


4. Do (1) and (3) hold for other types of CFG?


This isn't homework, and I have tried searching for an answer, but found
none - this may of course be because the proof is actually trivial. If
so, I apologize and hope someone will enlighten me anyway.


/Lasse


Post a followup to this message

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