Theory of Computation and Compilers - Syntax Analysis

16. Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

  • Option : C
  • Explanation :
    LL(1) grammar is top down parsing. It is used in removing left recursion and factoring the grammar.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


17. The grammar A → AA | (A) | ε is not suitable for predictive-parsing because the grammar is
A. ambiguous
B. Left-recursive
C. right-recursive
D. an operator-grammar

  • Option : A
  • Explanation :
    Grammar have multiple parse trees for string ‘ε’, so grammar is ambiguous, and also A → AA has left recursion.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


18. Which one of the following is a top-down parser?

  • Option : A
  • Explanation :
    Recursive descent parser is a kind of top-down parser.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


19. Consider the grammar with non-terminals N = {S, C, S1}, terminals T = {a, b, i, t, e}, with S as the start symbol, and the following set of rules
S → iCtSS1|a
S → eS|ε
C → b
The grammar is NOT LL(1) because:

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


20. Consider the following two statements:
P: Every regular grammar is LL (1)
Q: Every regular set has LR (1) grammar
Which of the following is TRUE?

  • Option : C
  • Explanation :
    Regular grammar may be ambigous and ambigous grammar is never LL(1).
    Every regular set has a unambigous regular grammar so they are LL(1) and every LL(1) is LR(1)
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *