BNF Exercises - Problem 2

Problem

Write a syntactic specification using Backus-Naur Form to describe the mini-language with the following description:

In years past telephone numbers in the USA had a very interesting format:

They had the form (ABC) PPP-XXXX where in the area code (ABC) A could not be 0 or 1, while B must be 0 or 1; and in the prefix (PPP) the first digit could not be 0 or 1.

Write a syntactic specification using BNF of these telephone numbers.


Last updated 2001/03/15
© J.A.N. Lee, 2001.