How to build a programming language in rust

I cant seem to find tutorials on how to build a programming language in rust, I've been trying to write a lexer but I can't get it to work.

Strange question. I think you need to ask this question in another platform and forum.

No, this is not strange at all, this is perfectly acceptable, for this forum.

1 Like

The question is quite open ended (and writing a compiler or interpreter for a full-fledged programming language can be a large project). For lexing and parsing specifically, you could try looking up some popular libraries and see how their tutorials and examples feel. Off the top of my head...


Another rust project for parsing text...

Some useful resources are the Crafting Interpreters book and the cranelift-jit-demo repo. The demo project is written in Rust, so it's good for practical application. And the book should help with the more conceptual aspects of writing a language.

You asked specifically about writing a lexer, but there is a lot more to a language than just parsing text. That's why I've tried to answer the broader question of "how to build a programming language in Rust".

1 Like

Introduction - Writing Interpreters in Rust: a Guide (


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.