I'm trying to develop a recursive decent parser for regular expressions for a homework assignment. I just wanted to ask the community if the grammar I've developed is correct or if I'm on the right track:
-= Regex Grammar (EBNF) =-
<start> -> <expr> '\n'
<expr> -> <expr> { '|' <term> } // Union
| <expr> { <expr> } // Concatenation
| <expr> '*' // Closure
| <term>
<term> -> '(' <expr> ')' | <char> // Grouping
| <char>
<char> -> a|b|c| ... |z
A few guidelines:
1. Precedence: In the order listed (highest to lowest) Closure, Concatenation, Union
2. Associativity: Closure is right-associative; Concatenation/Union are left-associative
3. Must support grouping with parens
My Question: Does the grammar (above) meet the guidelines? I feel certain but I'm not 100% and was hoping a few seasoned eyes could point out some issues/errors.
TIA Noob