about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/compiler.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-02-28 r/2251 refactor(tazjin/rlox): Represent VM values as enumsVincent Ambo1-1/+1
Introduces a new enum which represents the different types of possible values, and modifies the rest of the existing code to wrap/unwrap these enum variants correctly. Notably in the vm module, a new macro has been introduced that makes it possible to encode a type expectation and return a runtime error in case of a type mismatch. Change-Id: I325b5e31e395c62d8819ab2af6d398e1277333c0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2570 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-28 r/2248 fix(tazjin/rlox): Fix selection of next parser precedence ruleVincent Ambo1-1/+1
Without this fix we would keep parsing in the same precedence level and get weird things like: 10 - -10 + 10 => 10 Change-Id: If2bed4569fbf566027011037165a9b3c09b7427c Reviewed-on: https://cl.tvl.fyi/c/depot/+/2567 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-28 r/2247 feat(tazjin/rlox): Wire up bytecode interpreter & print resultsVincent Ambo1-0/+287
This makes the bytecode interpreter actually usable. Change-Id: I24afc7ce461c6673dc42581378f6e14da7aece5c Reviewed-on: https://cl.tvl.fyi/c/depot/+/2566 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-27 r/2239 feat(tazjin/rlox): Set up precedence parsing scaffoldingVincent Ambo1-101/+0
Defines a new precedence levels enum which can be used to restrict the parser precedence in any given location. As an example, unary expressions and grouping are implemented, as these have a different precedence from e.g. expression() Change-Id: I91f299fc77530f76c3aba717f638985428104ee5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2558 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-27 r/2238 chore(tazjin/rlox): Set up some scaffolding for panic modeVincent Ambo1-5/+22
This lets us suppress reporting of additional errors from the compiler until a synchronisation point is reached. Change-Id: Iacf90949f868fbdb4349750065b5e458cf74d32a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2557 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-02-27 r/2237 feat(tazjin/rlox): Bootstrap rough shape of bytecode compilerVincent Ambo1-0/+84
This one necessarily has to diverge more from the book than the treewalk interpreter did, so some of this is expected to change, but I'm happy with the rough shape. Since we're reusing the old scanner, the compiler/parser struct owns an iterator over all tokens with which the pull-scanner from the bytecode chapters is simulated. Change-Id: Icfa0bd4729d9df786e08f7e49a25cba1b9989a91 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2556 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>