context-free grammar palindrome substring prefix suffix top-down parser bottom-up parser parse tree leftmost derivation rightmost derivation accept PDA TM DPDA unambiguous ambiguous inherently ambiguous general grammar respecting the semantics decidable enumerable