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.
-
2:56:14
TimcastIRL
7 hours agoEPSTEIN Files DROP, FBI GOES ROGUE, AG Says They COVERED UP Epstein Case w/Amber Duke | Timcast IRL
183K99 -
1:39:23
Kim Iversen
8 hours ago"Canada's Trump" Is Trudeau’s Worst Nightmare: Is Maxime Bernier the Future of Canada?
75.8K76 -
DVR
Bannons War Room
10 days agoWarRoom Live
2.67M446 -
16:06
The Rubin Report
14 hours agoProof the Islamist Threat in England Can No Longer Be Ignored | Winston Marshall
91.1K82 -
2:07:07
Robert Gouveia
12 hours agoFBI Files Coverup! Bondi FURIOUS; SCOTUS Stops Judge; Special Counsel; FBI Does
116K87 -
56:15
Candace Show Podcast
12 hours agoBREAKING: My FIRST Prison Phone Call With Harvey Weinstein | Candace Ep 153
173K113 -
1:56:39
Flyover Conservatives
10 hours agoROBIN D. BULLOCK | Prophetic Warning: 2030 Is Up for Grabs – If We Don’t Act Now, Disaster Awaits! | FOC SHOW
60.8K12 -
2:13:11
megimu32
8 hours agoON THE SUBJECT: The Epstein List & Disney Channel Original Movies Nostalgia!!
46.6K6 -
9:06
Colion Noir
17 hours agoKid With Gun Shoots & Kills 2 Armed Robbers During Home Invasion
58.3K13 -
54:28
LFA TV
1 day agoUnjust Man | TRUMPET DAILY 2.27.25 7PM
59.5K5