Commit graph

10 commits

Author SHA1 Message Date
Vincent Ambo
995d024f03 feat(tazjin/rlox): Wire up bytecode interpreter & print results
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-28 11:14:03 +00:00
Vincent Ambo
b13a6736dd chore(tazjin/rlox): Set up some scaffolding for panic mode
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 19:22:58 +00:00
Vincent Ambo
ee974b3edd feat(tazjin/rlox): Bootstrap rough shape of bytecode compiler
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>
2021-02-27 13:05:18 +00:00
Vincent Ambo
ebc987f4aa chore(tazjin/rlox): Implement From<ScannerError> for bytecode errors
Change-Id: I446c6e38cf239a132882d37df156884d319ca111
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2553
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-02-27 13:05:18 +00:00
Vincent Ambo
1ff7a2686c refactor(tazjin/rlox): Add Interpreter trait for switching impls
Change-Id: Iae28d64ce879014c5e5d7e145c536c1f16ad307d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2418
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-18 00:24:16 +00:00
Vincent Ambo
d6d3c12efb feat(tazjin/rlox): Implement simple arithmetic operators
Change-Id: I9873bcd281053f4e9820a5119f5992a0b8cb8cfc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2417
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-01-17 21:17:54 +00:00
Vincent Ambo
7fb93fb490 feat(tazjin/rlox): Bootstrap VM for Lox bytecode
Change-Id: I479e20bf2087e5c4aa20e31b364c57ed0d961bcf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2416
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-01-17 21:17:54 +00:00
Vincent Ambo
c26915d012 feat(tazjin/rlox): Track source lines along with bytecode
Change-Id: I272e73b9b1c9571fbfe4fa983fb4283ddee02bd4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2414
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-17 21:17:54 +00:00
Vincent Ambo
49c4cc6c56 feat(tazjin/rlox): Initial bytecode representation
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
2021-01-17 21:17:54 +00:00
Vincent Ambo
30a6fcccee refactor(tazjin/rlox): Move entrypoints into interpreters
Right now this introduces a simple mechanism to flip between the
interpreters.

Change-Id: I92ee920c53d76ab6b664ac671993a6d6426af61a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2412
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-17 21:17:54 +00:00