Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which one of the following statements is FALSE?

  • A.Context-free grammar can be used to specify both lexical and syntax rules.
  • B.Type checking is done before parsing.
  • C.High-level language programs can be translated to different Intermediate Representations.
  • D.Arguments to a function can be passed using the program stack.

Answer: B

The false statement is Type checking is done before parsing.

Type checking is part of semantic analysis, which works on the parse tree or syntax tree. It needs to know the structure of expressions and declarations, so it comes after parsing.

The other statements are true. Regular token patterns are a special case of context-free languages, so a context-free grammar can describe both lexical and syntax rules, even though lexers usually use regular expressions. A program can be translated to several intermediate representations, such as syntax trees, three-address code or SSA form. And the program stack is the usual way to pass arguments in a function call.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.