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:45:43
Man in America
14 hours agoThe DISTURBING Truth About Parasites — Live Q&A w/ Dr. Jason Dean
71.1K38 -
7:13:47
SpartakusLIVE
10 hours ago#1 Mountain of Muscle with HUGE Legs saves your weekend from complete BOREDOMNight HYPE
42.3K1 -
47:42
Sarah Westall
11 hours agoFreedom or Slavery? AI will Change Everything w/ Trump Senior Advisor Marc Beckman
56.7K12 -
2:23:20
vivafrei
18 hours agoEp. 285: Visa Revocation No-Go! Sortor Arrested! Ostrich Crisis! 2A Win! Comey Defense & MORE!
115K110 -
5:55:11
CassaiyanGaming
8 hours ago🟢LIVE - VISITING GOOB LAGOON! - Will They Rip Me Off?!? Waterpark Simulator
41.8K4 -
5:42:21
EricJohnPizzaArtist
6 days agoAwesome Sauce PIZZA ART LIVE Ep. #64: Robbie “The Fire” Bernstein
48.5K2 -
2:23:58
Nerdrotic
11 hours ago $18.87 earnedDeDunking the Debunkers with Dan Richards | Forbidden Frontier #119
63.1K15 -
5:37:53
SlinderPigCamz
9 hours ago $1.78 earnedThe Headliners and other games W/GrinchyGamer101 (Road to 500 Followers)
26.3K -
11:10:20
MrOldFart
13 hours ago $6.42 earnedLIVE - MEGABONK First Playthrough - Mr.OldFart
35.2K -
9:06:53
GritsGG
14 hours agoWarzone Win Grinding! Most Wins in WORLD! 3680+!
87.3K1