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

Discussion

Match each term with what it denotes.
List I
A. token
B. pattern
C. lexeme
D. attribute
List II
1. the actual characters matched in the input
2. a category name such as id or number
3. extra data carried with the token
4. the rule describing the form of a lexeme

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

Answer: B

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

The four terms name four different things and the distinction is worth fixing. A token is the category name the parser sees, such as id or number. A pattern is the rule describing what form a lexeme of that category may take. A lexeme is the actual run of characters matched. And the attribute is the extra information carried along with the token, such as a symbol table pointer.

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

Post your comment

Please log in or register to post a comment.