The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
84 views
What is difference between lexems and tokens please explain with example
asked in Compiler Design by (169 points) | 84 views

1 Answer

+5 votes
Best answer
-    Token: Basic units of a code eg: keyword, operator, and identifier.
-    Pattern: Rule that specifies a token.
-    Lexeme: A set of characters that matches a pattern of a token.
Eg 1: “shiva” is a lexeme that matches a pattern of ‘identifier’ token.

Eg2: "continue” is a lexeme that matches a pattern of ‘keyword’ token.
answered by Veteran (31k points)
selected by


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,834 questions
36,686 answers
90,617 comments
34,640 users