Compiler From Scratch: Phase 1 - Tokenizer Generator 012: Debugging NFA to DFA conversion
Streamed on 2024-10-04 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
Short stream.
Last time we were blocked from testing the newline functionality in the tokenizer because the newline characters weren't in the DFA correctly. There was a token effort to debug the issue, but I didn't get very far at the end of the last stream. Which brings us to today where I got serious about the issue. With lots of debugging print statements I found the issue where in the NFA to DFA conversion process. The problem was that when a state was being added to the closure it was already marked as "visited" and its children were then not being processed on the next time through the loop. A quick test and clearing that flag fixed the main issue.
While the DFA was looking better, the pattern for the newline character didn't look right. I changed the newline pattern from "([\n\r]|(\r\n))" to "(\n|(\r\n?))" and was much happier about the results. Those changes let us finally test the newline function in the tokenizer. The tokens are getting the right line numbers now. I tried to trim the newline characters off the end of the line as tracked by TxtBuf, but didn't have time to finish that off.
I also did a quick test of the string regex pattern, but didn't have time to dig in, although I have some ideas to check. So I left off with a couple of loose ends due to the shortness of the stream that we'll pick up next week.
-
29:59
MYLUNCHBREAK CHANNEL PAGE
11 hours agoThe Old World, Under Our Feet?
40.6K34 -
52:56
TheTapeLibrary
13 hours ago $6.92 earnedThe Most Haunted Object in the World | The Terrifying True Story of the Dybbuk Box
39.3K4 -
30:45
World Nomac
9 hours ago$500 First Class on Amtrak's 28 Hour Texas to Chicago Route 🇺🇸
20.2K9 -
1:59:33
Mally_Mouse
4 hours agoLet's Hang!!
32.8K1 -
LIVE
GamerGril
4 hours agoLFD! LOOKING FOR AN ABSTRACT DADDY! 😉 | SILENT HILL 2
367 watching -
5:25
BuddyBrown
2 days agoThe "Disastrous" FOX NEWS Interview! | Buddy Brown
32.9K38 -
2:34:31
Jewels Jones Live ®
1 day agoTRUMP DERANGEMENT SYNDROME | A Political Rendezvous - Ep. 96
42.1K30 -
11:29
Space Ice
7 hours agoRings Of Power Season 2 Pt. 1 - You Owe Amazon An Apology - Best Movie Ever
38.7K23 -
LIVE
Tundra Gaming Live
5 hours ago $18.69 earnedThe $2500 Great Tundra Nation Get Together Giveaway Stream!!!
560 watching -
1:05:06
Athlete & Artist Show
8 hours ago $9.23 earnedHIGH STAKES Sports Betting & Casino Games
54.6K13