Using a flowchart to write a lexer
I could not for the life of me just start coding a lexer. I sat down on Monday and tried to figure out what to do... and failed.
So I took the advice that I've been given time and time again by my friend Matthew Plant:
"Make a f**king flowchart."
I made a f**king flowchart. The first iteration was hideous, so I revised to make it cleaner. Then I revised again. At the moment I have a recursive flowchart with an end condition... a pretty good start.
So where do I go from here? I have to translate this into code, and then test it on some bits and pieces. I plan on consulting my friend Mr Plant more heavily about this code. He's already written a whole VM... take a look at FACT.
UPDATE: So far, I have managed to make what is called a finite state machine and some code that loads instructions into memory. Yay?