about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/interpreter.rs
AgeCommit message (Collapse)AuthorFilesLines
2021-01-13 r/2093 refactor(tazjin/rlox): Wrap interpreter values in new enumVincent Ambo1-25/+52
This makes it possible to distinguish between literal and other values, such as functions. Change-Id: I4d87b96c2988e25a61eecfeeb56188fabfd0dc40 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2367 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-13 r/2092 feat(tazjin/rlox): Parse function callsVincent Ambo1-0/+1
Change-Id: I1836c73dbfd5fc4ca30c2d22bbffee2fb222d566 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2366 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-06 r/2062 feat(tazjin/rlox): Parse & interpret while statementsVincent Ambo1-0/+9
Change-Id: Iee772274de95dfd6a6d4af973402859aeda17b1d Reviewed-on: https://cl.tvl.fyi/c/depot/+/2325 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-06 r/2061 feat(tazjin/rlox): Parse & interpret logical operatorsVincent Ambo1-0/+15
Change-Id: I1a7d0eda61f7f077b820dc0d2c2516e204966962 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2324 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-06 r/2060 feat(tazjin/rlox): Interpret if statementsVincent Ambo1-1/+13
Change-Id: Ic6aed29bec42098eb07e1ba9eb01dbcaae8d11e3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2322 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-01-06 r/2059 feat(tazjin/rlox): Parse if statementsVincent Ambo1-0/+1
Change-Id: I2352d75a3f02d65a5a2d04fb2cc4daa50f11ca1e Reviewed-on: https://cl.tvl.fyi/c/depot/+/2321 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-12-31 r/2039 refactor(tazjin/rlox): Hold shared environment ptr in interpreterVincent Ambo1-17/+37
Change-Id: Ia4c4ef330be431a344d42bc00d3a518825fb9399 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2305 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-12-31 r/2038 feat(tazjin/rlox): Implement block scope in interpreterVincent Ambo1-1/+28
This is currently a bit hacky because of the environment wrapping/unwrapping, will refactor this to just keep a single Rc around instead. Change-Id: Iad1cbbe35112d0329248d4655a09260fc60644c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2304 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-12-31 r/2037 feat(tazjin/rlox): Implement block parsingVincent Ambo1-2/+3
Change-Id: I1b7235ed71fa36120984a36f22cd564f59581352 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2303 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-31 r/2036 refactor(tazjin/rlox): Unify parser::Statement & parser::DeclarationVincent Ambo1-12/+10
Change-Id: I6f21b246eb9d3bf760edb3220ce6be5de5b05b08 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2302 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-31 r/2035 feat(tazjin/rlox): Add support for scoped environmentsVincent Ambo1-8/+26
Adds scoped environments using a sophisticated structure known as an SRPT, which stands for "shitty parent pointer tree". Change-Id: I62f66aabe6eb32ea01c4cabcca5b03cfefcc28ee Reviewed-on: https://cl.tvl.fyi/c/depot/+/2301 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-31 r/2034 refactor(tazjin/rlox): Separate assignment and definitionVincent Ambo1-1/+14
So that: > var a = 15; > b = 12; Error in program: Error { line: 0, kind: UndefinedVariable("b") } > a = 12; print a; Number(12.0) Change-Id: I687e95ccc2d3084e39a71bd452656ae981c95191 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2300 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-31 r/2033 feat(tazjin/rlox): Implement mutable variable assignmentVincent Ambo1-31/+38
Change-Id: I56db10a5ac26958ae27a8d4c8fa7b8f8285bc7e1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2299 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-31 r/2032 refactor(tazjin/rlox): Retain interpreter state in REPLVincent Ambo1-28/+3
Change-Id: Id60760e241ad0e45871b48e499f58e9831d57316 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2298 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-12-31 r/2031 feat(tazjin/rlox): Add global variable support in interpreterVincent Ambo1-76/+135
Change-Id: I4134cf78dc3934a517ad0c848ae1d3729abaf882 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2297 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-12-22 r/2027 feat(tazjin/rlox): Parse variable assignment & accessVincent Ambo1-0/+2
Change-Id: I9894d76716d739e85a4757d9e658f884228e7f52 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2290 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-22 r/2025 refactor(tazjin/rlox): Introduce declarations in parserVincent Ambo1-10/+18
Change-Id: I873fdd53319ec36da18926d9477e809a69dbace7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2288 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-22 r/2024 feat(tazjin/rlox): Add support for statementsVincent Ambo1-17/+25
First part of https://craftinginterpreters.com/statements-and-state.html Supports print statements, as well as evaluation for the sake of it (i.e. future side-effects). Change-Id: Ic6653b568f98d6cfe3f297615b7113c0ba1d9a70 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2287 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-20 r/2019 feat(tazjin/rlox): Add runtime type error handlingVincent Ambo1-14/+31
Change-Id: I0d52bc9ff5be6421cb4131265ed28ce1ea7d8ff3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2282 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-20 r/2018 feat(tazjin/rlox): Implement tree-walk interpreter of exprsVincent Ambo1-3/+67
This is only a subset of the Lox spec so far. It implements the language up to the runtime error chapter on https://craftinginterpreters.com/evaluating-expressions.html Change-Id: I295dbf4b6544420d6fe80b6aaba661fb21acdea6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2281 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-06 r/1991 feat(tazjin/rlox): Synchronise parser state after errorsVincent Ambo1-1/+1
This lets the parser collect multiple errors instead of returning after the first one, with some optimistic synchronisation after encountering something that looks wonky. Change-Id: Ie9d0ce8de9dcc7a3d1e7aa2abe15f74cab0ab96b Reviewed-on: https://cl.tvl.fyi/c/depot/+/2236 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-12-06 r/1990 feat(tazjin/rlox): Wire up parser to the REPLVincent Ambo1-2/+10
Change-Id: I940448c63ce105d53a0f281b6320ffb01378f207 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2235 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-11-28 r/1956 refactor(tazjin/rlox): Thread through scanner errorsVincent Ambo1-2/+17
... and show them to users, very crudely. Change-Id: If4491b14db1124313f6ab7e5fbfdce9fea501d11 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2193 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-11-28 r/1952 fix(tazjin/rlox): Clear previous line in REPL modeVincent Ambo1-2/+3
Change-Id: I8acc5b0d07b2c656f9bba76a6ddac6b9088ea563 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2189 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-11-27 r/1927 chore(tazjin/rlox): Wire scanner to interpreter to reduce warningsVincent Ambo1-1/+5
... they're just noisy at the moment. This isn't complete because it doesn't thread through scanner errors. Change-Id: I0f75d2b20fa3f57be1af5d1d8aa8059856855825 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2162 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2020-11-23 r/1913 feat(tazjin/rlox): Add basic program structureVincent Ambo1-0/+4
... as well as a Nix derivation, because why not. Change-Id: Iaf2591ab72676fe0732c3f807b3aa0cff13fb4ef Reviewed-on: https://cl.tvl.fyi/c/depot/+/2143 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI