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

Discussion

Match each term with its correct description.
List I
A. token
B. lexeme
C. pattern
D. attribute
List II
1. the rule describing what lexemes a token matches
2. a category such as identifier or number
3. extra information such as a symbol table pointer
4. the actual characters matched in the source

  • A.A-2, B-4, C-1, D-3
  • B.A-4, B-2, C-1, D-3
  • C.A-2, B-4, C-3, D-1
  • D.A-3, B-1, C-4, D-2

Answer: A

Correct answer: A-2, B-4, C-1, D-3

The four terms describe one relationship from four sides. A token is the category - identifier, number, keyword. A lexeme is the actual characters matched in the source.

A pattern is the rule, usually a regular expression, describing which lexemes a token admits. An attribute is the extra information carried with the token, such as a symbol table pointer or a literal's value. Category, instance, rule and payload - keeping those four ideas apart is the whole of the matching.

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

Post your comment

Please log in or register to post a comment.