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
Total Horse Channel
1 hour ago2025 WDAA Western Dressage World Championship Show | Day Two | Arena Four
180 watching -
LIVE
LFA TV
4 hours agoLFA TV ALL DAY STREAM - WEDNESDAY 9/17/25
4,638 watching -
1:15:33
JULIE GREEN MINISTRIES
3 hours agoLIVE WITH JULIE
78.8K161 -
3:59:03
The Bubba Army
23 hours agoState of Utah Wants Tyler Robinson DEAD! - Bubba the Love Sponge® Show | 9/17/25
62.3K6 -
LIVE
JuicyJohns
1 hour ago $0.19 earned🟢#1 REBIRTH PLAYER 10.2+ KD🟢
79 watching -
29:02
ChopstickTravel
7 days ago $2.84 earnedToronto's #1 Chilli Crab 🇨🇦 Canada's Seafood Meets China's Wok ft.@InstaNoodls
68.9K1 -
17:07
Fit'n Fire
5 days ago $1.27 earned*NEW* Bulgarian RPK Mag That Actually Work?
18K5 -
10:56
Nicholas Bowling
20 hours ago $3.36 earnedBisexual “Christian” CONFRONTS Preacher on College Campus!
25.7K21 -
1:57:04
BEK TV
1 day agoTrent Loos in the Morning - 9/17/2025
18.6K -
9:50
Red Pill MMA
21 hours agoCandace Owens Exposes What Really Happened With Charlie Kirk!
28.5K33