Hello! I'm very interested in compiler/language design but It's an extremely complicated topic so I've recently tried to wrap my head around and understand one of the beginning and main parts, lexical analyzation. I'm not here to ask for code or anything but I've tried thinking up various methods of implementing a simple lexical analyzer but everytime I think I have something going I realise there are so many things that could go wrong.

So my question is in the simplest and most reliable form how are lexers written and how do they work?
Thanks for any information!
(I am aware in tools such as lex/flex I'm just curious how it works)

There are some execellent books on the subject. Two that I have used are Fischer and Blank "Crafting a Compiler" and Holub's "Compiler Design in C".

I suppose I'll have to take a look!
Thanks.

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.