A
A
Alexander2017-06-14 15:02:59
Email
Alexander, 2017-06-14 15:02:59

Is it possible to create an email address parser in a recursive way (ll-grammar)?

I need an implementation example if possible, I just can't figure out how to implement it. Split the address into the following non-terminals <local part> | <domain part> |<part after the dot>
Further terminals "az", "0-9", "@", "." "-", "_".
I have no idea how to put it all together.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-06-14
@axell24

email ::= mailbox "@" hostname
mailbox ::= mailbox_symbol {mailbox}
mailbox_symbol ::= "a-z0-9..."
hostname ::= ...
In the most banal form, everything is OK, no left recursion, by hand you can write a parser in 10-15 minutes (recursive descent).
Another thing is that the email is not [email protected], there are all sorts of other complicated things.
I advise you to read https://habrahabr.ru/post/224623/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question