Which one of the following statements is FALSE?
View worked solution
Answer: B
To determine which statement is false, let's analyze each option based on standard compiler design phases and principles:
- Option A: Context-free grammar can be used to specify both lexical and syntax rules.
True. Although regular expressions are preferred for lexical analysis due to their simplicity and efficiency, context-free grammars (CFGs) are a superset of regular grammars. Therefore, any lexical rule that can be described by a regular expression can also be specified using a CFG. - Option B: Type checking is done before parsing.
False. Type checking is a key task of the semantic analysis phase. Semantic analysis requires the structural representation of the source code (such as a parse tree or an Abstract Syntax Tree), which is generated during the parsing (syntax analysis) phase. Thus, parsing must occur before type checking can take place. - Option C: High-level language programs can be translated to different Intermediate Representations.
True. A compiler can employ multiple levels of Intermediate Representation (IR)—such as high-level ASTs for early optimizations and low-level Three-Address Code (TAC) or Static Single Assignment (SSA) form for machine-independent optimizations. - Option D: Arguments to a function can be passed using the program stack.
True. In standard runtime environments, function arguments are commonly pushed onto the activation record (stack frame) on the program stack before control is transferred to the callee.
Since statement B is incorrect, it is the correct choice.
Free practice · Your answers on this page are not saved.
