GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
65 views
What is difference between lexems and tokens please explain with example
asked in Compiler Design by (45 points)   | 65 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 (28.5k points)  
selected by


Top Users Sep 2017
  1. Habibkhan

    7194 Points

  2. Warrior

    2686 Points

  3. Arjun

    2594 Points

  4. rishu_darkshadow

    2568 Points

  5. A_i_$_h

    2280 Points

  6. nikunj

    1980 Points

  7. manu00x

    1856 Points

  8. makhdoom ghaya

    1770 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points


26,164 questions
33,742 answers
79,994 comments
31,125 users