• edited by
688 views
0 0 votes

8:14 AM
37\%
Deepali bansal's doubt
7 hrs
Jaipur

Compiler Design
CS \& IT Engg
Where €,; IF THEN and all capital letters are terminal and stmt, ifstmt, whilestmt and bexpr are non terminal

The above grammar is
1 ambiguous
2 unambiguous
3 LL(1)
4 LR(1)
Pls expain with the draw parse tree and how to generate the grammar

T4. Consider the following CFG.
stmt $\rightarrow \varepsilon$ | stmt; stmt; lifstmt | whilestmt ifstmt $\rightarrow$ If bexpr THEN stmt |IF bexpr THEN stmt ELSE stmt END whilestmt $\rightarrow$ WHILE bexpr DO stmt END bexpr $\rightarrow$ TRUE|FALSE

Answers (0)

2 Answers

0 0 votes
Given grammar is ambiguous, Hence option A.

We can generate more than 1 parse trees for even number of ';' like ;;.    ;;;; .      ;;;;;;
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.2k
1.2k views
KISHALAY DAS asked Nov 9, 2016
1,238 views
Which of the following statements is true?Every LR(0) grammar is also SLR(1)An ambiguous grammar can never be LR grammarEvery LL(1) grammar is also an LALR(1)All of these
0 0 votes
1 1 answer
461
461 views
sourabh asked Dec 29, 2015
461 views
Which of the following statement(s) is/are TRUE?S1: LR grammar can describe more number of languages than LL grammar.S2: In LR (K) grammar requirement is less stringent t...
0 0 votes
1 answers 1 answer
837
837 views
8 8 votes
2 answers 2 answers
3.3k
3.3k views
smelly indian asked Sep 6, 2017
3,299 views
Consider the following context-free grammarS → SS + | SS*| aIt isa)LL(1)b)LR(0)c)Bothd)none