Premium Only Content

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.
-
3:14:51
Barry Cunningham
6 hours agoTRUMP WEEKEND BRIEFING: THIS IS THE REAL THREAT TO AMERICA! (FYI...IT'S NOT WHO YOU THINK!)
21K24 -
2:04
Sean Unpaved
12 hours ago $4.48 earnedUnpaved w/Sean Salisbury
54.1K4 -
50:39
The Connect: With Johnny Mitchell
9 hours ago $0.58 earnedInside The War For Tijuana: How Mexican Cartels Turned Tijuana Into World's Most VIOLENT City
8.05K2 -
12:34
TimcastIRL
9 hours agoWaPo Staffers QUIT Over Bezos’ Change To Opinion Section, Liberal Media MELTING DOWN
68.4K52 -
24:55
MYLUNCHBREAK CHANNEL PAGE
1 day agoThe Sumerian King's List
89.5K34 -
DVR
Man in America
13 hours agoIs Trump Using Gold to Dismantle the City of London Banking Cartel? w/ Eric Yeung
28K4 -
33:50
The Why Files
8 days agoCryptids Vol. 3: The Antarctic Cover-up | Predators Beneath the Ice
108K134 -
27:11
Stephen Gardner
12 hours ago🔥Trump Zelensky Meeting ends in IMPEACHMENT | MUSK shares major dirt on Joe Rogan Podcast
108K256 -
2:40:23
Jewels Jones Live ®
3 days agoTRUMPARENCY | A Political Rendezvous - Ep. 112
101K30 -
1:13:14
Michael Franzese
12 hours agoEmergency Livestream: Zelenskyy vs Trump, DOGE, Epstein Files, Elon Musk
123K91