Question

can someone please answer these in the correct format: Assignment #2 Total 43 pts (12pts) List...

can someone please answer these in the correct format:

Assignment #2

Total 43 pts

  1. (12pts) List at least 3 words in the language and write regular expressions for the following:

  1. S = {a,b,c} L = {all words that have only one letter c in them}

  1. S = {a,b,c} L = {all words in which c’s appear in groups of two}

  1. S = {a,b,c} L = { all words that begin and end with the same letter}

  1. S = {a,b,c} L = { all words that begin and end with a different letter

  1. (5pts) Write a grammar for the language S = {a,b,c} L = {all words that have only one letter c in them}

  1. (5pts) Write a grammar for the language S = {a,b,c} L = {all words where every b is immediately followed by the letter c}

  1. (10pts) Using the grammar below show a leftmost derivation

for A = B * (C + A)

<assign> à<id> = <expr>

<id> à A | B|C

<expr>à <expr> + <term>

                | <term>

<term> à <term> * <factor>

    |<factor>

<factor> à ( <expr> )

               |<id>

  1. (5pts) Given the following grammar

Sà aScB | A | b

Aà cA | c

             Bà d | A

   Show a rightmost derivation for: acccc

  1. (6pts) Is the following grammar ambiguous? Explain your answer.

S-->AB | BA

A-->AA | b

B -->Bb | a

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT