Question
Problems is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a
Problems is to write a parser for a customer form. You need to develop a Java application using Parboiled library. Your program should include a grammar for the parser and display the parse tree with no errors.
The customer form should include the following structure:
First name, middle name (optional), last name
Street address, city, state (or province), country
Phone number
Rules
First name, middle name and last name should start with an uppercase letter followed by lower case letters. Middle name is an optional input meaning such an input may or may not exist.
The street address can include any type of letters or numbers. There is no lowercase/uppercase restriction either.
The city name should start with an uppercase letter followed by lowercase/uppercase letters.
The state or province should start with an uppercase letter followed by lowercase/uppercase letters.
The country name should start with an uppercase letter followed by lowercase/uppercase letters.
The phone number should begin with area code in parenthesis, followed by a space, three digits, a hyphen, and four digits.
Examples
Here are some input examples for your program:
John Doe
3609 Mynders Ave, Memphis, TN, United States of America
(901) 345-9834
Joshua R. Clemens
982 Pryor St, Little Rock, AR, USA
(501) 876-1234
Mary Smith
82 Main St., Toronto, Ontario, Canada
(416) 509-6995
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started