Compiler From Scratch: Phase 1 - Tokenizer Generator 006A: Bug fix then getting NFA/DFA from config.

3 months ago
9

Streamed on 2024-08-23 (https://www.twitch.tv/thediscouragerofhesitancy)

Zero Dependencies Programming!

Interrupted stream today. My UPS started popping, so I terminated rather abruptly to troubleshoot that before everything went down. We were back online in minutes. There is a part B.

Starting off the day with a bug from the week before is a little rough. I didn't even remember what the bug was. That's a drawback to once-a-week programming projects. But we dug in, and with an excess of print statements we figured it out, no thanks to gdb. I just needed to initialize a pointer to null.

With that out of the way we quickly gathered the token names into a unique list so we would have a unique TokenID/TokenName mapping. Then it didn't take long to go through each rule, compute the NFA from the pattern, and mash all the small NFAs into a single NFA. With a single NFA in hand it was trivial to get the DFA for the whole thing.

This is where we had to break while I checked out my UPS.

Loading comments...