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.
-
1:11:16
Man in America
13 hours agoHow Rockefeller BURIED Silver’s Miracle Healing Powers for Big Pharma Profits w/ Jeff Adam
37.7K7 -
3:12:35
I_Came_With_Fire_Podcast
16 hours agoLive Fire (No Exercise)
76.1K13 -
39:56
TheTapeLibrary
15 hours ago $10.96 earnedThe Horrifying Legends of Lake Michigan
60.3K4 -
2:34:39
Flyover Conservatives
1 day agoEVAN BARKER | Went from Raising $50 Million for Democrat Party to Voting for Donald Trump | Special FOC Show
52.9K6 -
1:01:43
The StoneZONE with Roger Stone
7 hours agoElon Musk at War with SEC + Cara Castronuova with the Latest on the J6 hoax | The StoneZONE
48.3K3 -
1:14:00
Edge of Wonder
11 hours agoThe Multiverse Is Real: Google’s Quantum Chip Proves Other Dimensions
71.3K14 -
1:56:45
2 MIKES LIVE
9 hours ago2 MIKES LIVE #155 It's our 1 YEAR ANNIVERSARY SHOW!
52.8K1 -
44:25
Sarah Westall
9 hours agoEXPOSED PT 1: Fed Gov Involved in Multinational Money Laundering & Trafficking Ring, Senator Finchem
61K16 -
1:27:01
The Big Mig™
13 hours agoJillian Michaels ‘Unapologetic’ ‘Motivational’ ‘Life Influencer’
50.9K11 -
56:32
LFA TV
1 day agoChris Wray Lied About January 6 | Trumpet Daily 12.13.24 7PM EST
37.1K26