I have a Computer Science A-Level exam tomorrow and I've been trying to get this question answered by my teacher but she's not been too helpful so asking here instead.
In an exam question, I have the following BNF grammar, where _
denotes a space.
<fullname> ::= <title>_<name>_<endtitle> |
<name> |
<title>_<name> |
<name>_<endtitle>
<title> ::= MRS | MS | ... | SIR
<endtitle> ::= ESQUIRE | OBE | CBE
<name> ::= <word> |
<name>_<word>
<word> ::= <char><word>
<char> ::= A | B | ... | Z
The mark scheme says that the first rule, fullname, can be represented with a regular expression. But I'm not really sure how you could represent it with a regular expression when it's made up of other rules that can't be represented by regular expressions themselves e.g. name which is recursive. Also I thought regular expressions were made up of just letters and symbols e.g. a*b? . Forgive me if I don't seem too knowledgable on this because the resources we have for the A-Level are pretty awful.