Premium Only Content

Compiler From Scratch: Phase 1 - Tokenizer Generator 015: Finishing Lazy Token Evaluation
Streamed on 2024-10-25 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
Last week we started with the Lazy evaluation build option, but didn't have time to finish it. So today we finished it.
As I dug in, it became clear that I needed a way to track execution of the regex DFA states to see what was happening and when. So I started coding that in. However, that introduced a bug that caused things to crash so hard that there was no debug information. After a log to printf debugging, I narrowed it down to a single snippet of text that was being written out to a file. For some reason, copying a single word out by offset using snprintf was exploding if the source text had a "%" anywhere in it . The "%" was not in the offset/count region that was actually being copied from at all. I replaced the call to snprintf with strncpy and everything worked again. It just makes me sad how much time it took to find the reason and the solution.
Once we were back up and running there was a bit of fiddling to finish off Lazy token evaluation. There are a few differences in the way the process flows when batch processing vs lazy processing, but I found them one at a time (greatly aided by the trace log of the tokenizing process). A bit of testing with other performance flags, an update to the macros in the resulting file, and lazy processing is reasonably working for all of the build options we tested.
Next week we need to write a script to test the different combinations more automatically and efficiently. There are a lot of build configuration options now.
-
LIVE
The Jimmy Dore Show
57 minutes agoTrump Administration Sends Accused Pedo BACK TO ISRAEL! Ukrainians Now OVERWHELMINGLY Oppose War!
4,984 watching -
1:09:21
TheCrucible
2 hours agoThe Extravaganza! Ep. 24 (8/20/25)
45.1K2 -
1:18:42
Kim Iversen
2 hours agoUFO Base Area 51 Catches Fire… Is It a Massive Cover-Up?!
17K32 -
1:51:18
Redacted News
3 hours ago"There will be consequences!!!" Trump issues big threat to Putin ahead of peace summit | Redacted
84.7K50 -
53:14
Candace Show Podcast
2 hours agoThe MOST MORAL Blackmail In The World | Candace EP 231
35.2K99 -
1:11:28
vivafrei
4 hours agoMatt Taibbi Getting "Westfalled"? Kathy Hochul Fighting for Illegals! Mamdani Minority Report & MORE
85.7K31 -
2:03:39
Pop Culture Crisis
4 hours agoWTF Happened to Miley Cyrus? HARRY POTTER Set Images, Sydney Sweeney Hater EXPOSED | Ep. 901
30.5K18 -
10:17
MattMorseTV
4 hours ago $7.13 earnedTrump's DOJ just DROPPED a NUKE.
39.1K35 -
11:07
Politibrawl
12 days agoRepublican rising star DESTROYS theatrical Democrat in front of the entire world
79.4K30 -
4:42:30
StoneMountain64
5 hours agoOnly game with BETTER desctruction than Battlefield?
53.6K