Success StoriesBlog
drawing of a human head from behind with scribbled text above, saying raytracing, rust, automata interpreter and compile
Webentwicklung |

Learning Rust by learning something new

Jannik Keye

February 14, 2020

I’m not quite sure anymore why I started learning Rust. Perhaps out of sheer curiosity, but perhaps also because of a sneaking feeling of inferiority after having completed my bachelor’s degree. During my studies I found a passion for programming. I had not studied computer science, though, so the vast majority of my knowledge has been self-taught. Everything I learned fell more into the sphere of high-level, rather than low-level, programming. I knew a few things, I was good at what I was doing and I loved doing it. But there was still so much I did not know. How exactly do the languages I work with on a daily basis work under the hood? What is it like to work “closer to the metal”? Do I want to do this for the rest of my life?

These may have been some questions I asked myself back then. The last question, though, I can say for certain crossed my mind on more than one occasion. I felt that I needed to branch out, see what is out there. And, oh boy, did I choose a great time for doing just that — early 2017. Those were the days I would discover Rust.

At the time I was researching different languages like Go, Haskell and Python. Looking back, I most likely chose to learn Rust because of the vareity of things you can do with it. Another plus was that the syntax didn’t look that unfamiliar. Rust seemed like a perfect fit for me. Learning new things and branching out into different fields seemed easily achievable with Rust.

I didn’t want to learn the language by just continuing my daily work except with Rust. I wanted to use the opportunity to learn something new — things I never came across during my studies. In the following section, I’ve compiled a list of things I set out to do to not only learn Rust but also new ways I could apply programming.

Cellular Automata

Screencast of a Predator (red) and Prey (green) cellular automaton in action

A “Predator (red) and Prey (green)” cellular automaton in action. A never-ending cylce of life and death.

During a Youtube binging session I came across this channel, specifically this video where the creator, Hopson, writes a cellular automaton — a grid of cells that behave according to a set of rules based on the states of their neighbours — using C++ and SFML. That looked pretty cool and I was intrigued, to say the least. At the time I had read through a book on Rust and was looking for a practical use for the language. Writing a cellular automaton is a great way to start learning a language; you don’t need much to get started. Simply find an automaton and it’s ruleset and get started. For the automaton I wrote I didn’t use any graphics; I simply printed the grid to the terminal. The resulting code can be found here. It’s not much but it helped me to familiarise myself with some language features of Rust as well as the infamous borrow checker — the languages way of making sure a program is memory safe.

Writing an Interpreter/Compiler

screencast of code writing an interpreter compiler

The “Monkey” Language in Action

Sometime last year after having not touched any Rust code in quite a few months due to being busy with my master’s thesis, I came across Thorsten Ball and his two books: „Writing an Interpreter in Go” and „Writing a compiler in Go”. I had seen them a few times on the Rust subreddit and in other places; people seemed to recommend these books left and right. While working myself through the first book I discovered something very important: even though the language used in these books is Go that doesn’t impede me from writing the interpreter in Rust. Quite the contrary, it actually enhances the learning experience. Having to adapt concepts from one language to another really helps to deepen the understanding of those concepts in the language you are trying to learn. Additionally, I finally understood how interpreted languages work under the hood. I learned about lexing, parsing, evaluating, building a REPL, operator precedence and implementing language features. Things I’ve heard a lot about but never really had a deep understanding of. I have yet to complete the interpreter book and have only read a few pages of the compiler book — there are still many lines of code to write and much to learn. My crappy code can be found here. Don’t use it for reference, I’ve seen so much better out there.

Raytracing in a Weekend

Similar to the previous section, the Ray Tracing in One Weekend Series is a great resource to make use of while learning a new language. Additionally, ray tracing — a way of rendering realistic 3D computer graphics scenes by simulating rays of light — is a damn interesting topic and you get to see results quite quickly. The author Peter Shirley uses C++, so again you have to adapt programming concepts to Rust and are in for a great learning experience. I’ve only gotten close to the end of book 1 and still have to iron out a few bugs. I am definitely looking forward to diving into the rest of the series. Writing a ray tracer is a really fun and rewarding starting task when learning a new programming language.

Here is the current state of my ray tracer. There is a bug with refractions currently which is quite hard to track down. The left sphere is supposed to be made out of glass, but the refractions look off. There’s still much to do and learn.

rendering realistic 3D computer graphics scenes by simulating rays of light

It’s not much, but its all the ray tracer currently produces.

rayn, by GitHub user @termhn, is an impressive example of a ray tracer that started out the same way but has been extended and modified substantially. You’ll find many more examples on GitHub.

If you have found any other resources that fall into a similar category as the ones outlined above please let me know! I’m always looking for new and interesting things I can build in Rust. Currently, I’m planning to finish up the interpreter book and the ray tracing books. Maybe someday I’ll find the time and courage to start the compiler book. Other than that I really want to use Rust to write a simple game. Maybe an ASCII rogue-like? There are so many fun things to do and so little time. But I know the chance to work on these fun projects and in the process continue learning new things will keep me coming back to Rust.

Here are some links to get you started on your journey to learning Rust:






Weitere Themen

Jannik Keye, 12/01/2020

Using Framework Agnostic Web Components in your React Application

web components

custom elements

shadow dom

micro frontends



Zum Blogartikel

Judith Urban, 09/28/2020

How a battle over a trip to Europapark forced us to build a voting app

Voting App

Instant Runoff Voting

Group Decision Making



Zum Blogartikel

Lisa Giese, 04/22/2020

Lessons learnt about working from home before it was mandatory

Remote Working

Home Office

Work From Home

Company Culture


Zum Blogartikel

Wir sind Peerigon, eine Agentur für Softwareentwicklung.

Peerigon GmbH
Werner-von-Siemens-Straße 6
86159 Augsburg
+49 821 907 80 86 0

mail peerigon


Full-stack Consulting

Software Development

Programming Workshops

Team Support


Success Stories


© 2020 Peerigon

Privacy Policy

Legal Notice