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.
-
LIVE
GritsGG
5 hours ago#1 Most Warzone Wins 4015+!
45 watching -
16:30
Stephen Gardner
3 hours ago🚨OVAL OFFICE EXPOSES TRUMP TAKEOVER – FILIBUSTER NUKED!
8.73K19 -
LIVE
The Rabble Wrangler
15 hours agoThe Best in the West Dominates Battlefield
24 watching -
LIVE
cosmicvandenim
3 hours agoCOSMIC VAN DENIM
51 watching -
1:34:03
Redacted News
3 hours agoBREAKING! CIA FURIOUS & EMERGENCY WHITE HOUSE MEETING - ISRAELI SPY CAUGHT MEETING WITH AMB HUCKABEE
113K112 -
1:22:06
vivafrei
4 hours agoCFIA Goes After a REFUGE? Charlie Kirk Missing Evidence "Uncovered"? Democrats are Epostein Simps!
119K58 -
1:44:33
The Quartering
5 hours agoTrump Calls For Hangings, McDonalds SNAP Controversy, The Demonic Relationship In Wicked & More
146K66 -
21:40
Bitcoin Policy Institute
7 hours agoCongressman Warren Davidson Unveils the “Bitcoin for America Act” | Spotlight Series #1
27.1K -
LIVE
LFA TV
21 hours agoLIVE & BREAKING NEWS! | THURSDAY 11/20/25
965 watching -
freecastle
9 hours agoTAKE UP YOUR CROSS- Let your eyes LOOK directly FORWARD, and your gaze be STRAIGHT before YOU!
16.2K14