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
5.5k 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
6.0k points