A simplified email address has i an account name starting wi

A simplified email address has

(i) an account name starting with a letter and continuing with any number of letters or digits;

(ii) an @ character;

(iii) a host with two or more sequences of letters or digits separated by periods; the last sequence must be a toplevel domain— either ’edu’, ’org’, or ’com’. Define a context-free grammar to model this language.

Solution

We can use regular expression to check for the email:

x=(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)

1stt half [a-zA-Z0-9_.+- ]takes the name a-z,A-Z, 0-9.

2nd half [a-zA-Z0-9-.]+$ takes the host name.

3rd [a-zA-Z0-9-] half takes the top level domain.

A simplified email address has (i) an account name starting with a letter and continuing with any number of letters or digits; (ii) an @ character; (iii) a host

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site