In earlier articles, I introduced this compiler project, wrote some Roc code to load an input file, and started implementing a tokenizer with error handling.
I think I need to admit that I have absolutely no clue how to estimate how long a blog article is going to be. I thought “build a compiler” would be one article. And then I thought “build a tokenizer” would be one article. sigh
I swear we’ll be done with tokenizing at the end of this post. But first we’ll take a detour to have a look at Roc’s very elegant built-in testing syntax.
Reminder: You are reading content that took a great deal of effort to craft, compose, and debug. If you appreciate this work, consider supporting me on Patreon or GitHub.
In part 1 and part 2 of this series, I introduced the project and we wrote some Roc code to load an input file and save the compiled result to a different file.
Note: Other articles in this series are collected here.
However, we are a long ways from actually having that compiled result available! This article introduces the phases involved in writing a compiler and focus on implementing the first phase, known as lexical analysis or tokenizing.