Premium Only Content

Compiler From Scratch: Phase 1 - Tokenizer Generator 008: Code generating Context and Token
Streamed on 2024-09-06 (https://www.twitch.tv/thediscouragerofhesitancy)
Zero Dependencies Programming!
Today we generated more code to support the tokenizer we will be generating. We generated a class to handle Context. This is a simple object that keeps all the shared state and intermediate results which are in use throughout the different stages. For starters it contains our text buffer and a list of error and warning messages. This class will grow as we need more features.
We also generated the Token class that the Tokenizer will generate. This class contains all the information about where to find the token in the text buffer and a token identifier.
Then we got a start on generating the Tokenizer itself. We have stubbed in some of the simple parts, but there are two main processing methods we could go through: lazy or batch evaluation. Both have different performance implications, so we will generate both inside of ifdef checks so we can test them both.
In all this coding, we are writing out text, and large sections are just text with no modification which we could get from a separate file and not clutter our main code generation. The idea of having code snippets in an asset folder, then an asset pipeline script which embeds the code into our code would mean we could edit our snippets easier and also not count as much of that code towards our line count. We might work on this next week ... unless I get ambitious and excited about it and do it on my own before the next stream. That happens sometimes. Especially when I don't get to work on my compiler more than once a week and start to get the shakes.
-
16:43
Mrgunsngear
14 hours ago $4.65 earnedKimber 2K11 Pro Review 🇺🇸
44.3K14 -
13:40
Michael Button
1 day ago $1.89 earnedThe Strangest Theory of Human Evolution
42.4K18 -
10:19
Blackstone Griddles
1 day agoMahi-Mahi Fish Tacos on the Blackstone Griddle
26.1K3 -
23:51
Jasmin Laine
1 day ago“Stop Wasting My Time!”—Trump's BRUTAL WARNING To Canada As Poilievre ROASTS CBC LIVE
22.8K28 -
9:54
Millionaire Mentor
1 day agoNBC Host EXPOSES JB Pritzker For Saying This About Trump
14.8K12 -
1:35:39
SB Mowing
2 days agoIt took the WHOLE NEIGHBORHOOD to uncover this yards SHOCKING SECRET
96.6K64 -
12:52
ROSE UNPLUGGED
1 day agoFrom Vision to Legacy: Charlie Kirk
62.1K22 -
1:14:22
Jeff Ahern
11 hours ago $12.27 earnedThe Sunday Show with Jeff Ahern
87.1K38 -
16:37
Professor Nez
11 hours ago🚨Internet MELTS DOWN over JD Vance & Trump BREAKING the Democrats!
76.3K198 -
18:40
itsSeanDaniel
13 hours agoPiers Morgan CALLED OUT and HUMILIATED by Andrew Tate
81.8K312