Question

4. What is the language described by the grammar? How many sentences does the language contain?...

4. What is the language described by the grammar? How many sentences does the language contain?

<Z> ::= <L> | <L> <L> | <L> <L> <L>

<L> ::= a | b | c

Please explain, I do not understand these problems

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Given grammar is

<Z> ::= <L> | <L> <L> | <L> <L> <L>

<L> ::= a | b | c

Here variable <L> generates terminal a ,b, or c.

(i) If we take <Z> ::= <L>

    There will be three sentences {a,b,c}

(ii) If we take <Z> ::= <L> <L>

    There will be 9 sentences , { aa, bb, cc, ab, bc, ca, ba , cb , bc }

(iii) If we take <Z> ::= <L> <L> <L>

      There will be 21 sentences , { aaa , bbb, ccc ,aab ,abc , aca ,aba ,acb ,aac ,abb ,bbc , cba ,bba ,cbb ,abc , acb , bcc ,cca ,bca ,ccb ,acc }

This language contains total of 33 sentences.

Language contains identifier over the input alphabet set { a,b,c} of length at most three.

Add a comment
Know the answer?
Add Answer to:
4. What is the language described by the grammar? How many sentences does the language contain?...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT