about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/opcode.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-10-22 r/2985 refactor(tazjin/rlox): Return index after adding operationsVincent Ambo1-0/+3
Change-Id: I100eb9b55ace37e5c7c878d3c224b567ee8d1e36 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3738 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-10-20 r/2980 refactor(tazjin/rlox): Introduce newtypes for various indicesVincent Ambo1-6/+12
Since this code is essentially a fairly plain translation from C, it is a bit confusing to deal with the original untyped code. This is an attempt to try and clean some of it up. Change-Id: Icd21f531932e1a811c0d6dbf2e9acba61ca9c45d Reviewed-on: https://cl.tvl.fyi/c/depot/+/3734 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-10-19 r/2978 feat(tazjin/rlox): Support local variablesVincent Ambo1-0/+2
WIP Change-Id: I78fbc885faaac165c380cbd9aa98b4b64a9b8274 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3685 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-10-19 r/2977 feat(tazjin/rlox): Global variable assignmentVincent Ambo1-0/+1
Needed for example code compatibility. Change-Id: Id83210eaaad7dcfef5aa238dd3a7ec159f6935e9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3684 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-03-06 r/2274 feat(tazjin/rlox): Implement global variable accessVincent Ambo1-1/+2
This also includes a fix for an issue where the identifiers of variables were pushed onto the stack, which is incorrect. Change-Id: Id89b388268efad295f29978d767aa4b33c4ded14 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2594 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-03-06 r/2273 feat(tazjin/rlox): Implement global variable definitionVincent Ambo1-0/+3
identifier_str might look a bit overengineered, but we want to reuse this bit of code and it needs a reference to the token from which to pick the identifier. The problem with this is that the token would be owned by self, but the function needs to mutate (the interner), so this implementation is the most straightforward way of acquiring and working with an immutable reference to the token before interning the identifier. Change-Id: I618ce8f789cb59b3a9c5b79a13111ea6d00b2424 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2592 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-03-03 r/2265 feat(tazjin/rlox): Implement expression statementsVincent Ambo1-0/+1
These aren't particularly useful without side effects, but one step at a time. This diverges slightly from the book, in that OpPop retains the last value it "forgot" from the stack in a special field on the interpreter. This makes it possible to return values from expression statements, which helps in cases where Lox is embedded as a scripting language (please don't do this ever) or in tests. Change-Id: Ided0bc04c6e80ddb23ba4693d61ac9e08b002d58 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2584 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-03-03 r/2264 feat(tazjin/rlox): Add support for print statementVincent Ambo1-0/+3
Change-Id: Ic3e7e722325c8784b848c0bcd573c2e51e123c40 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2583 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-28 r/2256 feat(tazjin/rlox): Implement comparison operatorsVincent Ambo1-0/+2
Change-Id: I03b751db52a3bd502fb4fbda6e89cad087ccad74 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2575 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-28 r/2255 feat(tazjin/rlox): Implement equality operatorVincent Ambo1-1/+2
Change-Id: I5587a11646e228c5af4dc7ca6da026bb4a2592a6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2574 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-28 r/2253 feat(tazjin/rlox): Implement unary negation operatorVincent Ambo1-0/+3
Change-Id: I9a5bd3581d4ed05371651697ec496341eb7971ae Reviewed-on: https://cl.tvl.fyi/c/depot/+/2572 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-28 r/2252 feat(tazjin/rlox): Support trivial literals in bytecode compilerVincent Ambo1-1/+6
Adds support for true, false & nil. These each come with a new separate opcode and are pushed directly on the stack. Change-Id: I405b5b09496dcf99d514d3411c083e0834377167 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2571 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-01-17 r/2128 feat(tazjin/rlox): Implement simple arithmetic operatorsVincent Ambo1-0/+9
Change-Id: I9873bcd281053f4e9820a5119f5992a0b8cb8cfc Reviewed-on: https://cl.tvl.fyi/c/depot/+/2417 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-01-17 r/2124 feat(tazjin/rlox): Initial bytecode representationVincent Ambo1-0/+8
This is significantly simplified from the version in the book, since I'm using Rust's Vec and not implementing dynamic arrays manually. We'll see if I run into issues with that ... Change-Id: Ie3446ac3884b850f3ba73a4b1a6ca14e68054188 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2413 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI