My target is to implement a very simple lexical analysis of the C language, such as when you read an expression ab=3, then It will be analysed as:
ID<ab> OP<=> LIT<8> (op will be "operator",LIT will be "literal").
There is also an situation when you read an expression a ? b :c. normally it will be analysed as
ID<a> SEP<?> ID<b> SEP<:> ID<c>".
but as we know It actually is the ternary operator. So the analysis listed above is not correct.
Now I just want to refer to a compiler such as gcc, g++ and check how do these compilers implement the lexical analysis? Anyone who can give me an suggestion ?