can someone please answer these in the correct format:
Assignment #2
Total 43 pts
- (12pts) List at least 3 words in the language
and write regular expressions for the
following:
- S = {a,b,c} L = {all words that have only one letter c in
them}
- S = {a,b,c} L = {all words in which c’s appear in groups of
two}
- S = {a,b,c} L = { all words that begin and end with the same
letter}
- S = {a,b,c} L = { all words that begin and end with a different
letter
- (5pts) Write a grammar for the language S =
{a,b,c} L = {all words that have only one letter c in them}
- (5pts) Write a grammar for the language S =
{a,b,c} L = {all words where every b is immediately followed by the
letter c}
- (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>
- (5pts) Given the following grammar
Sà aScB | A | b
Aà cA | c
Bà d | A
Show a rightmost
derivation for: acccc
- (6pts) Is the following grammar
ambiguous? Explain your answer.
S-->AB | BA
A-->AA | b
B -->Bb | a