Commit graph

3 commits

Author SHA1 Message Date
Vincent Ambo
1d3d9d32e3 feat(tazjin/rlox): Set up precedence parsing scaffolding
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 19:22:58 +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