• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Parsing and Syntax directed translation

Question 41

Which one of the following grammars is free from left recursion? z3
  • A
  • B
  • C
  • D

Question 42

Which of the following is the most powerful parsing method?
  • LL(1)
  • Canonical LR
  • SLR
  • LALR

Question 43

Which of the following statement is true?
  • SLR parser is more powerful than LALR.
  • LALR parser is more powerful than Canonical LR parser.
  • Canonical LR parser is more powerful than LALR parser.
  • The parsers SLR, Canonical LR, and LALR have the same power.

Question 44

Type checking is normally done during
  • Lexical analysis
  • Syntax analysis
  • Syntax directed translation
  • Code optimization

Question 45

Consider the grammar
S →  Aa | b
A → Ac | Sd | ε
Construct an equivalent grammar with no left recursion and with minimum number of production rules.

    Question 46

    Answer the following: a.  Let G1 = (N, T, P, S1) be a CFG where, N= {S1A, B}, T= {a,b} and P is given by
             S1 → aS1b             S1 → aBb
             S1 → aAb              B → Bb
             A → aA                B → b
             A → a
    What is L(G1)? b. Use the grammar in part(a) to give a CFG for L2 = {ababl | i, j, k, l ≥ 1, i= j or k=l} by adding not more than 5 production rule. c.  Is L2 inherently ambiguous?

      Question 47

      [5 Marks question] Answer the following: a. An identifier in a programming language consists of upto six letters and digits of which the first character must be a letter. Derive a regular expression for the identifier. b. Build an LL(1) parsing table for the language defined by the LL(1) grammar with productions
      Program → begin d semi X end
      X → d semi X | s Y
      Y → semi s Y | ε

        Question 48

        Let the attribute \'val\' give the value of a binary number generated by S in the following grammar: S → L.L | L L→ LB | B B → 0 | 1 For example, an input 101.101 gives S.val = 5.625 Construct a syntax directed translation scheme using only synthesized attributes, to determine S.val.

          Question 49

          In the following grammar
          X :: = X ⊕ Y / Y
          Y :: = Z * Y / Z
          Z :: = id
          
          Which of the following is true? a. \'⊕\' is left associative while \'*\' is right associative b. Both \'⊕\' and \'*\' are left associative c. \'⊕\' is right associative while \'*\' is left associative d. None of the above
          • a
          • b
          • c
          • d

          Question 50

          Which of the following is essential for converting an infix expression to the postfix from efficiently ?
          • An operator stack
          • An operand stack
          • An operand stack and an operator stack
          • A parse tree

          There are 85 questions to complete.

          Last Updated :
          Take a part in the ongoing discussion