Sorry guys, I know it is not C++ specific, but Wikipedia confused me.
I have devoted a little time to look at programing tools and little on their innner workings. This term have boggled my mind.

So any explanation on what this animal is?
Thanks

Recommended Answers

All 7 Replies

a lexer is a program that runs through text and converts it into something you can use in your program an example would be a program that lets you input something like 5x^5 - 3x^3 + 20x^2 +5x -15. it would convert all of those into tokens that your program can use to output a solution. at least this is what i believe it is.

Haven't got you well can you elaborate your example?
Thanks for reply

This goes very much in depth but seems to have some good background in the beginning. Lex is a specific lexer but the concepts are the same.

The lexer turns source code into something that's easier to parse. That's really all there is to it. ;)

The lexer turns source code into something that's easier to parse. That's really all there is to it. ;)

So it turns source code into something IT can parse. So you mean it have nothing to do with human readable part. Have I got you well?

>So you mean it have nothing to do with human readable part.
Pretty much. We're talking about individual tokens such as operators, numbers, identifiers, etc... The parser should simply be able to take a token and work with it rather than try to recognize what it represents first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.