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.
-
19:18
DeVory Darkins
6 hours ago $23.55 earnedDemocrat non-profit SCAM EXPOSED as Trump OBLITERATES Newsom
35K71 -
23:58
Stephen Gardner
8 hours ago🔥Obama THROWS Adam Schiff under the bus to obstruct Trump!
27.6K110 -
38:44
The Why Files
4 days agoProject Ancient Arrow | The NSA's Secret War Against Our Future
63K74 -
2:36:06
Barry Cunningham
10 hours agoPRESIDENT TRUMP IS TRULY USHERING IN THE GOLDEN AGE OF AMERICA! CAN YOU FEEL IT?
114K44 -
3:47:25
SynthTrax & DJ Cheezus Livestreams
3 days agoFriday Night Synthwave 80s 90s Electronica and more DJ MIX Livestream 2K Celebration SPECIAL EDITION 530pm PST / 830pm EST
55.7K5 -
2:21:54
VapinGamers
7 hours ago $3.67 earnedDestiny 2 - Edge of Fate Legendary Run Part 3 - !rumbot !music
31K -
2:04:25
TimcastIRL
9 hours agoTrump DOJ Gives Ghislaine Maxwell Limited IMMUNITY As She Rats On 100+ People | Timcast IRL
238K179 -
1:09:09
Omar Elattar
11 hours agoThe Brain Experts: Your Brain Can Rewire Itself At Any Age & Here's How!
27.7K4 -
4:30:37
IcyFPS
7 hours agoLIVE - Wuchang Fallen Feathers x Borderlands w/ pope!
35.9K2 -
29:24
Afshin Rattansi's Going Underground
21 hours agoWas Epstein a Mossad Agent? Will Obama go to Prison? (Afshin Rattansi vs Alan Dershowitz)
34.9K28