99.3k views
4 votes
Design a regular grammar to generate the set of all integers beginning with the digit 3 such that the digits are consecutive and odd. If a digit is 9, its following digit (if present) will be 1. The set of valid strings is {3, 35, 357, 35791, 357913, ...}

User Karoh
by
7.8k points

1 Answer

4 votes

Answer:

The grammar has start symbol S, terminals are 1,3,5,7 an 9 ; and the variables are S, A, B, C and D

Explanation:

CHECK THE ATTACHMENT FOR EXPLANATION

Design a regular grammar to generate the set of all integers beginning with the digit-example-1
User Jaromir
by
8.6k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.

9.4m questions

12.2m answers

Categories