# What is token-type in Lexical analysis?

I'm currently studying compiler construction book "Compilers Principles, Techniques, and Tools (2nd Edition)" , in page unit 3.1 , page 113 , example 3.2 .

i cannot understand what is this kind of method ?

E = m * 2;

conversion to token types(this method) below

<id , E> <op=> <id , m> <op*> <number , 2> <op;>


it is token-type pairs ? or is there any technical term associated ?

• When you say "this kind of method", what kind of method are you talking about? I'm not sure what you're referring to. Can you edit the question to make the question self-contained? I don't have the book and can't look at that page of the book, so I can't tell what you are asking about. – D.W. Sep 29 '15 at 23:06

I don't know what is the proper name for what you're seeing, but it is the standard way to lexically analyze text. You divide it into tokens of specific types. For the sake of context-free parsing (the next step in the parsing chain), you only need the type of each lexeme; but further steps down the road will need to know the semantic content (sometimes called annotation) of each lexeme. For example, the context-free parser doesn't care which number $2$ is; it only needs to know that it's a number. Further down the road, it will suffice to know that this number is an integer. Even further, you would need to know that this integer is specifically $2$.