The Gateway to Computer Science Excellence
+31 votes

Type checking is normally done during

  1. lexical analysis
  2. syntax analysis
  3. syntax directed translation
  4. code optimization
in Compiler Design by Veteran (52.3k points)
edited by | 6.8k views

3 Answers

+55 votes
Best answer

The answer is c .

The use of syntax analyser is used to create parse Tree. But along with Grammar as input to Syntax Analyser we add even semantic rules which form the basis of Syntax Directed Translation That help us in Evaluation of Expression .Remember that

Syntax Directed Translation is used in following cases

  1. Conversion of infix to Postfix
  2. Calculation of infix expression
  3. For creating a Acyclic graph
  4. Type Checking
  5. Conversion of Binary number to Decimal
  6. Counting the numbers of bits (0 or 1 ) in a binary number
  7. Creation of syntax tree
  8. To generate Intermediate code
  9. Storing the data into Symbol table
by Active (1.9k points)
edited by
Can u plz elaborate last 9 th point ,storing data into symbol table is done during syntax directed translation .
@radha gogia

Yes, we may manipulate symbol table during SDT.
7th point ?? i think it is work of syntax analyzer??plz correct me!!

@Rajesh Syntax Analysis create Parse Tree, not Syntax Tree. Both are different. Syntax Trees are abstract representation of Parse Trees.

Which phase creates syntax tree then?
Syntax tree is created in syntax analysis phase only and it is created using SDT.

@Arjun  sir

Parse trees are typically built by a parser during the source code translation and compiling process.Once built, additional information is added to the AST by means of subsequent processing.


My doubt: If SDT are helping in making syntax trees.Okay. But they also help in making annotated parse trees. So why these two different making of trees going on. I am just not getting the use of syntax tree


Can someone explain me how SDT is helping Intermediate code generator phase to generate the intermediate code $(8^{th}- point)$


This is what I got: Combining $7^{th}$ and $8^{th}$ point

In intermediate code generation there are 2 forms:

1. Linear form which includes postfix and 3-address code

2. Tree form which includes syntax tree and DAG

So now we can say that SDT is helping in making Syntax tree which is a part of ICG.

is syntax directed translation is done semantic analyser phase?

third phase of compiler.
0 votes
right ans is C.
by (149 points)
–5 votes
answer - B
by Loyal (8.6k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,833 questions
57,725 answers
107,841 users