This project is an implementation of the Lox programming language interpreter, built in Rust. Lox is a dynamically typed scripting language with features like variables, control flow, functions, and object-oriented programming.
- Lexer and Parser: Implements a lexer and recursive descent parser for Lox.
- Expression Evaluation: Supports arithmetic expressions and precedence handling (e.g.,
2 + 2 * 2
will be2 + (2 * 2)
which evaluates to6
). - Print Statements: Handles
print
statements to output results (e.g.,print 2 + 2;
outputs4
). - Variable Storage: Supports variable declarations and usage (e.g.,
var i = 2; print i;
outputs2
).
- Scope: It defines a region where a name maps to a certain entity, and will potentially help us get
classes
andfunctions
For Example:
{
var a = "first block",
print a; // "first block"
}
{
var a = "second block",
print a; // second block
}
- Control Flow: Planned support for
if
,else
,while
, andfor
loops. - Functions: Planned support for defining and calling functions.
- Classes and Objects: Planned support for class definitions, instantiation, and method calls.
- Closures: Planned support for closures and lexical scoping.