retagged by
19,783 views

1 Answer

Best answer
5 votes
5 votes

Lexeme pg. 111

A lexeme is a sequence of characters in the source program that matches the pattern for a token and is identified by the lexical analyzer as an instance of that token.

Token pg. 111

A token is a pair consisting of a token name and an optional attribute value. The token name is an abstract symbol representing a kind of lexical unit, e.g., a particular keyword, or sequence of input characters denoting an identifier. The token names are the input symbols that the parser processes.

Pattern pg. 111

A pattern is a description of the form that the lexemes of a token may take. In the case of a keyword as a token, the pattern is just the sequence of characters that form the keyword. For identifiers and some other tokens, the pattern is more complex structure that is matched by many strings.

Source: https://stackoverflow.com/questions/14954721/what-is-the-difference-between-a-token-and-a-lexeme

selected by

Related questions

0 votes
0 votes
1 answer
1
syncronizing asked Sep 21, 2018
5,362 views
Question:Find the number of tokens in the following C code using lexical analyzer of the compiler.
0 votes
0 votes
2 answers
2
saumya mishra asked Jun 12, 2018
2,263 views
In this question we will take n-=n1 as n=n-n1 as 5 tokens or n-=n1 as 4 tokens ????
1 votes
1 votes
2 answers
3
set2018 asked Jan 7, 2018
693 views
1) 82) 93) 124) 10