Premium Only Content
![Compiler From Scratch: Phase 1 - Tokenizer Generator 011: Dispatching DFAStates in multiple ways](https://1a-1791.com/video/s8/1/D/O/3/R/DO3Rt.qR4e-small-Compiler-From-Scratch-Phase.jpg)
Compiler From Scratch: Phase 1 - Tokenizer Generator 011: Dispatching DFAStates in multiple ways
Streamed on 2024-09-27 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
Last time It mostly implemented dispatching our DFAStates in a switch/case statement. It almost worked, but was blocked by a strange segmentation fault. Over the weekend I debugged off stream, which I don't feel that bad about because it wasn't a problem with my code. It was a problem with the gcc compiler. With no other changes, I changed an std::vector to a simple array and it worked. I changed the simple array to std::list and it worked. Then just for fun I put it back to std::vector and ... it worked! I circled all the way back to where I started with no meaningful change and it works. That is the third time I've run into it where the compiler won't generated correct code unless a very particular line of code is removed or modified, but then it works fine after it is put right back in the same way. Very strange. With that bug "fixed" I was able to generate a sequence of tokens.
Therefore, today we implemented DFAState dispatching using an array of function pointers, and another where we used an array pointer directly. for both cases, I added another #define flag to create the function pointers by lambda and by std::bind. We now have almost 200 permutations of performance flags that we can play with when we get to performance testing. In all, the new dispatch methods went it pretty easy.
After that I updated the "macros" branch of code generation. There are small helper subprocesses that could be either methods or macros, so I generate both. With a few updates I was able to test that the macro helper subprocesses work as well. And all throughout I was making small refactors as I went.
Toward the end of stream, I started adding line tracking to TxtBuf. It more or less went in without a hitch ... except that I couldn't test it because something in the NFA to DFA transformation is broken. So I sidelined the line tracking in TxtBuf to examine the bug. Removing the "GROUP" concept from NFA helped clean up the code a bit, but didn't fix the issue. We'll have to pick up there next week.
-
35:31
SB Mowing
19 hours agoThis FORGOTTEN property needed a MIRACLE after nearly a DECADE of ruin
49.3K15 -
3:03:44
The Why Files
3 days agoCOMPILATION: Pyramids, Mounds and Mountains
44.8K58 -
2:00:15
Badlands Media
23 hours agoThe Liberty Den Ep. 131
93.1K22 -
2:05:26
TimcastIRL
8 hours agoTrump NUKES IRS, Mass Fed Layoffs, Democrats REVOLT Over 200k Layoffs w/Roma Nation | Timcast IRL
118K134 -
1:39:03
Roseanne Barr
12 hours ago $28.36 earnedAdam Carolla! | The Roseanne Barr Podcast #87
109K25 -
1:29:04
Glenn Greenwald
11 hours agoTrump, Vance & Musk Announce a Radically New Foreign Policy Framework; Prof. Norman Finkelstein on Gaza's Future, the Cease-Fire Deal & Fallout from the U.S./Israeli War | SYSTEM UPDATE #407
133K88 -
4:15:00
Nerdrotic
13 hours ago $46.08 earnedCaptain Falcon America REVIEW, Disney Ending DEI? Rings of Power RETURNS | Friday Night Tights #341
201K34 -
9:34:03
FusedAegisTV
21 hours agoMario Galaxy, Batman, Real Talk/Politics, & MORE - V-Day 💗 Friday Variety Stream!
51.3K1 -
1:10:49
Vigilant News Network
9 hours agoRFK Jr. Drops a Stunning Announcement | The Daily Dose
72.2K42 -
49:49
Candace Show Podcast
12 hours agoEXCLUSIVE: Blake & Ryan’s Desperate Legal Strategy Exposed! | Candace Ep 147
186K131