How to write a compiler or interpreter in rust

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • Mergify - Tired of breaking your main and manually rebasing outdated pull requests?
  • SonarLint - Clean code begins in your IDE with SonarLint
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • rust-langdev

    Language development libraries for Rust

  • nom

    Rust parser combinator framework

    Parsing framework:

  • Mergify

    Tired of breaking your main and manually rebasing outdated pull requests?. Managing outdated pull requests is time-consuming. Mergify's Merge Queue automates your pull request management & merging. It's fully integrated to GitHub & coordinated with any CI. Start focusing on code. Try Mergify for free.

  • marwood

    An embeddable Scheme R7 Compiler & Runtime written in Rust

    The lexer can be found here and parser here.

  • TablaM

    The practical relational programing language for data-oriented applications

    Exist some non-obvious things about interpreter implementation with Rust, so i share my opinions while building

  • inko

    You can use Inko as a reference, as its VM is written in Rust. I do recommend using this branch instead of the latest release, as there are a lot of upcoming changes to the language as a whole.

  • Oga

    Oga is an XML/HTML parser written in Ruby.

    In terms of parsing style I suggest sticking with a hand-written recursive-descent parser. Parser generators seem appealing at first, but I always ran into annoying limitations when using them (I wrote one in Ruby myself as well, and used this for this project). Parsing combinators are useful for small inputs, but I find them difficult to use for anything but simple cases.

  • cranelift-jit-demo

    JIT compiler and runtime for a toy language, using Cranelift

    Backend IRs for code generation: - Cranelift (see as well as the messages on the Zulip chat if you get stuck)

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts