0% found this document useful (0 votes)
31 views

Digital Assignment II

1. The document discusses several problems related to context-free grammars and pushdown automata: 2. It asks to determine if given strings are in the languages generated by specific context-free grammars using the CYK algorithm. 3. It asks to determine if a grammar is ambiguous and to construct equivalent grammars without null/unit productions or in Chomsky normal form. 4. It asks about the analysis phase of a compiler design and to construct pushdown automata for specific languages by final state or null stack.

Uploaded by

Ajay Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Digital Assignment II

1. The document discusses several problems related to context-free grammars and pushdown automata: 2. It asks to determine if given strings are in the languages generated by specific context-free grammars using the CYK algorithm. 3. It asks to determine if a grammar is ambiguous and to construct equivalent grammars without null/unit productions or in Chomsky normal form. 4. It asks about the analysis phase of a compiler design and to construct pushdown automata for specific languages by final state or null stack.

Uploaded by

Ajay Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Digital Assignment II

1.

Consider the context free grammar G having productions, Q0 AB | b ,


A aQ0 | b , and B BQ0 | a . Determine whether the string z = aabbab is

2.

in the language L(G). Use CYK algorithm to justify your answer.


Determine whether the string z = 1101001 is in the language generated by the
grammar G = (VN , T , P, Q0 ) , where VN = {Q0 , A, B, C}, T = {0,1, 2} and having
productions P = {Q0 1Q0 | ABC | 0, A 10 | BB, B 0 |1, C AB |1} . Use
CYK algorithm to justify your answer.

3.

Consider the productions

P = {Q0 0Q0 |1A | 2 BB, A 0 AA |1B | 2, B

BQ0 | 2 A |1} of the context free grammar G. Is this grammar ambiguous? If


yes, justify your answer.
4.

Consider a context free grammar G = (VN , T , P, Q0 ) having productions P =


{Q0 aQ0 | AB | aB | C , A b | , B a, C a | } . Construct a grammar
G1 equivalent to G having no null and unit productions.

5.

Consider a context free grammar G = (VN , T , P, Q0 ) given by productions


P = {Q0 aQ0 | bA | cB | BC , A a | , B a, C a, D d ,

E F | a,

F b} . Construct a simplified grammar G1 equivalent to the grammar G.

6.

Consider a context free grammar G = (VN , T , P, Q0 ) having productions P =


{Q0 aA | bBC | , A Aa | b | , B BBC | a | , C b} .

7.

Construct

grammar equivalent to G in Chomsky normal form.


Reduce the grammar G = ({ A, B, C , D, E},{0,1, 2}, P, A) , P = { A 0 ABC ,
A BCD | 2 |1B | 2 DE , B CE |1, C 0 | 2, D 2, E 1}

into Chomsky

8.

normal form.
What do you mean by analysis of the source program in the context of
compiler design? Discuss the various phases of a compiler design.

9.

Construct a pushdown automaton accepting L = {a nb n + m c m | m 1, n 0} by


final state.

10.

Construct a pushdown automaton accepting L = {w {a, b}+ | na ( w) = 2nb ( w)}


by null stack, na ( w) represents the number of a s in the string w .

You might also like