Skip to content

Write an (online) book about writing interpreters in Rust #7

@yorickpeterse

Description

@yorickpeterse

By providing a book of sorts (e.g. using https://www.gitbook.com/) we would solve two problems:

  1. With the book focusing on Rust we'd hopefully make Rust more attractive for language designers
  2. By clearly explaining how to implement certain patterns it will hopefully become easier for everybody to write a language

The book wouldn't focus on writing an interpreter from start to finish (that's a lot of work), instead it would focus more on specific patterns (e.g. how do I write an interpreter loop, how do I come up with a bytecode format, etc, etc). For the sake of keeping the scope limited we should probably start with an interpreter, but maybe over time we can also extend it to writing compilers.

Some topics to cover would be (in no particular order):

  1. How to write an interpreter loop
  2. Writing allocators for a custom object model/heap
  3. Basic garbage collection (naïve mark & sweep)
  4. Advanced garbage collection (Immix)
  5. Parsing/using a bytecode format
  6. Handling errors triggered by the programming language (e.g. an alternative to a straight up panic!)
  7. Concurrency (e.g. regular threads, green threads)

I'm not sure if we should cover parsing. Unfortunately many of existing programming language resources fall for the trap of only covering parsing, which I think is one of the most boring parts of a programming language. It's also very easy to get stuck bike-shedding about the syntax and how to parse it, instead of just focusing on writing an interpreter/allocator/etc.

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bookWriting Interpreters in Rust book

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions