BASIC Interpreter with Rust

Recap and Feedback


Recap

In this part, we learned a bit about the BASIC programming language and built a BASIC interpreter from scratch using Rust. We started by looking at the big picture of interpreters: an interpreter takes source code as input and executes it directly. However, to do this, we first needed to break down the source code into tokens (lexing) and then build a structured representation of the program (parsing). After that, we need to have a concrete implementation of the interpreter itself, which then executes the parsed program.

Our BASIC interpreter supports variables, control flow with IF, subroutines with GOSUB/RETURN, and functions. It also includes a set of tests, and while building it, we learned about assessing test coverage in Rust.

At the same time, the BASIC interpreter is a stepping stone towards more complex programming languages and interpreters that we will explore in later parts of the course. It does not, for example, have a local scope for variables, it does not support structured programming, and it lacks many features of modern programming languages including types, sensible error messages, data structures, and libraries.

Feedback

Loading Exercise...