The problem is:
a. Write a directly recursive EBNF rule named mp
that describes all symbols that have matching parentheses: ()
, ()()()
, ()(()())
, and ((())())(()(()))()
. It should not recognize (
, ())(
, or (()()
as legal.
b. Write a tabular proof and its derivation tree showing how ()(()())
is recognized as legal.
So far I've thought of one plausible solution. I am not sure if it is correct or if I am missing something.
<mp> ::= "" | ( <mp> "(" <mp> ")" )
Any suggestions?