about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/interpreter/tests.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-01-16 r/2114 feat(tazjin/rlox): Use variable depth for env lookupVincent Ambo1-1/+4
Finishes the binding implementation from https://craftinginterpreters.com/resolving-and-binding.html Change-Id: I1e2c1f4139d9e77ce0b99e38db26edd4cdb56ad2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2404 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-14 r/2109 feat(tazjin/rlox): Implement support for closuresVincent Ambo1-0/+22
Change-Id: I0ffc810807a1a6ec90455a4f2d2bd977833005bd Reviewed-on: https://cl.tvl.fyi/c/depot/+/2396 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-14 r/2107 refactor(tazjin/rlox): Let scanner tokens own their lexemeVincent Ambo1-19/+10
This removes the runtime dependency on a borrow into the program source code. It's not yet ideal because there are a lot of tokens where we really don't care about the lexeme, but this is what the book does and I am not going to change that. Change-Id: I888e18f98597766d6f725cbf9241e8eb2bd839e2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2394 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-14 r/2106 feat(tazjin/rlox): Implement function definitionsVincent Ambo1-0/+15
... with this, functions now work. Note that this bubbled up another weird code structure nit: The parser::Function type should probably not carry its name directly. However this doesn't matter much and I don't care right now. Change-Id: If8e3b23f07033260433b9acd45f37c0e61fd2ff8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2393 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-14 r/2104 refactor(tazjin/rlox): Thread lifetimes through interpreterVincent Ambo1-8/+17
In order to store a function in the interpreter's representation of a callable, the lifetimes used throughout rlox need to be threaded through properly. This is currently not optimal, for two reasons: * following the design of the book's scanner, the source code slice needs to still be available at runtime. Rust makes this explicit, but it seems unnecessary. * the interpreter's lifetime is now bounded to be smaller than the source's, which means that the REPL no longer persists state between evaluations Both of these can be fixed eventually by diverging the scanner from the book slightly, but right now that's not my priority. Change-Id: Id0bf694541ff59795cfdea3c64a965384a49bfe2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2391 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-14 r/2100 test(tazjin/rlox): Add a handful of interpreter testsVincent Ambo1-0/+63
Change-Id: I32dd896d42cc73d68d73093e9cbb74b48d95e041 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2386 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI