edited by
2,170 views

1 Answer

Best answer
4 votes
4 votes

yes option 3) is true .

1) Every regular grammar may or may not be LL1. Regular grammar can be left linear or right linear grammar and though righ linear grammar is guaranteed to be recursion free as well as factoring free, left linear grammar allows both and such a grammar cannot be parsed by LL1 parser. So it is false. (Even not all right linear grammars can be parsed by LL(1)- see part 3)

2) this is false ...

by this picture (given in Stanford-CS143 ) it is clear every LL1 Is not LALR(1).

3) Ambiguity can even come from inherent property of language. So it need not be true always. counter eg : 

s--> iEts/iEtses/a

s-->b 

after removing left factoring 

s--> iEtss'/a

s'---> E/es

E--->b  after removing left factoring we still come with ambiguity ..so this is true 


for more clear picture 

1) if it is ambiguous and right linear then also it will not be parsed by LL1 ..becoz LL1 does not parse ambiguous and left recursive grammer

2)this is LL1 but not LALR

S ::= '(' X 
    | E ']' 
    | F ')'
X ::= E ')' 
    | F ']'
E ::= A
F ::= A
A ::= ε 

3) if language is not inherently ambiguous after then it could be ambiguous ..bcoz inherently ambiguous property says for given grammar , every language derived from it will be ambiguous .. while without this property , may also ambiguous ... bcoz ambiguous means for same language or string we have 2 or more parse tree structure .. so if there is single language from given grammar , for which we have more than 1 parse tree then it will be ambiguous.

edited by

Related questions

0 votes
0 votes
0 answers
3
Shobhit Joshi asked Jan 1, 2019
374 views
Consider the statementdo {i = i + 1;}while ( a[i] < b );The minimum number of variables required in the three address code of the above statement ?
0 votes
0 votes
0 answers
4