Premium Only Content
Compiler From Scratch: Phase 1 - Tokenizer Generator 009: Generating DFA State code
Streamed on 2024-09-13 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
I have to confess to cheating ... I did some work on the compiler off-stream. I created an asset pipeline for managing Code Snippets ... large chunks of text that are the same no matter what. These Code Snippets can be divided into chunks with a line of "...", so I can write a chunk, then emit custom code, and move on to the next chunk. The other thing was I refactored TxtBuf and ChrRef to remove the circular dependency that would necessarily exist if I use ChrRef in a TxtBuf::Iterator. And now I have a TxtBuff::Iterator. But that was all the cheating, I swear! Everything else we do on-stream.
Today was starting to emit DFAStates into our Tokenizer. Each DFAState has a list of Transitions and each Transition contains a list of conditions to check, and where the next DFAState is if those conditions are met. All the code emitted today was into simple methods, one per DFAState.
But a lot of the complexity we will face will come in the form of the PerformanceSwitches I am putting in. Whenever I come to a decision that I think will impact performance I am emitting code for each of those decisions, wrapped in a #ifdef/#endif so we can change some defines in our build and test the alternatives. There is some overlap between some of the options I've thought up, so we are going to be emitting way more code than we will end up with. As we go we will confirm correctness of each PerformanceSwitch, but we won't profile until things are working end-to-end and we have a large body of text to test against ... maybe JSON? So, if this stage of development seems a little slow, remember, I am generating 96 (currently) permutations of the way this code could be written.
-
19:01
Bearing
8 hours agoHasan Piker EXPOSED 🚨 You’re NOT READY For This Video 💥
17.4K16 -
2:46:05
LFA TV
8 hours agoTHE CREST REPORT LIVE ON LFA | 2.14.26 @1PM EST
90K1 -
53:34
Jeff Ahern
3 hours ago $0.63 earnedThe Saturday show with Jeff Ahern
15.3K2 -
52:56
X22 Report
8 hours agoMr & Mrs X - Halftime Narrative Failed, Epstein Is A Puppet, Trump Is Saving America - EP 26
142K34 -
24:09
The Rubin Report
9 hours agoHow Dems Created an ICE Recipe for Disaster on Purpose | Anna Paulina Luna
66.4K56 -
20:02
WhatCulture - Film
4 days ago $4.43 earned20 Movie Reveals Nobody Noticed
44.6K2 -
6:49
RidiculousRides
1 day ago $3.27 earnedPeel P50: The 59kg Car You Can Park Indoors
49.5K7 -
13:02
WhatCulture Gaming
2 days ago $1.76 earned10 Video Games That Broke The Rules
36.5K -
2:12:02
Battlefront: Frontline with Dustin Faulkner
18 hours agoThe DoJ Leadership Reveals Failure to the People with Epstein Files During Bondi Testimony | Has the GOP Lost the Midterms with Bad Focus | Trust in Media and Government Definitely Failing in the West
40.3K13 -
7:58
CinemaBlend
2 days ago $1.21 earned'The Penguin' Interviews With Colin Farrell, Cristin Milioti, Matt Reeves And More
37.1K1