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

Discussion

A scanner generator such as Lex or Flex produces

  • A.a machine independent form of the program ready for optimisation
  • B.the symbol table implementation used by the rest of the compiler
  • C.a program that recognises the specified tokens in an input stream
  • D.a parser that checks the input against a context free grammar

Answer: C

Correct answer: a program that recognises the specified tokens in an input stream

Lex takes a specification of patterns with actions and emits source code for a scanner - typically a table-driven automaton together with the driver that runs it. The scanner it produces recognises the specified tokens and executes the corresponding action for each. Producing a parser is the job of a separate tool such as Yacc.

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

Post your comment

Please log in or register to post a comment.