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.
-
LIVE
Wendy Bell Radio
5 hours agoWhat A Long, Strange Trip It's Been
7,680 watching -
LIVE
LFA TV
13 hours agoLIVE & BREAKING NEWS! | THURSDAY 10/16/25
3,700 watching -
2:02:00
Game On!
19 hours ago $1.81 earnedTwo 40 Year Old QBs BATTLE It Out On Thursday Night Football!
22.4K2 -
1:22:45
Tucker Carlson
13 hours agoTucker & Steve Bannon on Jay Jones’ Desire to Genocide Republican Kids and the Future of the Right
128K198 -
12:21
Ken LaCorte: Elephants in Rooms
19 hours ago $2.87 earnedWill Trump Take Greenland?
25.5K16 -
36:57
RiftTV
12 hours agoPREMIERE: DC Dive with Jordan Conradson | Guest: Ben Bergquam | Pilot Episode #1
43.9K5 -
8:35
Faith Frontline
14 hours agoAndrew Huberman Just SHOCKED The World With His Belief in God
26.6K9 -
1:59:43
BEK TV
1 day agoTrent Loos in the Morning - 10/16/2025
30.9K3 -
1:58:09
Dialogue works
2 days ago $4.78 earnedLarry C Johnson & Paul Craig Roberts: Can peace be imposed on Israel? - Russia and China Step In
47.8K23 -
8:10
Nate The Lawyer
2 days ago $5.15 earnedNY AG Letitia James Pattern | All 3 Mortgages Have False Statements
40.3K33