Question: 1. Write down a BNF grammar for US phone numbers that use the dash after the area code instead of parentheses around it. 2. Write

1. Write down a BNF grammar for US phone numbers that use the dash after the area code instead of parentheses around it.

2. Write down a BNF grammar for US phone number written in the international style.

3. Write a program that allows the user to input a character string from the keyboard, and tell the user if that string complies with the US phone number grammar - that is, the one from the Practice BNF item, like (757)530-4601. Your program should output the user's string, followed by "YES" if the string is acceptable, and "NO" if it is not. So, an example output from this program could be: (757)555-1234 YES

4. Your program must give the correct (Yes/No) answer when presented with the following phone numbers: 757-555-0025 (757)555-1234 757-555-0000 757.555.1234 757-043-1234 057-555-1234 057-MH5-1234

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!