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.
-
2:56:28
IsaiahLCarter
17 hours ago $9.00 earnedThe Tri-State Commission, Election Weekend Edition || APOSTATE RADIO 033 (Guest: Adam B. Coleman)
38.3K6 -
15:03
Demons Row
12 hours ago $12.46 earnedThings Real 1%ers Never Do! 💀🏍️
61.7K21 -
35:27
megimu32
15 hours agoMEGI + PEPPY LIVE FROM DREAMHACK!
181K15 -
1:03:23
Tactical Advisor
19 hours agoNew Gun Unboxing | Vault Room Live Stream 044
261K40 -
19:12
Robbi On The Record
20 hours ago $23.21 earnedThe Loneliness Epidemic: AN INVESTIGATION
96.1K109 -
14:45
Mrgunsngear
1 day ago $148.96 earnedFletcher Rifle Works Texas Flood 30 Caliber 3D Printed Titanium Suppressor Test & Review
155K35 -
17:17
Lady Decade
1 day ago $12.51 earnedMortal Kombat Legacy Kollection is Causing Outrage
101K24 -
35:51
Athlete & Artist Show
1 day ago $14.16 earnedIs Ryan Smith The Best Owner In The NHL?
104K17 -
22:56
American Thought Leaders
2 days agoCharles Murray: I Thought Religion Was Irrelevant to Me. I Was Wrong.
84.3K64 -
36:22
Brad Owen Poker
21 hours agoGIGANTIC $17,000+ Pot In BOBBY’S ROOM! TRAPPING Top Pro w/FULL HOUSE!! Big Win! Poker Vlog Ep 326
87.7K16