Give a context-free grammar that generates the languageA =

Chapter , Problem 2.9

(choose chapter or problem)

Get Unlimited Answers
QUESTION:

Give a context-free grammar that generates the language

\(A=\left\{\mathrm{a}^{i} \mathrm{~b}^{j} \mathrm{c}^{k} \mid i=j \text { or } j=k \text { where } i, j, k \geq 0\right\}\)

Is your grammar ambiguous? Why or why not?

Questions & Answers

QUESTION:

Give a context-free grammar that generates the language

\(A=\left\{\mathrm{a}^{i} \mathrm{~b}^{j} \mathrm{c}^{k} \mid i=j \text { or } j=k \text { where } i, j, k \geq 0\right\}\)

Is your grammar ambiguous? Why or why not?

ANSWER:

Step 1 of 4

CFG for  \(i=j\)

\(S_{i=j} \rightarrow S_{1} S_{2}\)

\(S_{1} \rightarrow a S_{1} b \mid \varepsilon\)

\(S_{2} \rightarrow c S_{2} \mid \varepsilon\)

Add to cart


Study Tools You Might Need

Not The Solution You Need? Search for Your Answer Here:

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back