All Exams Test series for 1 year @ ₹349 only
Question

Which of the following statement(s) are correct?

A. Syntax Directed Translation can be applied in Type Checking.

B. Syntax Directed Translation can be used in 3-address code generation.

C. Syntax Directed Translation can be used in construction of syntax tree.

D. Syntax Directed Translation can be used to recognize valid tokens.

Choose the most appropriate answer from the options given below:

This question was previously asked in
UGC NET 2022 Paper 1 Question Paper (22-Oct-2022) (Shift 2)
The correct answer is

A, B and C

A syntax-directed translation (SDT) attaches semantic rules or actions to grammar productions; they are evaluated as the parser recognizes the productions, computing attributes of grammar symbols. Aho–Ullman list its main uses as type checking, intermediate (three-address) code generation and syntax-tree construction.

A — Correct. Type expressions are synthesized and checked through attributes such as E.type attached to expression productions.

B — Correct. Attributes such as E.addr and E.code with gen() actions emit three-address code during parsing.

C — Correct. Actions such as E.node = new Node('+', E1.node, T.node) build the syntax tree bottom-up.

D — Not an SDT application. Valid tokens are recognized by the lexical analyser using regular expressions and finite automata before parsing starts; SDT rules operate on tokens that have already been recognized and are attached to context-free productions, not to token patterns.

Every choice that includes D credits SDT with the scanner's job, and choices that drop A or B omit genuine applications, leaving only the set of A, B and C.

A, B and C option is correct.

Was this answer helpful?

Similar Questions

  1. Which of the following tasks could be attained using syntax trees in compiler design ?

    (A) Type Checking

    (B) Code Generation

    (C) Code Optimization

    (D) Error Handling

    Choose the correct answer from the options given below :


Important Questions from Syntax Directed Translation

  1. Given the following syntax directed translation rules:
    Rule 1: $R \to AB$ {$B. i = R. i - 1$; $A. i = B. i$; $R. i = A. i + 1$; }
    Rule 2: $P \to CD$ {$P.i = C.i + D.i$; $D. i = C. i + 2$; }
    Rule 3: $Q \to EF$ {$Q.i = E.i + F. i$; }
    Which ONE is the CORRECT option among the following?
  2. In which graph, semantic rules set up dependencies between attributes ?
  3. COMPILER is used to?

  4. Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.

    SDD1
    Grammar (G1)Semantic Rules
    $D \rightarrow T\ V$$D.type = T.type$
    $V.type = T.type$
    $T \rightarrow int$$T.type = int$
    $T \rightarrow float$$T.type = float$
    $V \rightarrow V_1\ id$$V_1.type = V.type$
    $put(id.entry, V.type)$
    $V \rightarrow id$$put(id.entry, V.type)$

    SDD2
    Grammar (G2)Semantic Rules
    $D \rightarrow D_1\ id$$D.type = D_1.type$
    $put(id.entry, D_1.type)$
    $D \rightarrow T\ id$$D.type = T.type$
    $put(id.entry, T.type)$
    $T \rightarrow int$$T.type = int$
    $T \rightarrow float$$T.type = float$

    $D$ is the start symbol, and $int$, $float$ and $id$ are the three terminals. The non-terminal $V_1$ is the same as $V$ and the non-terminal $D_1$ is the same as $D$. Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function $put$ updates the symbol table with the type information for an identifier.
    Let P and Q be the languages specified by grammars G1 and G2, respectively.
    Which of the following statements is/are true?
  5. Which of the following tasks could be attained using syntax trees in compiler design ?

    (A) Type Checking

    (B) Code Generation

    (C) Code Optimization

    (D) Error Handling

    Choose the correct answer from the options given below :

Need Expert Advice?
Upcoming Exams
CTET
December 12, 2026
CBSE UGC NET
December 14, 2026
CSIR UGC NET
December 19, 2026
Test Series
UGC NET img
Teaching
UGC NET (Paper 2) 2026 Mock Test Series
796 Tests 2 Tests Free
219 Attempts
4.4(46)
English
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App