about summary refs log tree commit diff
path: root/users/tazjin/rlox/src (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2021-03-06 r/2273 feat(tazjin/rlox): Implement global variable definitionVincent Ambo5-15/+80
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-06 r/2272 refactor(tazjin/rlox): Refactor Compiler::consume into a macroVincent Ambo1-18/+21
Making this function a macro instead makes it possible to match arbitrary token kinds, even the ones that carry data, without changing the syntax too much. Change-Id: I5cda9e36d6833bd9c259f7d4d8340db6e783b4e8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2593 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-03-06 r/2271 fix(tazjin/rlox): Resynchronise after panickingVincent Ambo1-1/+32
Change-Id: I60939f7a2c523b6ca1e9782e58c97959da38cfff Reviewed-on: https://cl.tvl.fyi/c/depot/+/2591 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
2021-03-05 r/2270 feat(users/sterni/nix/utf8): pure nix utf-8 decodersterni3-0/+332
users.sterni.nix.utf8 implements UTF-8 decoding in pure nix. We implement the decoding as a simple state machine which is fed one byte at a time. Decoding whole strings is possible by subsequently calling step. This is done in decode which uses builtins.foldl' to get around recursion restrictions and a neat trick using builtins.deepSeq puck showed me limiting the size of the thunks in a foldl' (which can also cause a stack overflow). This makes decoding arbitrarily large UTF-8 files into codepoints using nix theoretically possible, but it is not really practical: Decoding a 36KB LaTeX file I had lying around takes ~160s on my laptop. Change-Id: Iab8c973dac89074ec280b4880a7408e0b3d19bc7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2590 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-05 r/2269 feat(users/sterni/nix/flow): add switch conditionalsterni1-23/+53
switch would probably otherwise be called match, but has been renamed so it isn't confused with string.match and the enum matching capabilities yants has. It implements the closest to pattern matching nix can come which is still flexible enough to not be painful: Syntactically it works like cond, but is given a value. Instead of booleans it checks passed predicates or equality if simple values are passed. Both types of checks can be mixed. Change-Id: I40f000979cfd469316e15fd58d6c3a80312c1cc4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2589 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-05 r/2268 feat(users/sterni/nix/fun): make lrs read left to right completelysterni1-1/+1
Change-Id: I57d290f770bc1d6bd88a46924889b919d68201e3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2588 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-05 r/2267 refactor(users/sterni/nix/string): don't calculate length for dropsterni1-4/+5
Since nix ends the substring at the end of the string anyways we can just statically use the largest nix integer as the length of the string. According to my testing this it ever so slightly faster as well. Change-Id: I64566e91c7b223f03dcebe3bc5710696dc4261bc Reviewed-on: https://cl.tvl.fyi/c/depot/+/2587 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-05 r/2266 feat(users/sterni/nix): move flow.match to string.matchsterni5-14/+17
After all it only matches strings. Change-Id: I3d2e5221ef43f692de69028e78ed98b6b11f82d1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2586 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-03 r/2265 feat(tazjin/rlox): Implement expression statementsVincent Ambo4-53/+78
These aren't particularly useful without side effects,