Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1414
| From | Lasse Hillerøe Petersen <lhp+news@toft-hp.dk> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Can this be proven for LL(1) grammars? |
| Date | 2014-11-06 22:16 +0000 |
| Organization | SunSITE.dk - Supporting Open source |
| Message-ID | <14-11-006@comp.compilers> (permalink) |
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
Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread
Can this be proven for LL(1) grammars? Lasse Hillerøe Petersen <lhp+news@toft-hp.dk> - 2014-11-06 22:16 +0000 Re: Can this be proven for LL(1) grammars? Kaz Kylheku <kaz@kylheku.com> - 2014-11-07 19:43 +0000 Re: Can this be proven for LL(1) grammars? "SLK Mail" <slkpg4@gmail.com> - 2014-11-08 14:51 -0800
csiph-web