in Compiler Design retagged by
11,591 views
28 votes
28 votes

Which one of the following statements is FALSE?

  1. Context-free grammar can be used to specify both lexical and syntax rules
  2. Type checking is done before parsing
  3. High-level language programs can be translated to different Intermediate Representations
  4. Arguments to a function can be passed using the program stack
in Compiler Design retagged by
by
11.6k views

3 Answers

54 votes
54 votes
Best answer
A. Since Lexical rules are nothing but regular expressions, we can use CFGs to represent such rules.(Every Type-$3$ grammar is Type-$2$ grammar) Additionally, syntax rules can be represented by CFGs. (True)

B. Type checking is done during Semantic Analysis phase which comes after Parsing. (False)

C. We have various types of Intermediate Code Representations, ex $3$-address code, Postfix notation, Syntax trees. (True)

D. Program stack holds the activation record of the function called, which stores function parameters, return value, return address etc.(True)

Correct Answer: $B$
edited by

1 comment

Can u please explain what is lexical rules & syntax rules here ??
0
0
10 votes
10 votes
Type Checking always be done after parse tree generation.
So option (b) is FALSE.
2 votes
2 votes
B is clearly false as type checking is done using SDTs which is basically semantic analysis.SDTs are basically parse trees hence parsing needs to be done first and then only can we do type checking.
by
Answer:

Related questions