Premium Only Content
Compiler From Scratch: Phase 1 - Tokenizer Generator 014: Regex code gen/testing, starting lazy eval
Streamed on 2024-10-18 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
Last week we had debugged the NFA/DFA not picking up the "ANY" operator correctly and fixed it up through the DFA. I didn't like the way it printed out in the DFA table or DFA graphviz plot, so I fixed that first thing. That was followed up with a small refactor of function names left over from last week's output improvements. Just a couple of small, easy tasks to get warmed up.
After that it was time to do code generation for the ANY operator, which was easier than expected. It was basically putting "true" inside the if condition. A little debugging around the Regex for strings and it was good to go. After that I generated code for the StartOfLine and EndOfLine anchors. The main effort was two functions added to the ChrRef, then that function was called from the tokenizer. Since the anchor operators don't consume a character there was a bit of fiddling to suppress the "munch" function call in these cases. Just a bit more finagling around detecting the end of input and all was well.
I tested a couple of possible error cases with the new processing in place. One turned out to be fine, the other caused a crash as expected (unterminated string at the end of input). This was noted in the TODO for future attention.
And finally it was time to start building out the lazy tokenizer processing. There were a few opportunities to refactor/cleanup other code as we went through this exercise. The high-level methods for doing the lazy processing are put together well enough to compile, but there are still changes needed to get the whole thing working end-to-end, mostly in the helper functions. We'll pick up there next week.
-
1:19:51
Tundra Tactical
16 hours ago $13.54 earnedThursday Night Gun Fun!!! The Worlds Okayest Gun Show
52.4K -
55:11
Sarah Westall
1 day agoHumanity Unchained: The Awakening of the Divine Feminine & Masculine w/ Dr. Brianna Ladapo
42.5K6 -
1:42:41
Glenn Greenwald
11 hours agoReaction to Trump's Primetime Speech; Coldplay "Adultery" Couple Reappears for More Shame; Australia and the UK Obey Israel's Censorship Demands | SYSTEM UPDATE #560
148K88 -
2:46:41
Barry Cunningham
9 hours agoBREAKING NEWS: President Trump Signs The National Defense Authorization Act | More News!
60.3K30 -
43:10
Donald Trump Jr.
10 hours agoThe Days of Destructive DEI are Over, Plus Full News Coverage! | TRIGGERED Ep.301
121K89 -
52:07
BonginoReport
10 hours agoThe Internet Picks Bongino’s FBI Replacement - Nightly Scroll w/ Hayley Caronia (Ep.200)
114K79 -
55:30
Russell Brand
11 hours agoStay Free LIVE from AmFest — Turning Point USA - SF665
139K14 -
1:11:26
Kim Iversen
12 hours agoTrump Pulls War Fake-Out…Attack on Venezuela Still Coming!?
90.8K118 -
2:04:53
Redacted News
11 hours agoPutin just changed EVERYTHING with this move and NATO can't do anything | Redacted w Clayton Morris
182K156 -
25:22
DeVory Darkins
11 hours agoTrump scores MAJOR WIN after Inflation Report as his speech sparks EPIC MELTDOWN
61.4K63