In my previous post, I introduced the simp le programming language. Near the end of that post, I mentioned that the parser isn't very efficient. Let's try to optimize it! If you're just curious about the title of the article, you can skip ahead to that section . (Re-)introducing simp First, a quick recap on the programming language being implemented here: fn fibonacci (n) { if n < 2…
If you're reading this, you probably know how to program a computer. You write some text, and use a special thing called a "compiler" (sometimes also "interpreter") to turn that text into instructions for your computer. I want to attempt to explain a small part of the process of transforming text into those instructions, usually referred to as "parsing", by implementing a parser in Rust in an…