Consider the following two statements: P: Every regular grammar is LL(1) Q:…
2007
Consider the following two statements:
P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammarWhich of the following is TRUE?
- A.
Both P and Q are true
- B.
P is true and Q is false
- C.
P is false and Q is true
- D.
Both P and Q are false
Attempted by 10 students.
Show answer & explanation
Correct answer: C
Statement P is false because not every regular grammar is LL(1); for example, left-recursive or ambiguous regular grammars cannot be LL(1). Statement Q is true because every regular language has a deterministic context-free grammar, and all regular languages are accepted by LR(1) parsers. Therefore, P is false and Q is true, making option C correct.