Chapter 11: Problem 6
a. Write a BNF grammar that describes the structure of U.S. telephone numbers, which can be either \((x x x) x x x-x x x x\) or \(x x x-x x x x\), where \(x\) can be any digit from 0 to 9 . b. Modify your grammar from Exercise 6a so that (1) the middle digit of an area code must be either a 0 or a \(1,(2)\) the first digit of an area code cannot be a 0 or a 1 , and (3) the first digit of the seven-digit phone number cannot be a 0 or a 1 . c. Using your grammar from either Exercise \(6 a\) or \(6 b\), show a parse tree for the phone number (612)555-1212.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.