Premium Only Content

Compiler From Scratch: Phase 1 - Tokenizer Generator 022: Resolving DFA state ambiguity
Streamed on 2024-12-13 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
Last week we got stuck by the fact that DFAs can have overlapping transitions. In these cases the first test always wins and there is no way to jump off an invalid track onto another valid track once it starts down a track. So we fixed that today.
The trick is to think of each transition as a set of characters; a set in the mathematical sense. When processing the transitions we look for overlapping sets. If they overlap we compute:
1) Which characters are only in the first set
2) Which characters are only in the second set
3) Which characters are in both sets, and treat that as a new transition that follows the lowest rule number (rule order precedence).
Then add each of these three onto the unprocessed list for further checking. Once a transition makes it all the way through the unprocessed list without overlapping any other sets, this transition if put on the processed list. This process also has the added benefit of making the order we check the transitions in not matter at all. We can shuffle the transitions into any order, and since they don't overlap any more, they will all be checked eventually and not get cut off by an overlapping rule. Now the DFA looks much messier, but it is finally correct.
With that change done the testing of VVProject tokenizer proceeded. It didn't take much fiddling to get it the way we want. We had already done most of the plumbing into VVProject last week and with a bit of tweaking it was working just fine there as well.
I started down the road of making a tokenizer for the VVTokenizerDefinition, but got sidetracked thinking about multiple-encodings support in that tokenizer. I started down a dark road trying to make that work, but where VVProject calls VVTokenizerDefinition was where I found the problem: for the "Multi" encoding to work it would have to know the encoding when we generate the tokenizer itself. We can't switch that encoding behavior at tokenizer runtime with this system, only at tokenizer generation time. And the biggest problems is the REGEX tokenizing rule. That will have to support anything at tokenization time. I have a plan, but ran out of time by the time I had thought it through. We'll have to remove some of the work we did today, but that will have to wait for next week.
-
40:43
Randi Hipper
54 minutes agoBIG WEEK FOR BITCOIN! LATEST PRICE UPDATE
14.6K -
LIVE
LFA TV
12 hours agoLFA TV ALL DAY STREAM - MONDAY 9/15/25
4,495 watching -
1:26:16
JULIE GREEN MINISTRIES
3 hours agoLIVE WITH JULIE
114K215 -
LIVE
The Pete Santilli Show
3 hours agoOur Memorial & Prayer Vigil For Charlie Kirk - September 15, 2025
505 watching -
2:06:59
Welcome to the Rebellion Podcast
23 hours ago $1.75 earnedWhere Do We Go From Here? - WTTR Podcast Live 9/15
29K1 -
1:58:52
The Chris Salcedo Show
18 hours ago $3.77 earnedFALLOUT: Charlie Kirk's Assassination
29.3K9 -
4:04:01
The Bubba Army
3 days agoCharlie Kirk's Shooter, Had a Trans BF? - Bubba the Love Sponge® Show | 9/15/25
53.2K16 -
30:31
DeVory Darkins
16 hours ago $9.71 earnedCNN forced to admit the shocking truth about shooter as Fetterman drops bomb on Democrats
35.9K86 -
20:54
Professor Nez
18 hours ago🚨BREAKING: Shooter’s Own Words in Charlie Kirk Case Revealed
18.9K17 -
16:48
itsSeanDaniel
18 hours agoGenius Republican Defends Charlie Kirk and CALLS OUT The Radical Left
15.8K4