Skip to content

Build an interpreter and a compiler for the `Lox` language in various programming languages

License

Notifications You must be signed in to change notification settings

AdityaGudimella/intcomp

Repository files navigation

Interpreters and Compilers

Build an interpreter and a compiler for the Lox language in various programming languages.

Introduction

I attended David Beazley's bootcamp on writing a compiler. As part of the course, I read the book Crafting Interpreters and really liked it. I also read Writing An Interpreter In Go and Writing A Compiler In Go. I really liked the way the authors of these books explained the concepts. I decided to write down my notes and implement the code in various programming languages. I hope this book will help you understand the concepts of interpreters and compilers. I do not plan to make any money from this book and am making it available under the MIT License. I hope that people will find this book useful and will contribute to it to make it even better.

The "Book"

Read the "book"

The code

The code for the book is available in the code directory. Each language has its own directory. You can also find a link to the code corresponding to each chapter at the end of each chapter.

Since the code in this book builds on the code from the previous chapter, it is not organized as one directory per chapter. Instead, I use git tags to mark the code for each chapter in the book. You can use the following command to check out the code corresponding to a chapter:

git checkout <tag>

where <tag> is the tag for the chapter. For example, to check out the code for chapter 1, you can use the following command:

git checkout chapter-1

The languages

  1. C#
  2. Python
  3. Rust
  4. Go

References

  1. Crafting Interpreters
  2. Writing An Interpreter In Go
  3. Writing A Compiler In Go