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

Discussion

In a compiler, keywords of a language are recognized during

  • A.parsing of the program
  • B.the code generation
  • C.the lexical analysis of the program
  • D.dataflow analysis

Answer: C

Keywords are recognised during the lexical analysis of the program.

The lexical analyser (scanner) reads the character stream and groups it into tokens such as identifiers, numbers, operators and keywords. Keywords are usually recognised there, often by first matching an identifier and then looking it up in a table of reserved words.

The parser works on the tokens the scanner has already produced, and code generation and dataflow analysis come much later in the compiler.

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

Post your comment

Please log in or register to post a comment.