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

Discussion

A Lex specification is divided into

  • A.a lexical part and a syntactic part separated by a blank line
  • B.one section per token that the scanner is to recognise
  • C.a grammar section followed by the semantic actions for each rule
  • D.a declarations section, a rules section and a user code section

Answer: D

Correct answer: a declarations section, a rules section and a user code section

The three sections are separated by lines containing %%. The declarations hold regular definitions and any C declarations needed; the rules pair each pattern with the action to run when it matches; and the user code section is copied verbatim into the generated file, and is where supporting functions go.

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

Post your comment

Please log in or register to post a comment.