This repository holds my complete implementation of the clox interpreter from the book Crafting Interpreters. All the tests (except the non-ascii strings one) are passing, and the language is feature complete. I have not completed the final chapter, "Optimizations", so my version probably isn't going to be as fast. I have added support for lists with the help of this tutorial, and a small test suite accompanying it.
- I have modified the test runner at ./tool/bin/test.dart so that it runs properly on Windows systems. I edited the .dart file so that it uses backslashes ("") for Windows filepaths, unfortunately this means that the script might not work on Linux/MacOS systems anymore.
- I copied the tests/ folder from the official repository and added a few of my own.
- I have added support for a list data structure, whose syntax is described below.
Yes I realize that having an append() and delete() function separate as opposed to a.append() and a.delete() is kinda weird, but this is my first time building an interpreter for a programming language and I haven't quite gotten the hang of things yet.
// declaring a list
var a = [1, 2, 3, 4, 5];
// indexing / accessing
print a[0];
// appending to the list
append(a, 5);
print a; // expect: [1, 2, 3, 4, 5, 5]
// deleting an element
delete(a, 0);
print a; // expect: [2, 3, 4, 5, 5]