Commit graph

233 commits

Author SHA1 Message Date
Vincent Ambo
1fdf581e97 fix(tazjin/emacs): Ensure company is installed
I don't know where this went.

Change-Id: I82d27e273e38ffeffe683d6ff2236d383c7b1fcf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2622
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-03-21 00:55:58 +00:00
Vincent Ambo
e653366153 feat(tazjin/tverskoy): Configure impermanence module
This module is responsible for mounting persistent storage into the
ephemeral root disk of this machine.

Currently only very basic configuration and data are retained, and
hopefully that won't change.

Change-Id: If800cbee60b7b3c5b8c457b9b332a0c05c33f20e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2621
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-03-21 00:55:58 +00:00
Vincent Ambo
6e94b3ca2f feat(tazjin/nixos): Initial check in of new host (tverskoy)
This is my new X13 AMD Thinkpad, on which many fun things will be done.

Change-Id: I4de114a8c5ebb37d2f4844f407d2dc0e7cc9557e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2620
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-03-21 00:55:58 +00:00
Vincent Ambo
8baa4a9595 fix(tazjin/emacs): Use ace-window from MELPA instead of ELPA
This package definition is broken for ELPA in nixpkgs, but adisbladis
is working on it.

Change-Id: Ibe140a2daf7a3a294dae4c6340be33db05a47a44
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2619
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-03-21 00:55:58 +00:00
Vincent Ambo
eb110e9d7c fix(tazjin/emacs): Set notmuch custom variables through :custom
It seems like some of them end up file-local anyways, and the explicit
call to `custom-set-variables` in mail-setup.el had seemingly no effect.

Change-Id: Iad5011b5f8348b1ca5973813995c9644ac85ddf5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2610
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-03-19 23:07:17 +00:00
sterni
90fdd7f23d chore(3p): bump NixOS channels to 2021-03-18
Making this a monthly service apparently.

Necessary changes:

* 3p: expose emacs27 instead of emacs26 which got removed
  users/tazjin/{camden, frog}: switch from emacs26 to emacs27

* 3p/lieer: google_api_python_client got renamed to
  google-api-python-client

Change-Id: I1011665d10eebc99990addbef6a8a6b000b93896
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2605
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
2021-03-19 14:00:50 +00:00
Vincent Ambo
e41bd6a82d fix(tazjin/emacs): Always show newest emails first
The default for this seems to have changed in a recent notmuch
release.

Change-Id: I1542b20c2e3edf72a3472c5277bce313c6df12b8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2595
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-03-06 11:53:16 +00:00
Vincent Ambo
4162186a19 feat(tazjin/rlox): Implement global variable access
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 11:52:00 +00:00
Vincent Ambo
29b2a54705 feat(tazjin/rlox): Implement global variable definition
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 11:52:00 +00:00
Vincent Ambo
b7b94335cc refactor(tazjin/rlox): Refactor Compiler::consume into a macro
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 11:52:00 +00:00
Vincent Ambo
822e5ae57f fix(tazjin/rlox): Resynchronise after panicking
Change-Id: I60939f7a2c523b6ca1e9782e58c97959da38cfff
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2591
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-03-06 11:52:00 +00:00
Vincent Ambo
ed3fce2b19 feat(tazjin/rlox): Implement expression statements
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 10:51:05 +00:00
Vincent Ambo
2cd77ea26d feat(tazjin/rlox): Add support for print statement
Change-Id: Ic3e7e722325c8784b848c0bcd573c2e51e123c40
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2583
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-03-03 10:50:39 +00:00
Vincent Ambo
432e7a7ddd feat(tazjin/rlox): Intern all string constants
This is again a step closer to the book, but there are some notable
differences:

* Only constants encountered by the compiler are interned, all other
  string operations (well, concatenation) happen with heap objects.

* OpReturn will always ensure that a returned string value is newly
  heap allocated and does not reference the interner.

Change-Id: If4f04309446e01b8ff2db51094e9710d465dbc50
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2582
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-03-02 19:48:46 +00:00
Vincent Ambo
bcea8e0d16 test(tazjin/rlox): Add simple string assertions
Change-Id: I6c60934d57170157d877e71cc87a97ab773342b5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2581
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-03-02 19:48:46 +00:00
Vincent Ambo
ef7a0da8cb feat(tazjin/rlox): Add a simple string interner
This is based on this matklad post:

https://matklad.github.io/2020/03/22/fast-simple-rust-interner.html

It's modified slightly to provide a safer interface and slightly more
readable implementation:

* interned string IDs are wrapped in a newtype that is not publicly
  constructible

* unsafe block is reduced to only the small scope in which it is
  needed

* lookup lifetime is pinned explicitly to make the intent clearer when
  reading this code

Change-Id: Ia3dae988f33f8e5e7d8dc0c1a9216914a945b036
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2578
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-03-01 21:09:37 +00:00
Vincent Ambo
6f600c8300 feat(tazjin/rlox): Add initial support for strings
... including concatenation.

This diverges significantly from the book, as I'm using std::String
instead of implementing the book's whole heap object management
system.

It's possible that Lox in Rust actually doesn't need a GC and the
ownership model works just fine.

Change-Id: I374a0461d627cfafc26b2b54bfefac8b7c574d00
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2577
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-03-01 21:09:37 +00:00
Vincent Ambo
369f504250 feat(tazjin/rlox): Implement comparison operators
Change-Id: I03b751db52a3bd502fb4fbda6e89cad087ccad74
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2575
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 14:36:40 +00:00
Vincent Ambo
c58fe2093e feat(tazjin/rlox): Implement equality operator
Change-Id: I5587a11646e228c5af4dc7ca6da026bb4a2592a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2574
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 14:36:40 +00:00
Vincent Ambo
93c30b339c refactor(tazjin/rlox): Let binary_op! work on different types
This makes it possible to specify the input & output types of the
binary_op macro. If only one type is specified, it is assumed that the
input and output types are the same.

Change-Id: Idfcc9ba462db3976b69379b6693d091e1a525a3b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2573
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 14:36:40 +00:00
Vincent Ambo
2d9456d247 feat(tazjin/rlox): Implement unary negation operator
Change-Id: I9a5bd3581d4ed05371651697ec496341eb7971ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2572
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 14:36:40 +00:00
Vincent Ambo
47ffa80711 feat(tazjin/rlox): Support trivial literals in bytecode compiler
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-02-28 14:36:40 +00:00
Vincent Ambo
127ef98486 refactor(tazjin/rlox): Represent VM values as enums
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 12:54:29 +00:00
Vincent Ambo
6b990a7571 test(tazjin/rlox): Add some tests for numerical operations
If I was adding any dependencies, this might be a good one for a
property-based test thing, but I'm not going to.

Change-Id: Ia801d041479d1a88c59ef9e0fe1460b3640382e3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2569
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 11:14:03 +00:00
Vincent Ambo
fd2139ce31 chore(tazjin/rlox): Add stack printing when 'disassemble' is on
Change-Id: I71ae83101002f8fead3fa6cbd4cb229a2d6e3902
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2568
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 11:14:03 +00:00
Vincent Ambo
47c1a9a280 fix(tazjin/rlox): Fix selection of next parser precedence rule
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 11:14:03 +00:00
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
0c9a7de5be fix(tazjin/rlox): Fix identifier order in binary_op macro
Change-Id: I92253e875436bcb42732a157979a9d1e7ca0cd06
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2565
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-28 11:14:03 +00:00
Vincent Ambo
f3d00b84bb chore(tazjin/rlox): Fill in minor missing implementations
This should clean up everything in the way of actually running this
end-to-end.

Change-Id: Ie89d82472a458256a251a4fddc1c36d88d21f5f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2563
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-27 20:19:14 +00:00
Vincent Ambo
758730d25d feat(tazjin/rlox): Print compiled bytecode with disassemble feature
Change-Id: I42293b334248b5228dd90f13b9a400ccdca20a84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2562
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-27 20:19:14 +00:00
Vincent Ambo
56f6a6e9f2 feat(tazjin/rlox): Implement parser precedence rules
Change-Id: Idcf3c84126603086bbf7e8d54773bccb3ae3b5ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2561
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-27 20:19:14 +00:00
Vincent Ambo
7778a58f8d feat(tazjin/rlox): Add initial Pratt parser table lookup
Change-Id: I1b894d2f84d23ddddcd1bb8794f771512b7d677e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2560
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-27 20:19:14 +00:00
Vincent Ambo
d2f24c925d feat(tazjin/rlox): Partial implementation of binary operators
Change-Id: I6f0bc9f58b51dec2673c918e08b199b52e793ed4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2559
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-27 19:22:58 +00:00
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
Vincent Ambo
da2dfb42c6 chore(tazjin/rlox): Add From<Error> for Vec<Error>
This makes it easier to transition between the single/multi error
functions via ?

Change-Id: Ie027f4700da463a549be6f0d4a0022a9b8dc0d61
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2555
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2021-02-27 13:05:18 +00:00
Vincent Ambo
75750ba683 style(tazjin/rlox): Set max_width=80
Change-Id: Ib64831c0b97c94fdfbdbae64f4dfccc86879ef73
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2554
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
bef01b1419 feat(tazjin/emacs): Add #'rg-in-project
Uses project.el to anchor the ripgrep search. In combination with my
project detection logic, this means that grepping in TVL subprojects
works automatically.

Change-Id: I2705466d1de156c08ff0401a71112864aa24f976
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2542
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-22 13:50:34 +00:00
Vincent Ambo
e174bad35b feat(tazjin/emacs): Add layout for reMarkable as primary screen
Change-Id: I4c10e36250aa112d2dd0cebf4ed41e0b6fd8182d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2539
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-02-19 13:37:37 +00:00
Vincent Ambo
83465be599 feat(3p/telega): Pin tdlib version used for telega
Recent channel updates have caused some issues for telega.el, mostly
because the version of tdlib (the C++ library for Telegram) and the
Emacs package are out of sync.

This overrides the version used in the Emacs package to a "known good"
commit. It would be useful to change the tdlib derivation in nixpkgs
to make this version mismatch a hard build error.

Change-Id: I9c994f783e1cc17e933432507cd13b65697efd4a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2445
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-26 13:25:43 +00:00
Vincent Ambo
aa6e7f7c10 chore(tazjin/emacs): Disable my default dark theme temporarily
There's a giant laser in the sky which makes it hard to read anything
on a dark theme.

Change-Id: I1dd0631dc8f8f693cceada4e62b25d4bde322e09
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2442
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-26 10:29:16 +00:00
Vincent Ambo
cf4357d9b7 chore(tazjin/emacs): Remove some unused packages
Change-Id: I4adf7c1e028c997f776c635e1c6210f904274582
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2441
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-25 19:18:09 +00:00
Vincent Ambo
ea9982d9ea feat(tazjin/nittredir): Add Chrome extension to redirect to Nitter
There is another extension for this already, but it hooks in after the
page has already started loading - doing it on the URL change handler
is much faster.

Change-Id: I442552cbd8bb040df999a1624cafd436f4a7b875
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2430
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-20 15:36:05 +00:00
Vincent Ambo
de64ebbbaa feat(tazjin/emacs): Reset keyboard layout before locking screen
I managed to lock myself out by having the layout set to Russian while
locking the screen. This prevents that from happening.

Change-Id: I15780d2a626d96abe0af8db3736fad75034e66d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2424
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-19 15:04:16 +00:00
Vincent Ambo
5868d4bd49 refactor(tazjin/rlox): Prepare scanner for shared use
In the book, the clox interpreter has its own scanner which uses a
pull-based model for a single pass compiler.

I can't be bothered to write another scanner, or amend this one into
pull-mode to work with the treewalk interpreter, so instead I will
just reuse it and pull from a vector of tokens.

The tokens are shared between both interpreters and the scanner is not
what I'm interested in here.

Change-Id: Ib07e89127fce2b047f9b3e1ff7e9908d798b3b2b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2420
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2021-01-19 09:57:05 +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