Build Your Own Lisp (in Rust)

Update: This particular attempt at building a Lisp didn’t work out, but you can check out my more recent attempt if you’re interested.

Lately I’ve been playing around with the Rust programming language a lot, and I’ve been loving it, I think mostly because I love the community. I’ve never been to a Rust meetup where I didn’t have a great time.

I’ve also started the online book Build Your Own Lisp. It teaches C by demonstrating the creation of a simple REPL for a subset of the Lisp language. Lisp is a fascinating language, and you really should read The Little Schemer when you have a chance. I’m interested in learning C, but I’m just as interested in learning Rust.

Therefore, I’m going to go through Build Your Own Lisp and try to translate the code samples from C into Rust. Fair warning: I know little Rust and less C, so it’s likely that I won’t write code that experts in those languages will love. But I’ll learn a lot, and I do promise that the code I post will compile and run correctly.

The first chapter of Build Your Own Lisp is about setting up a toolchain. Here’s my setup for writing Rust on Windows 10:

  1. Visual Studio Code
  2. rustc
  3. Rusty Code plugin for VS Code
  4. Rust Language Services
  5. PowerShell

PowerShell I use simply because it’s easier to copy and paste commands around in PowerShell than it is in cmd.

These are just recommendations. I use VS Code because it’s fast, it’s easy to customize, it has syntax highlighting for Rust, and it’s free. So that’s the tool chain. It should let you get started.

Till next time, happy learning!


1 thought on “Build Your Own Lisp (in Rust)”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s