Question: 8. A certain magazine distributor stores each subscription it distributes in a database and assigns each subscription a code number. That code number looks like
8. A certain magazine distributor stores each subscription it distributes in a database and assigns each subscription a code number. That code number looks like
JIP081#0301870189018901900190079078
Here the first three letters of the code are the first three letters of the subscriber's last name. The next three characters are the first three numbers in the street address. This field is omitted if there is no street address (for example, the address is a post office box). The next character is always a number sign (#). The next two characters indicate the number of subscription terms, which can be an integer from 1 to 99. The following four characters indicated the starting date of the first subscription term in the format mmyy. A pair of start/end dates is given for each subscription term. The last two characters in the code form a two-digit ID code for the magazine.
In the preceding sample code, the fields are interpreted as follows:
JIP first three letters of subscriber's last name
081 First three digits of street address
# Number sign
03 Number of subscription terms
0187 Start date of term 1
0189 End date of term 1
0189 Start date of term 2
0190 End date of term 2
0190 Start date of term 3
0790 End date of term 3
78 Magazine ID code
Give a specification for a language that recognizes all forms of subscription code numbers using BNF and syntax diagrams (not EBNF). Be sure your language accepts exactly what is specified earlier --- nothing more or less. You may have to invent a few names for nonterminal symbols. You may assume that
9. Consider your specification for Exercise 8. For each of the following strings, give a derivation and parse tree.
a. JIP081#0301870189058906900591129278
b. SMI#010719128733
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
