Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

1) (15 points) Let G be a context-free grammar on alphabet Σ = a, (, +,  , ) and the following production rules:??????? S → S + T |T T → T ∗ U |U U → (S)|a (5 points) Specify the parse tree and left-most derivation each of the strings “((a))” and “(a + a ∗ a) ∗ (a ∗ a + a)”

Computer Science Oct 11, 2021

1) (15 points) Let G be a context-free grammar on alphabet Σ = a, (, +,  , ) and the following production rules:???????

S S + T |T

T T U |U U (S)|a

    1. (5 points) Specify the parse tree and left-most derivation each of the strings “((a))” and “(a + a a) (a a + a)”.
    2. (10 points) Formally prove that G is unambiguous.
  1. (10 points) Convert the following CFG into an equivalent CFG in CNF. Show the intermediate steps.

 

S ASA|A|ε A aa|ε

  1. (15 points) Let PDA P is represented by the following graph.

 

start

q

0

ε, ε $

0, − → ε

1, + ε

q

1

ε, $ ε

q

4

ε, ε +

0, + +

0, $ $

1, $ $

1, − → −

ε, ε → −

q2

q3

 
 
 

 

 

    1. (5 points) Write-down the 6-tuple representation of P .
    2. (5 points) Describe the language accepted by this PDA.
    3. (10 points) Prove that the following context-free grammar generates the language described in part b.

 

S SS|0S1|1S0|ε

  1. (50 points) Show that the following languages are context-free either by writing a grammar that generates them or by drawing a PDA that accepts them.
    1. (5 points) {wuwR|u, w {0, 1}} (write a grammar)
    2. (5 points) {w|w = wR |w| is odd} (write a grammar)
    3. (10 points) {anbmck|n, m, k Z0, m = k n = 3k 2n = 3m} (write a grammar)
    4. (10 points) {anbmck|n, m, k Z0, m =/  n + k} (write a grammar)
    5. (5 points) {anbmck|n, m, k Z0, n = 2m} (draw a PDA) (f)  (5 points) {anbmck|n, m, k Z0, m = 2k} (draw a PDA)

 

m+n

(g)  (10 points) {anbmcl   2     J|n, m Z0} (draw a PDA)

 

  1. (10 points) Convert the PDA of question 3 to its equivalent CFG describing L(P ) (Hint: You need to first convert the given PDA to the following PDA and then, use the conversion process specified in the proof of Lemma 2.27 and in class. Please note that by following the general conversion process, you will have many useless/unreachable variables that can be eliminated from your final response. The key useful variables are Aq0q6 , Aq6q4 , Aq0q7 , Aq7q4 , and Aq0q4 which is the start variable of the grammar).

 

start

q

0

ε, ε $

0, − → ε

1, + ε

q

1

ε, $ ε

q

4

ε, ε +

0, $ ε

q7

1, $ ε

q6

ε, ε → −

q2

ε, ε $

ε, ε +

0, + ε

q8

1, − → ε

q5

ε, ε $

ε, ε → −

q3

 
   

Expert Solution

PFA

Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment