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)

4 Years
Discussion Span
Last Post by NardCake

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".

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.