- Even-length palindromes:
S → aSa | bSb | ε
- Odd-length palindromes:
S → aSa | bSb | a | b
- Palindromes with a center marker:
S → aSa | bSb | c
- Prefix notation:
E → + E E | * E E | a
- Postfix notation:
E → E E + | E E * | a
- Balanced parentheses:
S → ( S ) S | ε
- Arithmetic expressions over
id
’s and num
’s (ambiguous):
E → E + E | E * E | ( E ) | id | num
- Arithmetic expressions over
id
’s and num
’s (unambiguous):
E → E + T | T
T → T * F | F
F → ( E ) | id | num
- Regular expressions over
{a, b}
(ambiguous):
R → R + R | RR | R* | ( R ) | a | b | ε | φ
- If-then, if-then-else statements (ambiguous):
S → if c then S
S → if c then S else S
S → other_stat